gengetopt-2.22.6/0000775000175000017500000000000012046541044010602 500000000000000gengetopt-2.22.6/config.h.in0000664000175000017500000002736612046536544012574 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 when the gnulib module getopt-gnu should be tested. */ #undef GNULIB_TEST_GETOPT_GNU /* Define to 1 when the gnulib module strdup should be tested. */ #undef GNULIB_TEST_STRDUP /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ #undef HAVE_DECL_GETENV /* Define to 1 if you have the declaration of `getopt_clip', and to 0 if you don't. */ #undef HAVE_DECL_GETOPT_CLIP /* Define to 1 if you have the declaration of `optreset', and to 0 if you don't. */ #undef HAVE_DECL_OPTRESET /* Define to 1 if you have the declaration of `strdup', and to 0 if you don't. */ #undef HAVE_DECL_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long_only' function. */ #undef HAVE_GETOPT_LONG_ONLY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H /* */ #undef HAVE_LONG_LONG /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* define if the compiler implements namespaces */ #undef HAVE_NAMESPACES /* Define to 1 if chown is declared even after undefining macros. */ #undef HAVE_RAW_DECL_CHOWN /* Define to 1 if dup2 is declared even after undefining macros. */ #undef HAVE_RAW_DECL_DUP2 /* Define to 1 if dup3 is declared even after undefining macros. */ #undef HAVE_RAW_DECL_DUP3 /* Define to 1 if endusershell is declared even after undefining macros. */ #undef HAVE_RAW_DECL_ENDUSERSHELL /* Define to 1 if environ is declared even after undefining macros. */ #undef HAVE_RAW_DECL_ENVIRON /* Define to 1 if euidaccess is declared even after undefining macros. */ #undef HAVE_RAW_DECL_EUIDACCESS /* Define to 1 if faccessat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_FACCESSAT /* Define to 1 if fchdir is declared even after undefining macros. */ #undef HAVE_RAW_DECL_FCHDIR /* Define to 1 if fchownat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_FCHOWNAT /* Define to 1 if fsync is declared even after undefining macros. */ #undef HAVE_RAW_DECL_FSYNC /* Define to 1 if ftruncate is declared even after undefining macros. */ #undef HAVE_RAW_DECL_FTRUNCATE /* Define to 1 if getcwd is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETCWD /* Define to 1 if getdomainname is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETDOMAINNAME /* Define to 1 if getdtablesize is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETDTABLESIZE /* Define to 1 if getgroups is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETGROUPS /* Define to 1 if gethostname is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETHOSTNAME /* Define to 1 if getlogin is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETLOGIN /* Define to 1 if getlogin_r is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETLOGIN_R /* Define to 1 if getpagesize is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETPAGESIZE /* Define to 1 if getusershell is declared even after undefining macros. */ #undef HAVE_RAW_DECL_GETUSERSHELL /* Define to 1 if lchown is declared even after undefining macros. */ #undef HAVE_RAW_DECL_LCHOWN /* Define to 1 if link is declared even after undefining macros. */ #undef HAVE_RAW_DECL_LINK /* Define to 1 if linkat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_LINKAT /* Define to 1 if lseek is declared even after undefining macros. */ #undef HAVE_RAW_DECL_LSEEK /* Define to 1 if memmem is declared even after undefining macros. */ #undef HAVE_RAW_DECL_MEMMEM /* Define to 1 if mempcpy is declared even after undefining macros. */ #undef HAVE_RAW_DECL_MEMPCPY /* Define to 1 if memrchr is declared even after undefining macros. */ #undef HAVE_RAW_DECL_MEMRCHR /* Define to 1 if pipe2 is declared even after undefining macros. */ #undef HAVE_RAW_DECL_PIPE2 /* Define to 1 if pread is declared even after undefining macros. */ #undef HAVE_RAW_DECL_PREAD /* Define to 1 if pwrite is declared even after undefining macros. */ #undef HAVE_RAW_DECL_PWRITE /* Define to 1 if rawmemchr is declared even after undefining macros. */ #undef HAVE_RAW_DECL_RAWMEMCHR /* Define to 1 if readlink is declared even after undefining macros. */ #undef HAVE_RAW_DECL_READLINK /* Define to 1 if readlinkat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_READLINKAT /* Define to 1 if rmdir is declared even after undefining macros. */ #undef HAVE_RAW_DECL_RMDIR /* Define to 1 if setusershell is declared even after undefining macros. */ #undef HAVE_RAW_DECL_SETUSERSHELL /* Define to 1 if sleep is declared even after undefining macros. */ #undef HAVE_RAW_DECL_SLEEP /* Define to 1 if stpcpy is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STPCPY /* Define to 1 if stpncpy is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STPNCPY /* Define to 1 if strcasestr is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRCASESTR /* Define to 1 if strchrnul is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRCHRNUL /* Define to 1 if strdup is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRDUP /* Define to 1 if strncat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRNCAT /* Define to 1 if strndup is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRNDUP /* Define to 1 if strnlen is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRNLEN /* Define to 1 if strpbrk is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRPBRK /* Define to 1 if strsep is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRSEP /* Define to 1 if strsignal is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRSIGNAL /* Define to 1 if strtok_r is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRTOK_R /* Define to 1 if strverscmp is declared even after undefining macros. */ #undef HAVE_RAW_DECL_STRVERSCMP /* Define to 1 if symlink is declared even after undefining macros. */ #undef HAVE_RAW_DECL_SYMLINK /* Define to 1 if symlinkat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_SYMLINKAT /* Define to 1 if ttyname_r is declared even after undefining macros. */ #undef HAVE_RAW_DECL_TTYNAME_R /* Define to 1 if unlink is declared even after undefining macros. */ #undef HAVE_RAW_DECL_UNLINK /* Define to 1 if unlinkat is declared even after undefining macros. */ #undef HAVE_RAW_DECL_UNLINKAT /* Define to 1 if usleep is declared even after undefining macros. */ #undef HAVE_RAW_DECL_USLEEP /* define if the compiler has stringstream */ #undef HAVE_SSTREAM /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* define if the compiler supports Standard Template Library */ #undef HAVE_STL /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to 500 only on HP-UX. */ #undef _XOPEN_SOURCE /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define to rpl_ if the getopt replacement functions and variables should be used. */ #undef __GETOPT_PREFIX /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. __APPLE__ && __MACH__ test for MacOS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict /* Work around a bug in Sun C++: it does not support _Restrict or __restrict__, even though the corresponding Sun C compiler ends up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. Perhaps some future version of Sun C++ will work with restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict # define __restrict__ #endif /* Define to `unsigned int' if does not define. */ #undef size_t /* Define as a marker that can be attached to declarations that might not be used. This helps to reduce warnings, such as from GCC -Wunused-parameter. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) # define _GL_UNUSED __attribute__ ((__unused__)) #else # define _GL_UNUSED #endif /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED gengetopt-2.22.6/README0000664000175000017500000000454012044745036011412 00000000000000 GNU Gengetopt This program generates a C function that uses /getopt_long/ function to parse the command line options, to validate them and fills a /struct/ . Thus your program can now handle options such as: myprog --input foo.c -o foo.o --no-tabs -i 100 *.class And both long options (those that start with --) and short options (start with - and consist of only one character) can be handled. For standards about short and long options you may want to take a look at the GNU Coding Standards . gengetopt is *free software*. Please see the file LICENSE and COPYING for details. Notice that: Use of gengetopt _does not impose any particular license on the generated code: the code generated is not under any license_. For installation, please read the INSTALL file. For documentation, please read the info documentation. gengetopt is perfect if you are too lazy (like me) to write all stuff required to call getopt_long, and when you have a program and wish it took options. Generated code works if you use /GNU Autoconf/ or /GNU Automake/ . Gengetopt has originally been written by *Roberto Arturo Tena Sanchez* >, and currently maintained by *Lorenzo Bettini* http://www.lorenzobettini.it . Gengetopt is a GNU program and its main home page is at GNU site: http://www.gnu.org/software/gengetopt/gengetopt.html Download You can download it from GNU's ftp site: ftp://ftp.gnu.org/gnu/gengetopt/ or from one of its mirrors (see http://www.gnu.org/prep/ftp.html ). Anonymous Git Checkout This project's git repository can be checked out through the following clone instruction: git clone git://git.savannah.gnu.org/gengetopt.git Further instructions can be found at the address: http://savannah.gnu.org/projects/gengetopt. And the git repository can also browsed on-line at http://git.savannah.gnu.org/cgit/gengetopt.git. Since version 2.22.4 of Gengetopt the CVS repository was dismissed in favor of Git (http://git-scm.com/). *Lorenzo Bettini* http://www.lorenzobettini.it gengetopt is free software. See the file LICENSE and COPYING for copying conditions. Anyway we won't get offended if you send us a postcard :-) C/C++ files are formatted with /GNU Source-highlight/ (http://www.gnu.org/software/src-highlite/ ) by Lorenzo Bettini. gengetopt-2.22.6/tests/0000775000175000017500000000000012046541044011744 500000000000000gengetopt-2.22.6/tests/wrong_default.ggo0000664000175000017500000000015612044745036015231 00000000000000# wrong default value: invalid number option "noarg" n "multiple option with no arg" int default="hhh" gengetopt-2.22.6/tests/test_only_flags_cmd.ggo0000664000175000017500000000024112044745036016403 00000000000000# test_only_flags_cmd.ggo # This test an input file with only flag option package "test_only_flags" version "1.0" option "foo" f "foo option" flag on gengetopt-2.22.6/tests/no_optgiven_cmd.c.test0000664000175000017500000003370412045003074016162 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/no_optgiven_cmd.ggo --func-name=no_optgiven_cmd_parser --file-name=no_optgiven_cmd --no-handle-error -u The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "no_optgiven_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: no_optgiven [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -i, --foo=INT foo option", 0 }; typedef enum {ARG_NO , ARG_INT } no_optgiven_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int no_optgiven_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_optgiven_cmd_parser_params *params, const char *additional_error); static int no_optgiven_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; } void no_optgiven_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(NO_OPTGIVEN_CMD_PARSER_PACKAGE_NAME) ? NO_OPTGIVEN_CMD_PARSER_PACKAGE_NAME : NO_OPTGIVEN_CMD_PARSER_PACKAGE), NO_OPTGIVEN_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { no_optgiven_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void no_optgiven_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void no_optgiven_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void no_optgiven_cmd_parser_params_init(struct no_optgiven_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct no_optgiven_cmd_parser_params * no_optgiven_cmd_parser_params_create(void) { struct no_optgiven_cmd_parser_params *params = (struct no_optgiven_cmd_parser_params *)malloc(sizeof(struct no_optgiven_cmd_parser_params)); no_optgiven_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void no_optgiven_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->foo_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int no_optgiven_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", NO_OPTGIVEN_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); i = EXIT_SUCCESS; return i; } int no_optgiven_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", NO_OPTGIVEN_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = no_optgiven_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void no_optgiven_cmd_parser_free (struct gengetopt_args_info *args_info) { no_optgiven_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int no_optgiven_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return no_optgiven_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int no_optgiven_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_optgiven_cmd_parser_params *params) { int result; result = no_optgiven_cmd_parser_internal (argc, argv, args_info, params, 0); return result; } int no_optgiven_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct no_optgiven_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = no_optgiven_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); return result; } int no_optgiven_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (no_optgiven_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; return result; } int no_optgiven_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->foo_given) { fprintf (stderr, "%s: '--foo' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see no_optgiven_cmd_parser_params.check_ambiguity * @param override @see no_optgiven_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, no_optgiven_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int no_optgiven_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct no_optgiven_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) no_optgiven_cmd_parser_init (args_info); no_optgiven_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'i' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVi:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ no_optgiven_cmd_parser_print_help (); no_optgiven_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ no_optgiven_cmd_parser_print_version (); no_optgiven_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'i': /* foo option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "foo", 'i', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", NO_OPTGIVEN_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (check_required) { error_occurred += no_optgiven_cmd_parser_required2 (args_info, argv[0], additional_error); } no_optgiven_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: no_optgiven_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_multiple_parsers.c0000664000175000017500000000343312045003074016457 00000000000000#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_main_cmdline_cmd.h" #include "test_first_cmdline_cmd.h" #include "test_second_cmdline_cmd.h" int main(int argc, char **argv) { struct gengetopt_args_info main_args_info; struct test_first_cmdline_cmd_struct first_args_info; struct test_second_cmdline_cmd_struct second_args_info; int exit_code = 0; unsigned int i, j; if (test_main_cmdline_cmd_parser (argc, argv, &main_args_info) != 0) { exit_code = 1; return exit_code; } for (j = 0; j < main_args_info.second_cmd_given; ++j) { printf("second cmdline: %s\n", main_args_info.second_cmd_arg[j]); if (test_second_cmdline_cmd_parser_string (main_args_info.second_cmd_arg[j], &second_args_info, argv[0]) == 0) { if (second_args_info.option_a_given) printf(" --option-a: %s\n", second_args_info.option_a_arg); if (second_args_info.option_b_given) printf(" --option-b: %s\n", second_args_info.option_b_arg); for (i = 0; i < second_args_info.my_multi_given; ++i) printf(" --my-multi: %s\n", second_args_info.my_multi_arg[i]); test_second_cmdline_cmd_parser_free (&second_args_info); } } for (j = 0; j < main_args_info.first_cmd_given; ++j) { printf("first cmdline: %s\n", main_args_info.first_cmd_arg[j]); if (test_first_cmdline_cmd_parser_string (main_args_info.first_cmd_arg[j], &first_args_info, argv[0]) == 0) { if (first_args_info.option_a_given) printf(" --option-a: %d\n", first_args_info.option_a_arg); for (i = 0; i < first_args_info.multi_given; ++i) printf(" --multi: %s\n", first_args_info.multi_arg[i]); test_first_cmdline_cmd_parser_free (&first_args_info); } } test_main_cmdline_cmd_parser_free (&main_args_info); return exit_code; } gengetopt-2.22.6/tests/test_second_cmdline_cmd.h.test0000664000175000017500000002421712045003074017644 00000000000000/** @file test_second_cmdline_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_SECOND_CMDLINE_CMD_H #define TEST_SECOND_CMDLINE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE PACKAGE #endif #ifndef TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef TEST_SECOND_CMDLINE_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_SECOND_CMDLINE_CMD_PARSER_VERSION VERSION #endif /** @brief Where the command line options are stored */ struct test_second_cmdline_cmd_struct { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * option_a_arg; /**< @brief option a of the second command line to parse. */ char * option_a_orig; /**< @brief option a of the second command line to parse original value given at command line. */ const char *option_a_help; /**< @brief option a of the second command line to parse help description. */ char * option_b_arg; /**< @brief option a of the second command line to parse. */ char * option_b_orig; /**< @brief option a of the second command line to parse original value given at command line. */ const char *option_b_help; /**< @brief option a of the second command line to parse help description. */ char ** my_multi_arg; /**< @brief multiple option of the second command line to parse. */ char ** my_multi_orig; /**< @brief multiple option of the second command line to parse original value given at command line. */ unsigned int my_multi_min; /**< @brief multiple option of the second command line to parse's minimum occurreces */ unsigned int my_multi_max; /**< @brief multiple option of the second command line to parse's maximum occurreces */ const char *my_multi_help; /**< @brief multiple option of the second command line to parse help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int option_a_given ; /**< @brief Whether option-a was given. */ unsigned int option_b_given ; /**< @brief Whether option-b was given. */ unsigned int my_multi_given ; /**< @brief Whether my-multi was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_second_cmdline_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure test_second_cmdline_cmd_struct (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure test_second_cmdline_cmd_struct (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *test_second_cmdline_cmd_struct_purpose; /** @brief the usage string of the program */ extern const char *test_second_cmdline_cmd_struct_usage; /** @brief the description string of the program */ extern const char *test_second_cmdline_cmd_struct_description; /** @brief all the lines making the help output */ extern const char *test_second_cmdline_cmd_struct_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_second_cmdline_cmd_parser_ext() instead */ int test_second_cmdline_cmd_parser2 (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser_ext (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, struct test_second_cmdline_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser_dump(FILE *outfile, struct test_second_cmdline_cmd_struct *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser_file_save(const char *filename, struct test_second_cmdline_cmd_struct *args_info); /** * Print the help */ void test_second_cmdline_cmd_parser_print_help(void); /** * Print the version */ void test_second_cmdline_cmd_parser_print_version(void); /** * Initializes all the fields a test_second_cmdline_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_second_cmdline_cmd_parser_params_init(struct test_second_cmdline_cmd_parser_params *params); /** * Allocates dynamically a test_second_cmdline_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_second_cmdline_cmd_parser_params structure */ struct test_second_cmdline_cmd_parser_params *test_second_cmdline_cmd_parser_params_create(void); /** * Initializes the passed test_second_cmdline_cmd_struct structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_second_cmdline_cmd_parser_init (struct test_second_cmdline_cmd_struct *args_info); /** * Deallocates the string fields of the test_second_cmdline_cmd_struct structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_second_cmdline_cmd_parser_free (struct test_second_cmdline_cmd_struct *args_info); /** * The string parser (interprets the passed string as a command line) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser_string (const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name); /** * The string parser (version with additional parameters - deprecated) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_second_cmdline_cmd_parser_string_ext() instead */ int test_second_cmdline_cmd_parser_string2 (const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, int override, int initialize, int check_required); /** * The string parser (version with additional parameters) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_second_cmdline_cmd_parser_string_ext (const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, struct test_second_cmdline_cmd_parser_params *params); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_second_cmdline_cmd_parser_required (struct test_second_cmdline_cmd_struct *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_SECOND_CMDLINE_CMD_H */ gengetopt-2.22.6/tests/canonize-names-cmd.ggo0000664000175000017500000000044712045003074016032 00000000000000# canonize_names-cmd.ggo # This tests how names are canonized ('-' must become '_') package "canonize_names" version "1.0" defgroup "my.group2" option "foo-bar" i "foo-bar option" int no defgroup "my/group3" option "foo.foo" j "foo.foo option" int no defgroup "my-group" gengetopt-2.22.6/tests/test_conf_parser_ov2.sh.in0000664000175000017500000000017512044745036016763 00000000000000#! @SHELL@ if $* ./test_conf_parser_ov2 -r "bar" --float 2.14 -i 100 -c @srcdir@/test_conf2.conf; then true; else false; fi gengetopt-2.22.6/tests/test_newlines_cmd.ggo0000664000175000017500000000023712044745036016077 00000000000000# newlines escaped in options option "format" F "this is the \\nformat used for find -printf" optional string typestr="fmt" default="%p\\t%s\\n"gengetopt-2.22.6/tests/wrong_flag.err0000664000175000017500000000010012044745036014517 00000000000000wrong_flag.ggo:4: invalid specification for this kind of option gengetopt-2.22.6/tests/no_optgiven2.c0000664000175000017500000000126312045003074014436 00000000000000/* no_optgiven.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "no_optgiven_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ /* since it is called with no option we expect an error since the option --foo is required, however we check for this explicitly by calling the _required function */ if (no_optgiven_cmd_parser2 (argc, argv, &args_info, 0, 1, 0) == 0) { fprintf(stderr, "the no_optgiven_cmd_parser2 returned successfully\n"); } if (no_optgiven_cmd_parser_required (&args_info, argv[0]) == 0) exit(0); return 1; } gengetopt-2.22.6/tests/test_all_opts_option_help.c0000664000175000017500000000241612045003074017302 00000000000000/* test_all_opts_option_help.c test */ /* test option help fields in the presence of text before and after */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_all_opts_cmd.h" #define PRINT_OPTION(s) printf("%s: %s\n", # s, args_info.s) #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) #endif // FIX_UNUSED static struct gengetopt_args_info args_info; int main (int argc, char **argv) { FIX_UNUSED (argc); FIX_UNUSED (argv); test_all_opts_cmd_parser_init (&args_info); PRINT_OPTION(help_help); PRINT_OPTION(full_help_help); PRINT_OPTION(version_help); PRINT_OPTION(string_help); PRINT_OPTION(int_help); PRINT_OPTION(short_help); PRINT_OPTION(long_help); PRINT_OPTION(float_help); PRINT_OPTION(double_help); PRINT_OPTION(longdouble_help); PRINT_OPTION(longlong_help); PRINT_OPTION(flag_help); PRINT_OPTION(function_help); PRINT_OPTION(no_short_help); PRINT_OPTION(opt_arg_help); PRINT_OPTION(opt_arg_short_help); PRINT_OPTION(required_help); PRINT_OPTION(hidden_help); PRINT_OPTION(dependant_help); PRINT_OPTION(very_very_long_option_help); PRINT_OPTION(assume_multimeth_virtual_help); PRINT_OPTION(file_save_help); test_all_opts_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_no_options_cmd.h.test0000664000175000017500000001474112045003074017066 00000000000000/** @file test_no_options_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_NO_OPTIONS_CMD_H #define TEST_NO_OPTIONS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_NO_OPTIONS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_NO_OPTIONS_CMD_PARSER_PACKAGE "test_no_options" #endif #ifndef TEST_NO_OPTIONS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_NO_OPTIONS_CMD_PARSER_PACKAGE_NAME "test_no_options" #endif #ifndef TEST_NO_OPTIONS_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_NO_OPTIONS_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_no_options_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_no_options_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_no_options_cmd_parser_ext() instead */ int test_no_options_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_no_options_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_no_options_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_no_options_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_no_options_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_no_options_cmd_parser_print_help(void); /** * Print the version */ void test_no_options_cmd_parser_print_version(void); /** * Initializes all the fields a test_no_options_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_no_options_cmd_parser_params_init(struct test_no_options_cmd_parser_params *params); /** * Allocates dynamically a test_no_options_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_no_options_cmd_parser_params structure */ struct test_no_options_cmd_parser_params *test_no_options_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_no_options_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_no_options_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_no_options_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_NO_OPTIONS_CMD_H */ gengetopt-2.22.6/tests/wrong_enum_use.ggo0000664000175000017500000000025612044745036015426 00000000000000# enum type can only be used with options with values option "okenum" - "values with enum type" values="foo","bar" enum option "notok" - "wrong enum type" enum gengetopt-2.22.6/tests/valgrind_suppressions.sh.in0000664000175000017500000000261212044745036017276 00000000000000#! @SHELL@ # --------------------------------------------------------------------- # # # Script to run some examples through VALGRIND and # to suppress errors # # Michael Hagemann # # modified by Lorenzo Bettini # # --------------------------------------------------------------------- # VG_PRG="@VALGRIND@" VG_ARGS="--tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes --suppressions=@srcdir@/suppressions.supp --gen-suppressions=yes" VGRIND="${VG_ENV} ${VG_PRG} ${VG_ARGS}" if test ! -x "${VG_PRG}"; then echo Valgrind not found! Check path. exit 1 fi # --------------------------------------------------------------------- # DATE=`date +"%Y-%m-%d_%H%M"` SUMMARY=valgrind_summary.log TMP_LOG=valgrind_tmp.log ERROR=0 # --------------------------------------------------------------------- # vgrind () { if test ! -x "$1" -o "$1" == `basename $0`; then # echo "Skipping $1." return fi echo -n "Running $* ..." tmp_err= if [[ $1 == *.sh ]]; then eval $1 ${VGRIND} else eval ${VGRIND} $* fi; } # --------------------------------------------------------------------- # for PROG in $*; do vgrind @top_builddir@/tests/$PROG; done # --------------------------------------------------------------------- # # cat ${SUMMARY} exit ${ERROR} gengetopt-2.22.6/tests/test_values.c0000664000175000017500000001065712045003074014372 00000000000000/* test_values.c test */ /* test values options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_values_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { unsigned int i; int result = 0; if (test_values_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } if (args_info.string_values_given) { printf ("specified --string-values with argument %s\n", args_info.string_values_arg); printf ("specified --string-values with (original) argument %s\n", args_info.string_values_orig); } if (!args_info.string_values_def_given) printf ("(un)"); printf ("specified --string-values-def with argument %s\n", args_info.string_values_def_arg); if (!args_info.string_values_def_argopt_given) printf ("(un)"); printf ("specified --string-values-def-argopt with argument %s\n", args_info.string_values_def_argopt_arg); if (args_info.string_values_no_short_given) { printf ("specified --string-values-no-short with argument %s\n", args_info.string_values_no_short_arg); } for (i = 0; i < args_info.multistring_values_given; ++i) { printf ("specified --multistring-values with argument %s\n", args_info.multistring_values_arg[i]); printf ("specified --multistring-values with (original) argument %s\n", args_info.multistring_values_orig[i]); } for (i = 0; i < args_info.multistring_values_def_given; ++i) { printf ("specified --multistring-values-def with argument %s\n", args_info.multistring_values_def_arg[i]); printf ("specified --multistring-values-def with (original) argument %s\n", (args_info.multistring_values_def_orig[i] ? args_info.multistring_values_def_orig[i] : "(null)")); } for (i = 0; i < args_info.multistring_values_no_short_given; ++i) printf ("specified --multistring-values-no-short with argument %s\n", args_info.multistring_values_no_short_arg[i]); if (args_info.int_values_given) { printf ("specified --int-values with argument %d\n", args_info.int_values_arg); printf ("specified --int-values with (original) argument %s\n", args_info.int_values_orig); } for (i = 0; i < args_info.int_values_m_given; ++i) { printf("specified --int-values-m with argument %d\n", args_info.int_values_m_arg[i]); printf ("specified --int-values-m with (original) argument %s\n", args_info.int_values_m_orig[i]); } if (!args_info.int_values_def_given) printf ("(un)"); printf ("specified --int-values-def with argument %d\n", args_info.int_values_def_arg); if (args_info.values_first_enums_given) printf("specified --values-first-enums with argument %d (%s)\n", args_info.values_first_enums_arg, test_values_cmd_parser_values_first_enums_values [args_info.values_first_enums_arg]); if (args_info.values_first_enums_plus_given) printf("specified --values-first-enums-plus with argument %d (%s)\n", args_info.values_first_enums_plus_arg, test_values_cmd_parser_values_first_enums_plus_values [args_info.values_first_enums_plus_arg]); if (!args_info.values_second_enums_given) printf ("(un)"); printf("specified --values-second-enums with argument %d (%s)\n", args_info.values_second_enums_arg, test_values_cmd_parser_values_second_enums_values [args_info.values_second_enums_arg]); for (i = 0; i < args_info.values_multiple_enums_given; ++i) { printf ("specified --values-multiple-enums with argument %d\n", args_info.values_multiple_enums_arg[i]); printf ("specified --values-multiple-enums with (original) argument %s\n", (args_info.values_multiple_enums_orig[i] ? args_info.values_multiple_enums_orig[i] : "(null)")); } if (args_info.values_unspecified_enums_arg == values_unspecified_enums__NULL) printf("--values-unspecified-enums: %d\n", args_info.values_unspecified_enums_arg); if (args_info.file_save_given) { if (test_values_cmd_parser_file_save (args_info.file_save_arg, &args_info) == EXIT_FAILURE) result = 1; else printf ("saved configuration file %s\n", args_info.file_save_arg); } end: test_values_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/no_prog_name.c0000664000175000017500000000342212045003074014467 00000000000000/* no_prog_name.c test */ /* Checks that the program name is not in the returned command line arguments. Simulates the program name in the arguments by copying a pointer to argv[0] */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "test_all_opts_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { unsigned int i = 0; char *my_argv[6]; int result = 0; my_argv[0] = "prog name"; my_argv[1] = my_argv[0]; my_argv[2] = "-r"; my_argv[3] = "foo"; my_argv[4] = "unamed"; my_argv[5] = 0; if (test_all_opts_cmd_parser (5, my_argv, &args_info) != 0) exit(1) ; if (args_info.opt_arg_given) { printf ("specified --opt-arg"); if (args_info.opt_arg_arg) printf (" with argument %s\n", args_info.opt_arg_arg); else printf ("\n"); } if (args_info.opt_arg_short_given) { printf ("specified --opt-arg-short"); if (args_info.opt_arg_short_arg) printf (" with argument %s\n", args_info.opt_arg_short_arg); else printf ("\n"); } if (args_info.hidden_given) printf ("specified --hidden: %d\n", args_info.hidden_arg); if (args_info.required_given) printf ("specified --required: %s\n", args_info.required_arg); for (i = 0; i < args_info.inputs_num; i++) { printf ("additional: %s\n", args_info.inputs[i]); if (strcmp(args_info.inputs[i], "prog name") == 0) result = 1; /* the test fails if the "prog name" is in the remaining arguments */ } if (args_info.file_save_given && test_all_opts_cmd_parser_file_save (args_info.file_save_arg, &args_info) != EXIT_SUCCESS) exit(1) ; test_all_opts_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/test_redef_help.c0000664000175000017500000000116712045003074015164 00000000000000/* test_redef_help.c test */ /* test redefinition of help and version */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_redef_help_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { int result = 0; if (test_redef_help_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } if (args_info.height_given) { printf ("specified --height\n"); } if (args_info.vavoom_given) { printf ("specified -V\n"); } test_redef_help_cmd_parser_free (&args_info); end: return result; } gengetopt-2.22.6/tests/test_first_cmdline_cmd.h.test0000664000175000017500000002325712045003074017523 00000000000000/** @file test_first_cmdline_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_FIRST_CMDLINE_CMD_H #define TEST_FIRST_CMDLINE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE PACKAGE #endif #ifndef TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef TEST_FIRST_CMDLINE_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_FIRST_CMDLINE_CMD_PARSER_VERSION VERSION #endif /** @brief Where the command line options are stored */ struct test_first_cmdline_cmd_struct { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int option_a_arg; /**< @brief option a of the first command line to parse. */ char * option_a_orig; /**< @brief option a of the first command line to parse original value given at command line. */ const char *option_a_help; /**< @brief option a of the first command line to parse help description. */ char ** multi_arg; /**< @brief multiple option of the first command line to parse. */ char ** multi_orig; /**< @brief multiple option of the first command line to parse original value given at command line. */ unsigned int multi_min; /**< @brief multiple option of the first command line to parse's minimum occurreces */ unsigned int multi_max; /**< @brief multiple option of the first command line to parse's maximum occurreces */ const char *multi_help; /**< @brief multiple option of the first command line to parse help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int option_a_given ; /**< @brief Whether option-a was given. */ unsigned int multi_given ; /**< @brief Whether multi was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_first_cmdline_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure test_first_cmdline_cmd_struct (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure test_first_cmdline_cmd_struct (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *test_first_cmdline_cmd_struct_purpose; /** @brief the usage string of the program */ extern const char *test_first_cmdline_cmd_struct_usage; /** @brief the description string of the program */ extern const char *test_first_cmdline_cmd_struct_description; /** @brief all the lines making the help output */ extern const char *test_first_cmdline_cmd_struct_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_first_cmdline_cmd_parser_ext() instead */ int test_first_cmdline_cmd_parser2 (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser_ext (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, struct test_first_cmdline_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser_dump(FILE *outfile, struct test_first_cmdline_cmd_struct *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser_file_save(const char *filename, struct test_first_cmdline_cmd_struct *args_info); /** * Print the help */ void test_first_cmdline_cmd_parser_print_help(void); /** * Print the version */ void test_first_cmdline_cmd_parser_print_version(void); /** * Initializes all the fields a test_first_cmdline_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_first_cmdline_cmd_parser_params_init(struct test_first_cmdline_cmd_parser_params *params); /** * Allocates dynamically a test_first_cmdline_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_first_cmdline_cmd_parser_params structure */ struct test_first_cmdline_cmd_parser_params *test_first_cmdline_cmd_parser_params_create(void); /** * Initializes the passed test_first_cmdline_cmd_struct structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_first_cmdline_cmd_parser_init (struct test_first_cmdline_cmd_struct *args_info); /** * Deallocates the string fields of the test_first_cmdline_cmd_struct structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_first_cmdline_cmd_parser_free (struct test_first_cmdline_cmd_struct *args_info); /** * The string parser (interprets the passed string as a command line) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser_string (const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name); /** * The string parser (version with additional parameters - deprecated) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_first_cmdline_cmd_parser_string_ext() instead */ int test_first_cmdline_cmd_parser_string2 (const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, int override, int initialize, int check_required); /** * The string parser (version with additional parameters) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_first_cmdline_cmd_parser_string_ext (const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, struct test_first_cmdline_cmd_parser_params *params); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_first_cmdline_cmd_parser_required (struct test_first_cmdline_cmd_struct *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_FIRST_CMDLINE_CMD_H */ gengetopt-2.22.6/tests/test_multiple_cmd.ggo0000664000175000017500000000301112044745036016077 00000000000000package "test_multiple" version "1.0" # test_multiple_cmd.ggo # test options that can be given more than once option "string" s "string option" string default="foo" optional multiple option "int" i "int option" int required multiple option "short" S "short option" short optional multiple option "long" l "long option" long optional multiple option "longlong" - "long long option" longlong optional multiple option "limited" L "limited multiple option" string optional multiple(3) option "limited-interval" - "limited multiple option (with interval)" string optional multiple(1-3) option "big-limited-interval" - "limited multiple option (with interval)" string optional multiple(1-30) option "limited-open-right" - "limited multiple option (with interval right open)" string optional multiple(3-) option "limited-open-left" - "limited multiple option (with interval left open)" string optional multiple(-3) option "float" f "float option" float default="15000" optional multiple option "no-short-opt" - "string option with no short" string optional multiple option "noarg" n "multiple option with no arg" no multiple option "noarg-noshort" - "multiple option with no arg and no short" no multiple option "optarg" M "multi with optional args" string typestr="ID" no argoptional multiple option "optarg-noshort" - "multi with optional args and no short" string typestr="ID" no argoptional multiple option "file-save" - "save the passed options into a file" string nogengetopt-2.22.6/tests/test_all_opts_cmd.ggo0000664000175000017500000000564312045003074016064 00000000000000# test_all_opts_cmd.ggo # test all kinds of options package "test_all_opts" version "1.0" versiontext "This text is printed after the version during --version this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test!" purpose "This is just a gengetopt's test file" description "This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL" # this empty text will simply add a line break in the help output text "" option "string" s " string option" string optional option "int" i "int option" int optional option "short" S "short option" short optional option "long" l "long option" long optional option "float" f "float option" float optional option "double" d "double option" double optional option "longdouble" D "longdouble option" longdouble optional option "longlong" L "longlong option" longlong optional option "flag" F "flag option" flag on option "function" u "function option" optional details="\na `function' option is basically an option with no argument. It can be used, e.g., to specify a specific behavior for a program. Well, this further explanation is quite useless, but it's only to show an example of an option with details, which will be printed only when --detailed-help is given at the command line.\n" option "no-short" - "no short option" optional option "opt-arg" - "option with optional arg" argoptional string optional option "opt-arg-short" o "option with optional arg (short)" optional string argoptional option "required" r "required option" string yes details="NOTICE: This option is required, so, unless you specify (-h)--help or (-V)--version, you must always specify this option (and its argument) at command line." text "\nBefore the dependant option there is a hidden option, \ so it shouldn't be visible in the output of --help, \ but it will be visible in the output of --full-help.\n" option "hidden" H "hidden option" int optional hidden option "dependant" A "option that depends on opt-arg" string optional dependon="opt-arg" text "\nThis is a text line just to write something in the \ output\n\nNotice that a text line can contain line breaks, \ just like this very text, and that, just like all the other texts, \ it is wrapped by gengetopt automatically if it's too long.\n" text "\nMoreover, text can be specified more than once in the input file.\n" option "very-very-long-option" - "the name of this option is long \ enough to make this description begin on a new line" string optional option "assume-multimeth-virtual" y "the name of this option is just \ as long as the maximum allowed, so this description begin on a new line" optional option "file-save" - "save the passed options into a file" string optional text "\nA text after all options."gengetopt-2.22.6/tests/test_modes_cmd.ggo0000664000175000017500000000176212044745036015366 00000000000000package "test_modes" version "1.0" section "some non mode options" option "no-mode" N "a generic option not beloging to any mode" optional option "no-mode2" - "another generic option not beloging to any mode" string optional section "some modes just for testing" defmode "mode 2" defmode "my mode" defmode "mode1" modedesc="any option of this mode is in contrast with any \ option of the other mode\nNotice that this description is quite long so \ it may spawn many lines... \ fortunately gengetopt will wrap it for you :-)" modeoption "opta" a "string a" multiple mode="mode1" optional modeoption "optA" A "string A" string argoptional mode="mode1" required modeoption "optAmul" M "string M" argoptional string mode="mode1" multiple optional modeoption "optb" b "string b" mode="mode1" optional modeoption "optc" - "string c" mode="mode 2" optional modeoption "optd" d "string d" mode="mode 2" required modeoption "mopt" m "option of my mode" int optional mode="my mode" optional gengetopt-2.22.6/tests/test_redef_help_cmd.ggo0000664000175000017500000000031612044745036016346 00000000000000# test_redef_help_cmd.ggo # test redefinition of help and version options package "test_redef_help" version "1.0" option "height" h "height" no option "vavoom" V "vavoom instead of version" no gengetopt-2.22.6/tests/test_modes_cmd.c.test0000664000175000017500000007676012045003074016012 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_modes_cmd.ggo --func-name=test_modes_cmd_parser --file-name=test_modes_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_modes_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_modes [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", "\nsome non mode options:", " -N, --no-mode a generic option not beloging to any mode", " --no-mode2=STRING another generic option not beloging to any mode", "\nsome modes just for testing:", "\n Mode: mode1\n any option of this mode is in contrast with any option of the other mode\n Notice that this description is quite long so it may spawn many lines...\n fortunately gengetopt will wrap it for you :-)", " -a, --opta string a", " -A, --optA[=STRING] string A (mandatory)", " -M, --optAmul[=STRING] string M", " -b, --optb string b", "\n Mode: mode 2", " --optc string c", " -d, --optd string d (mandatory)", "\n Mode: my mode", " -m, --mopt=INT option of my mode", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT } test_modes_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_modes_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_modes_cmd_parser_params *params, const char *additional_error); static int test_modes_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->no_mode_given = 0 ; args_info->no_mode2_given = 0 ; args_info->opta_given = 0 ; args_info->optA_given = 0 ; args_info->optAmul_given = 0 ; args_info->optb_given = 0 ; args_info->optc_given = 0 ; args_info->optd_given = 0 ; args_info->mopt_given = 0 ; args_info->mode_2_mode_counter = 0 ; args_info->mode1_mode_counter = 0 ; args_info->my_mode_mode_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->no_mode2_arg = NULL; args_info->no_mode2_orig = NULL; args_info->optA_arg = NULL; args_info->optA_orig = NULL; args_info->optAmul_arg = NULL; args_info->optAmul_orig = NULL; args_info->mopt_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->no_mode_help = gengetopt_args_info_help[3] ; args_info->no_mode2_help = gengetopt_args_info_help[4] ; args_info->opta_help = gengetopt_args_info_help[7] ; args_info->opta_min = 0; args_info->opta_max = 0; args_info->optA_help = gengetopt_args_info_help[8] ; args_info->optAmul_help = gengetopt_args_info_help[9] ; args_info->optAmul_min = 0; args_info->optAmul_max = 0; args_info->optb_help = gengetopt_args_info_help[10] ; args_info->optc_help = gengetopt_args_info_help[12] ; args_info->optd_help = gengetopt_args_info_help[13] ; args_info->mopt_help = gengetopt_args_info_help[15] ; } void test_modes_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_MODES_CMD_PARSER_PACKAGE_NAME) ? TEST_MODES_CMD_PARSER_PACKAGE_NAME : TEST_MODES_CMD_PARSER_PACKAGE), TEST_MODES_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_modes_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_modes_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_modes_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_modes_cmd_parser_params_init(struct test_modes_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_modes_cmd_parser_params * test_modes_cmd_parser_params_create(void) { struct test_modes_cmd_parser_params *params = (struct test_modes_cmd_parser_params *)malloc(sizeof(struct test_modes_cmd_parser_params)); test_modes_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_modes_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->no_mode2_arg)); free_string_field (&(args_info->no_mode2_orig)); free_string_field (&(args_info->optA_arg)); free_string_field (&(args_info->optA_orig)); free_multiple_string_field (args_info->optAmul_given, &(args_info->optAmul_arg), &(args_info->optAmul_orig)); free_string_field (&(args_info->mopt_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_modes_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_MODES_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->no_mode_given) write_into_file(outfile, "no-mode", 0, 0 ); if (args_info->no_mode2_given) write_into_file(outfile, "no-mode2", args_info->no_mode2_orig, 0); write_multiple_into_file(outfile, args_info->opta_given, "opta", 0, 0); if (args_info->optA_given) write_into_file(outfile, "optA", args_info->optA_orig, 0); write_multiple_into_file(outfile, args_info->optAmul_given, "optAmul", args_info->optAmul_orig, 0); if (args_info->optb_given) write_into_file(outfile, "optb", 0, 0 ); if (args_info->optc_given) write_into_file(outfile, "optc", 0, 0 ); if (args_info->optd_given) write_into_file(outfile, "optd", 0, 0 ); if (args_info->mopt_given) write_into_file(outfile, "mopt", args_info->mopt_orig, 0); i = EXIT_SUCCESS; return i; } int test_modes_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_MODES_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_modes_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_modes_cmd_parser_free (struct gengetopt_args_info *args_info) { test_modes_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_modes_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_modes_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_modes_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_modes_cmd_parser_params *params) { int result; result = test_modes_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_modes_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_modes_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_modes_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_modes_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_modes_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_modes_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_modes_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_modes_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_modes_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (args_info->mode1_mode_counter && check_multiple_option_occurrences(prog_name, args_info->opta_given, args_info->opta_min, args_info->opta_max, "'--opta' ('-a')")) error_occurred = 1; if (args_info->mode1_mode_counter && ! args_info->optA_given) { fprintf (stderr, "%s: '--optA' ('-A') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } if (args_info->mode1_mode_counter && check_multiple_option_occurrences(prog_name, args_info->optAmul_given, args_info->optAmul_min, args_info->optAmul_max, "'--optAmul' ('-M')")) error_occurred = 1; if (args_info->mode_2_mode_counter && ! args_info->optd_given) { fprintf (stderr, "%s: '--optd' ('-d') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_modes_cmd_parser_params.check_ambiguity * @param override @see test_modes_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_modes_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_modes_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_modes_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } static int check_modes( int given1[], const char *options1[], int given2[], const char *options2[]) { int i = 0, j = 0, errors = 0; while (given1[i] >= 0) { if (given1[i]) { while (given2[j] >= 0) { if (given2[j]) { ++errors; fprintf(stderr, "%s: option %s conflicts with option %s\n", package_name, options1[i], options2[j]); } ++j; } } ++i; } return errors; } int test_modes_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_modes_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * optAmul_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_modes_cmd_parser_init (args_info); test_modes_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "no-mode", 0, NULL, 'N' }, { "no-mode2", 1, NULL, 0 }, { "opta", 0, NULL, 'a' }, { "optA", 2, NULL, 'A' }, { "optAmul", 2, NULL, 'M' }, { "optb", 0, NULL, 'b' }, { "optc", 0, NULL, 0 }, { "optd", 0, NULL, 'd' }, { "mopt", 1, NULL, 'm' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVNaA::M::bdm:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_modes_cmd_parser_print_help (); test_modes_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_modes_cmd_parser_print_version (); test_modes_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'N': /* a generic option not beloging to any mode. */ if (update_arg( 0 , 0 , &(args_info->no_mode_given), &(local_args_info.no_mode_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-mode", 'N', additional_error)) goto failure; break; case 'a': /* string a. */ args_info->mode1_mode_counter += 1; local_args_info.opta_given++; break; case 'A': /* string A. */ args_info->mode1_mode_counter += 1; if (update_arg( (void *)&(args_info->optA_arg), &(args_info->optA_orig), &(args_info->optA_given), &(local_args_info.optA_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "optA", 'A', additional_error)) goto failure; break; case 'M': /* string M. */ args_info->mode1_mode_counter += 1; if (update_multiple_arg_temp(&optAmul_list, &(local_args_info.optAmul_given), optarg, 0, 0, ARG_STRING, "optAmul", 'M', additional_error)) goto failure; break; case 'b': /* string b. */ args_info->mode1_mode_counter += 1; if (update_arg( 0 , 0 , &(args_info->optb_given), &(local_args_info.optb_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optb", 'b', additional_error)) goto failure; break; case 'd': /* string d. */ args_info->mode_2_mode_counter += 1; if (update_arg( 0 , 0 , &(args_info->optd_given), &(local_args_info.optd_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optd", 'd', additional_error)) goto failure; break; case 'm': /* option of my mode. */ args_info->my_mode_mode_counter += 1; if (update_arg( (void *)&(args_info->mopt_arg), &(args_info->mopt_orig), &(args_info->mopt_given), &(local_args_info.mopt_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "mopt", 'm', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* another generic option not beloging to any mode. */ if (strcmp (long_options[option_index].name, "no-mode2") == 0) { if (update_arg( (void *)&(args_info->no_mode2_arg), &(args_info->no_mode2_orig), &(args_info->no_mode2_given), &(local_args_info.no_mode2_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "no-mode2", '-', additional_error)) goto failure; } /* string c. */ else if (strcmp (long_options[option_index].name, "optc") == 0) { args_info->mode_2_mode_counter += 1; if (update_arg( 0 , 0 , &(args_info->optc_given), &(local_args_info.optc_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optc", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_MODES_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ update_multiple_arg((void *)&(args_info->optAmul_arg), &(args_info->optAmul_orig), args_info->optAmul_given, local_args_info.optAmul_given, 0, ARG_STRING, optAmul_list); args_info->opta_given += local_args_info.opta_given; local_args_info.opta_given = 0; args_info->optAmul_given += local_args_info.optAmul_given; local_args_info.optAmul_given = 0; if (args_info->mode_2_mode_counter && args_info->mode1_mode_counter) { int mode_2_given[] = {args_info->optc_given, args_info->optd_given, -1}; const char *mode_2_desc[] = {"--optc", "--optd", 0}; int mode1_given[] = {args_info->opta_given, args_info->optA_given, args_info->optAmul_given, args_info->optb_given, -1}; const char *mode1_desc[] = {"--opta", "--optA", "--optAmul", "--optb", 0}; error_occurred += check_modes(mode_2_given, mode_2_desc, mode1_given, mode1_desc); } if (args_info->mode_2_mode_counter && args_info->my_mode_mode_counter) { int mode_2_given[] = {args_info->optc_given, args_info->optd_given, -1}; const char *mode_2_desc[] = {"--optc", "--optd", 0}; int my_mode_given[] = {args_info->mopt_given, -1}; const char *my_mode_desc[] = {"--mopt", 0}; error_occurred += check_modes(mode_2_given, mode_2_desc, my_mode_given, my_mode_desc); } if (args_info->mode1_mode_counter && args_info->my_mode_mode_counter) { int mode1_given[] = {args_info->opta_given, args_info->optA_given, args_info->optAmul_given, args_info->optb_given, -1}; const char *mode1_desc[] = {"--opta", "--optA", "--optAmul", "--optb", 0}; int my_mode_given[] = {args_info->mopt_given, -1}; const char *my_mode_desc[] = {"--mopt", 0}; error_occurred += check_modes(mode1_given, mode1_desc, my_mode_given, my_mode_desc); } if (check_required) { error_occurred += test_modes_cmd_parser_required2 (args_info, argv[0], additional_error); } test_modes_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (optAmul_list, 1 ); test_modes_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_manual_help_cmd.c0000664000175000017500000004163212044775610016213 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_manual_help_cmd.ggo --func-name=test_manual_help_cmd_parser --file-name=test_manual_help_cmd --unamed-opt --show-required --no-help --no-version The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_manual_help_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_manual_help [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_detailed_help[] = { " -h, --help show help (possibly of other options)", " -?, --detailed-help show detailed help", " -V, --version show version of the program", " --height=INT this is the description of height", " These are the details of option height", " --vavoom=STRING this is the description of vavoom", 0 }; static void init_help_array(void) { gengetopt_args_info_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_help[4] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_help[5] = 0; } const char *gengetopt_args_info_help[6]; typedef enum {ARG_NO , ARG_STRING , ARG_INT } test_manual_help_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_manual_help_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_manual_help_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->detailed_help_given = 0 ; args_info->version_given = 0 ; args_info->height_given = 0 ; args_info->vavoom_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->height_orig = NULL; args_info->vavoom_arg = NULL; args_info->vavoom_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { init_help_array(); args_info->help_help = gengetopt_args_info_detailed_help[0] ; args_info->detailed_help_help = gengetopt_args_info_detailed_help[1] ; args_info->version_help = gengetopt_args_info_detailed_help[2] ; args_info->height_help = gengetopt_args_info_detailed_help[3] ; args_info->vavoom_help = gengetopt_args_info_detailed_help[5] ; } void test_manual_help_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_MANUAL_HELP_CMD_PARSER_PACKAGE_NAME) ? TEST_MANUAL_HELP_CMD_PARSER_PACKAGE_NAME : TEST_MANUAL_HELP_CMD_PARSER_PACKAGE), TEST_MANUAL_HELP_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_manual_help_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_manual_help_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_manual_help_cmd_parser_print_detailed_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_detailed_help[i]) printf("%s\n", gengetopt_args_info_detailed_help[i++]); } void test_manual_help_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_manual_help_cmd_parser_params_init(struct test_manual_help_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_manual_help_cmd_parser_params * test_manual_help_cmd_parser_params_create(void) { struct test_manual_help_cmd_parser_params *params = (struct test_manual_help_cmd_parser_params *)malloc(sizeof(struct test_manual_help_cmd_parser_params)); test_manual_help_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void test_manual_help_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->height_orig)); free_string_field (&(args_info->vavoom_arg)); free_string_field (&(args_info->vavoom_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_manual_help_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_MANUAL_HELP_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->detailed_help_given) write_into_file(outfile, "detailed-help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->height_given) write_into_file(outfile, "height", args_info->height_orig, 0); if (args_info->vavoom_given) write_into_file(outfile, "vavoom", args_info->vavoom_orig, 0); i = EXIT_SUCCESS; return i; } int test_manual_help_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_MANUAL_HELP_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_manual_help_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_manual_help_cmd_parser_free (struct gengetopt_args_info *args_info) { test_manual_help_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_manual_help_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_manual_help_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_manual_help_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_manual_help_cmd_parser_params *params) { int result; result = test_manual_help_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_manual_help_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_manual_help_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_manual_help_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_manual_help_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_manual_help_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_manual_help_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_manual_help_cmd_parser_params.check_ambiguity * @param override @see test_manual_help_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_manual_help_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_manual_help_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_manual_help_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_manual_help_cmd_parser_init (args_info); test_manual_help_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "detailed-help", 0, NULL, '?' }, { "version", 0, NULL, 'V' }, { "height", 1, NULL, 0 }, { "vavoom", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "h?V", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* show help (possibly of other options). */ if (update_arg( 0 , 0 , &(args_info->help_given), &(local_args_info.help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "help", 'h', additional_error)) goto failure; break; case '?': /* show detailed help. */ if (optopt) /* '?' represents an unrecognized option */ goto failure; if (update_arg( 0 , 0 , &(args_info->detailed_help_given), &(local_args_info.detailed_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "detailed-help", '?', additional_error)) goto failure; break; case 'V': /* show version of the program. */ if (update_arg( 0 , 0 , &(args_info->version_given), &(local_args_info.version_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "version", 'V', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* this is the description of height. */ if (strcmp (long_options[option_index].name, "height") == 0) { if (update_arg( (void *)&(args_info->height_arg), &(args_info->height_orig), &(args_info->height_given), &(local_args_info.height_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "height", '-', additional_error)) goto failure; } /* this is the description of vavoom. */ else if (strcmp (long_options[option_index].name, "vavoom") == 0) { if (update_arg( (void *)&(args_info->vavoom_arg), &(args_info->vavoom_orig), &(args_info->vavoom_given), &(local_args_info.vavoom_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "vavoom", '-', additional_error)) goto failure; } break; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_MANUAL_HELP_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_manual_help_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_manual_help_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_simple_multiple_default.sh.in0000664000175000017500000000014512044745036020601 00000000000000#! @SHELL@ # the next program must succeed if $* ./test_simple_multiple; then true; else false; fi gengetopt-2.22.6/tests/test_modes_cmd.h.test0000664000175000017500000002131112045003074015775 00000000000000/** @file test_modes_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_MODES_CMD_H #define TEST_MODES_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_MODES_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_MODES_CMD_PARSER_PACKAGE "test_modes" #endif #ifndef TEST_MODES_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_MODES_CMD_PARSER_PACKAGE_NAME "test_modes" #endif #ifndef TEST_MODES_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_MODES_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ const char *no_mode_help; /**< @brief a generic option not beloging to any mode help description. */ char * no_mode2_arg; /**< @brief another generic option not beloging to any mode. */ char * no_mode2_orig; /**< @brief another generic option not beloging to any mode original value given at command line. */ const char *no_mode2_help; /**< @brief another generic option not beloging to any mode help description. */ unsigned int opta_min; /**< @brief string a's minimum occurreces */ unsigned int opta_max; /**< @brief string a's maximum occurreces */ const char *opta_help; /**< @brief string a help description. */ char * optA_arg; /**< @brief string A. */ char * optA_orig; /**< @brief string A original value given at command line. */ const char *optA_help; /**< @brief string A help description. */ char ** optAmul_arg; /**< @brief string M. */ char ** optAmul_orig; /**< @brief string M original value given at command line. */ unsigned int optAmul_min; /**< @brief string M's minimum occurreces */ unsigned int optAmul_max; /**< @brief string M's maximum occurreces */ const char *optAmul_help; /**< @brief string M help description. */ const char *optb_help; /**< @brief string b help description. */ const char *optc_help; /**< @brief string c help description. */ const char *optd_help; /**< @brief string d help description. */ int mopt_arg; /**< @brief option of my mode. */ char * mopt_orig; /**< @brief option of my mode original value given at command line. */ const char *mopt_help; /**< @brief option of my mode help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int no_mode_given ; /**< @brief Whether no-mode was given. */ unsigned int no_mode2_given ; /**< @brief Whether no-mode2 was given. */ unsigned int opta_given ; /**< @brief Whether opta was given. */ unsigned int optA_given ; /**< @brief Whether optA was given. */ unsigned int optAmul_given ; /**< @brief Whether optAmul was given. */ unsigned int optb_given ; /**< @brief Whether optb was given. */ unsigned int optc_given ; /**< @brief Whether optc was given. */ unsigned int optd_given ; /**< @brief Whether optd was given. */ unsigned int mopt_given ; /**< @brief Whether mopt was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int mode_2_mode_counter; /**< @brief Counter for mode mode_2 */ int mode1_mode_counter; /**< @brief Counter for mode mode1 */ int my_mode_mode_counter; /**< @brief Counter for mode my_mode */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_modes_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_modes_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_modes_cmd_parser_ext() instead */ int test_modes_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_modes_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_modes_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_modes_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_modes_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_modes_cmd_parser_print_help(void); /** * Print the version */ void test_modes_cmd_parser_print_version(void); /** * Initializes all the fields a test_modes_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_modes_cmd_parser_params_init(struct test_modes_cmd_parser_params *params); /** * Allocates dynamically a test_modes_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_modes_cmd_parser_params structure */ struct test_modes_cmd_parser_params *test_modes_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_modes_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_modes_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_modes_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_MODES_CMD_H */ gengetopt-2.22.6/tests/test_sections_cmd.c.test0000664000175000017500000006101312045003074016513 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_sections_cmd.ggo --func-name=test_sections_cmd_parser --file-name=test_sections_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_sections_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_sections [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -s, --string=STRING string option", " -i, --int=INT int option", "\nFirst section. This \"section\" definition has no description, since the\ndescription is in the definition itself, that is wrapped too:", " -S, --short=SHORT short option", " -l, --long=LONG long option", " -f, --float=FLOAT float option", " -d, --double=DOUBLE double option", " -D, --longdouble=LONGDOUBLE longdouble option", "\nSecond section:", " The following options belong to the second section\n by the way this second section also has this neat description, and it is\n quite long so it should require some kind of line wrapping, but don't worry:\n gengetopt will wrap it for you! ;-)", " -L, --longlong=LONGLONG longlong option", " -F, --flag flag option (default=on)", " -u, --function function option", "\nLast section:", " --no-short no short option", " -r, --required=STRING required option (mandatory)", 0 }; typedef enum {ARG_NO , ARG_FLAG , ARG_STRING , ARG_INT , ARG_SHORT , ARG_LONG , ARG_FLOAT , ARG_DOUBLE , ARG_LONGDOUBLE , ARG_LONGLONG } test_sections_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_sections_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_sections_cmd_parser_params *params, const char *additional_error); static int test_sections_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->string_given = 0 ; args_info->int_given = 0 ; args_info->short_given = 0 ; args_info->long_given = 0 ; args_info->float_given = 0 ; args_info->double_given = 0 ; args_info->longdouble_given = 0 ; args_info->longlong_given = 0 ; args_info->flag_given = 0 ; args_info->function_given = 0 ; args_info->no_short_given = 0 ; args_info->required_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->string_arg = NULL; args_info->string_orig = NULL; args_info->int_orig = NULL; args_info->short_orig = NULL; args_info->long_orig = NULL; args_info->float_orig = NULL; args_info->double_orig = NULL; args_info->longdouble_orig = NULL; args_info->longlong_orig = NULL; args_info->flag_flag = 1; args_info->required_arg = NULL; args_info->required_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->string_help = gengetopt_args_info_help[2] ; args_info->int_help = gengetopt_args_info_help[3] ; args_info->short_help = gengetopt_args_info_help[5] ; args_info->long_help = gengetopt_args_info_help[6] ; args_info->float_help = gengetopt_args_info_help[7] ; args_info->double_help = gengetopt_args_info_help[8] ; args_info->longdouble_help = gengetopt_args_info_help[9] ; args_info->longlong_help = gengetopt_args_info_help[12] ; args_info->flag_help = gengetopt_args_info_help[13] ; args_info->function_help = gengetopt_args_info_help[14] ; args_info->no_short_help = gengetopt_args_info_help[16] ; args_info->required_help = gengetopt_args_info_help[17] ; } void test_sections_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_SECTIONS_CMD_PARSER_PACKAGE_NAME) ? TEST_SECTIONS_CMD_PARSER_PACKAGE_NAME : TEST_SECTIONS_CMD_PARSER_PACKAGE), TEST_SECTIONS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_sections_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_sections_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_sections_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_sections_cmd_parser_params_init(struct test_sections_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_sections_cmd_parser_params * test_sections_cmd_parser_params_create(void) { struct test_sections_cmd_parser_params *params = (struct test_sections_cmd_parser_params *)malloc(sizeof(struct test_sections_cmd_parser_params)); test_sections_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void test_sections_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->string_arg)); free_string_field (&(args_info->string_orig)); free_string_field (&(args_info->int_orig)); free_string_field (&(args_info->short_orig)); free_string_field (&(args_info->long_orig)); free_string_field (&(args_info->float_orig)); free_string_field (&(args_info->double_orig)); free_string_field (&(args_info->longdouble_orig)); free_string_field (&(args_info->longlong_orig)); free_string_field (&(args_info->required_arg)); free_string_field (&(args_info->required_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_sections_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_SECTIONS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->string_given) write_into_file(outfile, "string", args_info->string_orig, 0); if (args_info->int_given) write_into_file(outfile, "int", args_info->int_orig, 0); if (args_info->short_given) write_into_file(outfile, "short", args_info->short_orig, 0); if (args_info->long_given) write_into_file(outfile, "long", args_info->long_orig, 0); if (args_info->float_given) write_into_file(outfile, "float", args_info->float_orig, 0); if (args_info->double_given) write_into_file(outfile, "double", args_info->double_orig, 0); if (args_info->longdouble_given) write_into_file(outfile, "longdouble", args_info->longdouble_orig, 0); if (args_info->longlong_given) write_into_file(outfile, "longlong", args_info->longlong_orig, 0); if (args_info->flag_given) write_into_file(outfile, "flag", 0, 0 ); if (args_info->function_given) write_into_file(outfile, "function", 0, 0 ); if (args_info->no_short_given) write_into_file(outfile, "no-short", 0, 0 ); if (args_info->required_given) write_into_file(outfile, "required", args_info->required_orig, 0); i = EXIT_SUCCESS; return i; } int test_sections_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_SECTIONS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_sections_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_sections_cmd_parser_free (struct gengetopt_args_info *args_info) { test_sections_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_sections_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_sections_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_sections_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_sections_cmd_parser_params *params) { int result; result = test_sections_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_sections_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_sections_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_sections_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_sections_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_sections_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_sections_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_sections_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_sections_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_sections_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->required_given) { fprintf (stderr, "%s: '--required' ('-r') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_sections_cmd_parser_params.check_ambiguity * @param override @see test_sections_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_sections_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_SHORT: if (val) *((short *)field) = (short)strtol (val, &stop_char, 0); break; case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; case ARG_DOUBLE: if (val) *((double *)field) = strtod (val, &stop_char); break; case ARG_LONGDOUBLE: if (val) *((long double *)field) = (long double)strtod (val, &stop_char); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0); #else if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); #endif break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_sections_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_sections_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_sections_cmd_parser_init (args_info); test_sections_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "string", 1, NULL, 's' }, { "int", 1, NULL, 'i' }, { "short", 1, NULL, 'S' }, { "long", 1, NULL, 'l' }, { "float", 1, NULL, 'f' }, { "double", 1, NULL, 'd' }, { "longdouble", 1, NULL, 'D' }, { "longlong", 1, NULL, 'L' }, { "flag", 0, NULL, 'F' }, { "function", 0, NULL, 'u' }, { "no-short", 0, NULL, 0 }, { "required", 1, NULL, 'r' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:i:S:l:f:d:D:L:Fur:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_sections_cmd_parser_print_help (); test_sections_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_sections_cmd_parser_print_version (); test_sections_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* string option. */ if (update_arg( (void *)&(args_info->string_arg), &(args_info->string_orig), &(args_info->string_given), &(local_args_info.string_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string", 's', additional_error)) goto failure; break; case 'i': /* int option. */ if (update_arg( (void *)&(args_info->int_arg), &(args_info->int_orig), &(args_info->int_given), &(local_args_info.int_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "int", 'i', additional_error)) goto failure; break; case 'S': /* short option. */ if (update_arg( (void *)&(args_info->short_arg), &(args_info->short_orig), &(args_info->short_given), &(local_args_info.short_given), optarg, 0, 0, ARG_SHORT, check_ambiguity, override, 0, 0, "short", 'S', additional_error)) goto failure; break; case 'l': /* long option. */ if (update_arg( (void *)&(args_info->long_arg), &(args_info->long_orig), &(args_info->long_given), &(local_args_info.long_given), optarg, 0, 0, ARG_LONG, check_ambiguity, override, 0, 0, "long", 'l', additional_error)) goto failure; break; case 'f': /* float option. */ if (update_arg( (void *)&(args_info->float_arg), &(args_info->float_orig), &(args_info->float_given), &(local_args_info.float_given), optarg, 0, 0, ARG_FLOAT, check_ambiguity, override, 0, 0, "float", 'f', additional_error)) goto failure; break; case 'd': /* double option. */ if (update_arg( (void *)&(args_info->double_arg), &(args_info->double_orig), &(args_info->double_given), &(local_args_info.double_given), optarg, 0, 0, ARG_DOUBLE, check_ambiguity, override, 0, 0, "double", 'd', additional_error)) goto failure; break; case 'D': /* longdouble option. */ if (update_arg( (void *)&(args_info->longdouble_arg), &(args_info->longdouble_orig), &(args_info->longdouble_given), &(local_args_info.longdouble_given), optarg, 0, 0, ARG_LONGDOUBLE, check_ambiguity, override, 0, 0, "longdouble", 'D', additional_error)) goto failure; break; case 'L': /* longlong option. */ if (update_arg( (void *)&(args_info->longlong_arg), &(args_info->longlong_orig), &(args_info->longlong_given), &(local_args_info.longlong_given), optarg, 0, 0, ARG_LONGLONG, check_ambiguity, override, 0, 0, "longlong", 'L', additional_error)) goto failure; break; case 'F': /* flag option. */ if (update_arg((void *)&(args_info->flag_flag), 0, &(args_info->flag_given), &(local_args_info.flag_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "flag", 'F', additional_error)) goto failure; break; case 'u': /* function option. */ if (update_arg( 0 , 0 , &(args_info->function_given), &(local_args_info.function_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "function", 'u', additional_error)) goto failure; break; case 'r': /* required option. */ if (update_arg( (void *)&(args_info->required_arg), &(args_info->required_orig), &(args_info->required_given), &(local_args_info.required_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "required", 'r', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* no short option. */ if (strcmp (long_options[option_index].name, "no-short") == 0) { if (update_arg( 0 , 0 , &(args_info->no_short_given), &(local_args_info.no_short_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-short", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_SECTIONS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (check_required) { error_occurred += test_sections_cmd_parser_required2 (args_info, argv[0], additional_error); } test_sections_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_sections_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_modes_option_help.c0000664000175000017500000000147012045003074016573 00000000000000/* test_modes_option_help.c test */ /* test option help fields in the presence of modes */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_modes_cmd.h" #define PRINT_OPTION(s) printf("%s: %s\n", # s, args_info.s) #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) #endif // FIX_UNUSED static struct gengetopt_args_info args_info; int main (int argc, char **argv) { FIX_UNUSED (argc); FIX_UNUSED (argv); test_modes_cmd_parser_init (&args_info); PRINT_OPTION(help_help); PRINT_OPTION(version_help); PRINT_OPTION(opta_help); PRINT_OPTION(optA_help); PRINT_OPTION(optAmul_help); PRINT_OPTION(optb_help); PRINT_OPTION(optc_help); PRINT_OPTION(optd_help); PRINT_OPTION(mopt_help); test_modes_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_modes.c0000664000175000017500000000152012045003074014167 00000000000000/* test_modes.c test */ /* test all kinds of options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_modes_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { unsigned int i; if (test_modes_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; if (args_info.optA_given) { printf("optA given\n"); if (args_info.optA_arg) printf("optA arg: %s\n", args_info.optA_arg); } if (args_info.optAmul_given) { printf("optAmul given %d time(s)\n", args_info.optAmul_given); for (i = 0; i < args_info.optAmul_given; ++i) printf("optAmul arg: %s\n", (args_info.optAmul_arg[i] ? args_info.optAmul_arg[i] : "(null)")); } test_modes_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/default_values_cmd.c.test0000664000175000017500000005111112045003074016626 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/default_values_cmd.ggo --func-name=default_values_cmd_parser --file-name=default_values_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "default_values_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: default_values [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -f, --foo=INT foo option (default=`15000')", " -b, --bar=STRING bar option (default=`this is a default')", " -F, --foo-opt[=INT] foo option with optional arg (default=`15000')", " -B, --bar-opt[=STRING] bar option with optional arg (default=`this is a\n default')", " --foofloat=FLOAT foo float option (default=`15000')", " --foodouble=DOUBLE foo double option (default=`15000')", " -p, --pi=DOUBLE PI option (default=`3.1415926536')", " -s, --timeout=123456789012 number of seconds after the scanning is cancelled\n if no progress is shown at all.\n (default=`120')", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT , ARG_FLOAT , ARG_DOUBLE } default_values_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int default_values_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct default_values_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; args_info->bar_given = 0 ; args_info->foo_opt_given = 0 ; args_info->bar_opt_given = 0 ; args_info->foofloat_given = 0 ; args_info->foodouble_given = 0 ; args_info->pi_given = 0 ; args_info->timeout_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_arg = 15000; args_info->foo_orig = NULL; args_info->bar_arg = gengetopt_strdup ("this is a default"); args_info->bar_orig = NULL; args_info->foo_opt_arg = 15000; args_info->foo_opt_orig = NULL; args_info->bar_opt_arg = gengetopt_strdup ("this is a default"); args_info->bar_opt_orig = NULL; args_info->foofloat_arg = 15000; args_info->foofloat_orig = NULL; args_info->foodouble_arg = 15000; args_info->foodouble_orig = NULL; args_info->pi_arg = 3.1415926536; args_info->pi_orig = NULL; args_info->timeout_arg = 120; args_info->timeout_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; args_info->bar_help = gengetopt_args_info_help[3] ; args_info->foo_opt_help = gengetopt_args_info_help[4] ; args_info->bar_opt_help = gengetopt_args_info_help[5] ; args_info->foofloat_help = gengetopt_args_info_help[6] ; args_info->foodouble_help = gengetopt_args_info_help[7] ; args_info->pi_help = gengetopt_args_info_help[8] ; args_info->timeout_help = gengetopt_args_info_help[9] ; } void default_values_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(DEFAULT_VALUES_CMD_PARSER_PACKAGE_NAME) ? DEFAULT_VALUES_CMD_PARSER_PACKAGE_NAME : DEFAULT_VALUES_CMD_PARSER_PACKAGE), DEFAULT_VALUES_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { default_values_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void default_values_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void default_values_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void default_values_cmd_parser_params_init(struct default_values_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct default_values_cmd_parser_params * default_values_cmd_parser_params_create(void) { struct default_values_cmd_parser_params *params = (struct default_values_cmd_parser_params *)malloc(sizeof(struct default_values_cmd_parser_params)); default_values_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void default_values_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->foo_orig)); free_string_field (&(args_info->bar_arg)); free_string_field (&(args_info->bar_orig)); free_string_field (&(args_info->foo_opt_orig)); free_string_field (&(args_info->bar_opt_arg)); free_string_field (&(args_info->bar_opt_orig)); free_string_field (&(args_info->foofloat_orig)); free_string_field (&(args_info->foodouble_orig)); free_string_field (&(args_info->pi_orig)); free_string_field (&(args_info->timeout_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int default_values_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", DEFAULT_VALUES_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); if (args_info->bar_given) write_into_file(outfile, "bar", args_info->bar_orig, 0); if (args_info->foo_opt_given) write_into_file(outfile, "foo-opt", args_info->foo_opt_orig, 0); if (args_info->bar_opt_given) write_into_file(outfile, "bar-opt", args_info->bar_opt_orig, 0); if (args_info->foofloat_given) write_into_file(outfile, "foofloat", args_info->foofloat_orig, 0); if (args_info->foodouble_given) write_into_file(outfile, "foodouble", args_info->foodouble_orig, 0); if (args_info->pi_given) write_into_file(outfile, "pi", args_info->pi_orig, 0); if (args_info->timeout_given) write_into_file(outfile, "timeout", args_info->timeout_orig, 0); i = EXIT_SUCCESS; return i; } int default_values_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", DEFAULT_VALUES_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = default_values_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void default_values_cmd_parser_free (struct gengetopt_args_info *args_info) { default_values_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int default_values_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return default_values_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int default_values_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct default_values_cmd_parser_params *params) { int result; result = default_values_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { default_values_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int default_values_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct default_values_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = default_values_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { default_values_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int default_values_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see default_values_cmd_parser_params.check_ambiguity * @param override @see default_values_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, default_values_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; case ARG_DOUBLE: if (val) *((double *)field) = strtod (val, &stop_char); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_FLOAT: case ARG_DOUBLE: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int default_values_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct default_values_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) default_values_cmd_parser_init (args_info); default_values_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'f' }, { "bar", 1, NULL, 'b' }, { "foo-opt", 2, NULL, 'F' }, { "bar-opt", 2, NULL, 'B' }, { "foofloat", 1, NULL, 0 }, { "foodouble", 1, NULL, 0 }, { "pi", 1, NULL, 'p' }, { "timeout", 1, NULL, 's' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVf:b:F::B::p:s:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ default_values_cmd_parser_print_help (); default_values_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ default_values_cmd_parser_print_version (); default_values_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'f': /* foo option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, "15000", ARG_INT, check_ambiguity, override, 0, 0, "foo", 'f', additional_error)) goto failure; break; case 'b': /* bar option. */ if (update_arg( (void *)&(args_info->bar_arg), &(args_info->bar_orig), &(args_info->bar_given), &(local_args_info.bar_given), optarg, 0, "this is a default", ARG_STRING, check_ambiguity, override, 0, 0, "bar", 'b', additional_error)) goto failure; break; case 'F': /* foo option with optional arg. */ if (update_arg( (void *)&(args_info->foo_opt_arg), &(args_info->foo_opt_orig), &(args_info->foo_opt_given), &(local_args_info.foo_opt_given), optarg, 0, "15000", ARG_INT, check_ambiguity, override, 0, 0, "foo-opt", 'F', additional_error)) goto failure; break; case 'B': /* bar option with optional arg. */ if (update_arg( (void *)&(args_info->bar_opt_arg), &(args_info->bar_opt_orig), &(args_info->bar_opt_given), &(local_args_info.bar_opt_given), optarg, 0, "this is a default", ARG_STRING, check_ambiguity, override, 0, 0, "bar-opt", 'B', additional_error)) goto failure; break; case 'p': /* PI option. */ if (update_arg( (void *)&(args_info->pi_arg), &(args_info->pi_orig), &(args_info->pi_given), &(local_args_info.pi_given), optarg, 0, "3.1415926536", ARG_DOUBLE, check_ambiguity, override, 0, 0, "pi", 'p', additional_error)) goto failure; break; case 's': /* number of seconds after the scanning is cancelled if no progress is shown at all.. */ if (update_arg( (void *)&(args_info->timeout_arg), &(args_info->timeout_orig), &(args_info->timeout_given), &(local_args_info.timeout_given), optarg, 0, "120", ARG_INT, check_ambiguity, override, 0, 0, "timeout", 's', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* foo float option. */ if (strcmp (long_options[option_index].name, "foofloat") == 0) { if (update_arg( (void *)&(args_info->foofloat_arg), &(args_info->foofloat_orig), &(args_info->foofloat_given), &(local_args_info.foofloat_given), optarg, 0, "15000", ARG_FLOAT, check_ambiguity, override, 0, 0, "foofloat", '-', additional_error)) goto failure; } /* foo double option. */ else if (strcmp (long_options[option_index].name, "foodouble") == 0) { if (update_arg( (void *)&(args_info->foodouble_arg), &(args_info->foodouble_orig), &(args_info->foodouble_given), &(local_args_info.foodouble_given), optarg, 0, "15000", ARG_DOUBLE, check_ambiguity, override, 0, 0, "foodouble", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", DEFAULT_VALUES_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ default_values_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: default_values_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_manual_help.c0000664000175000017500000000245312045003074015353 00000000000000/* test_manual_help.c test */ /* test manual definition of help and version */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_manual_help_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { int result = 0; /* if --help is specified with other options, do not print the complete output of help, but only the description of that option */ short help_printed = 0; if (test_manual_help_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } if (args_info.detailed_help_given) test_manual_help_cmd_parser_print_detailed_help(); if (args_info.version_given) test_manual_help_cmd_parser_print_version(); if (args_info.height_given) { printf ("specified --height %d\n", args_info.height_arg); if (args_info.help_given) { printf ("%s\n", args_info.height_help); help_printed = 1; } } if (args_info.vavoom_given) { printf ("specified --vavoom %s\n", args_info.vavoom_arg); if (args_info.help_given) { printf ("%s\n", args_info.vavoom_help); help_printed = 1; } } if (args_info.help_given && !help_printed) test_manual_help_cmd_parser_print_help(); end: test_manual_help_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/test_dep.sh.in0000664000175000017500000000031412044745036014437 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_all_opts -r10 --dependant=foo ; then false; else if $* ./test_all_opts -r10 --dependant=foo --opt-arg=bar ; then true; else false; fi fi gengetopt-2.22.6/tests/wrong_version_redef.err0000664000175000017500000000013512044745036016450 00000000000000wrong_version_redef.ggo:4: if you want to redefine --version, please use option --no-version gengetopt-2.22.6/tests/more_than_once_cmd.h.test0000664000175000017500000001572012045003074016616 00000000000000/** @file more_than_once_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef MORE_THAN_ONCE_CMD_H #define MORE_THAN_ONCE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef MORE_THAN_ONCE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define MORE_THAN_ONCE_CMD_PARSER_PACKAGE "more_than_once" #endif #ifndef MORE_THAN_ONCE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define MORE_THAN_ONCE_CMD_PARSER_PACKAGE_NAME "more_than_once" #endif #ifndef MORE_THAN_ONCE_CMD_PARSER_VERSION /** @brief the program version */ #define MORE_THAN_ONCE_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_arg; /**< @brief foo option. */ char * foo_orig; /**< @brief foo option original value given at command line. */ const char *foo_help; /**< @brief foo option help description. */ char * bar_arg; /**< @brief bar option. */ char * bar_orig; /**< @brief bar option original value given at command line. */ const char *bar_help; /**< @brief bar option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ unsigned int bar_given ; /**< @brief Whether bar was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct more_than_once_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int more_than_once_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use more_than_once_cmd_parser_ext() instead */ int more_than_once_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int more_than_once_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct more_than_once_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int more_than_once_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int more_than_once_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void more_than_once_cmd_parser_print_help(void); /** * Print the version */ void more_than_once_cmd_parser_print_version(void); /** * Initializes all the fields a more_than_once_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void more_than_once_cmd_parser_params_init(struct more_than_once_cmd_parser_params *params); /** * Allocates dynamically a more_than_once_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized more_than_once_cmd_parser_params structure */ struct more_than_once_cmd_parser_params *more_than_once_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void more_than_once_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void more_than_once_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int more_than_once_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* MORE_THAN_ONCE_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser_ov3.c.in0000664000175000017500000000351712045003074016565 00000000000000/* test_conf_parser_ov2.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan two conf files and then the command line */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { unsigned int i; /* do not override command line options, initialize args_info */ if (test_conf_parser_cmd_parser_configfile ("@srcdir@/test_conf2.conf", &args_info, 0, 1, 0) != 0) exit(1); /* do not override, do not initialize args_info */ if (test_conf_parser_cmd_parser_configfile ("@srcdir@/test_conf3.conf", &args_info, 0, 0, 0) != 0) exit(1); if (test_conf_parser_cmd_parser2 (argc, argv, &args_info, 1, 0, 1) != 0) exit(1) ; printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); printf ("value of multi-string_given: %d\n", args_info.multi_string_given); for (i = 0; i < args_info.multi_string_given; i++) printf (" value of multi-string: %s\n", args_info.multi_string_arg [i]); printf ("value of multi-string-def_given: %d\n", args_info.multi_string_def_given); for (i = 0; i < args_info.multi_string_def_given; i++) printf (" value of multi-string-def: %s\n", args_info.multi_string_def_arg [i]); if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0]) printf ("default value of multi-string-def: %s\n", args_info.multi_string_def_arg [0]); test_conf_parser_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_conf_parser_ov4.sh.in0000664000175000017500000000053612044745036016766 00000000000000#! @SHELL@ # the first call must succeed, the second must fail due to ambiguity if $* ./test_conf_parser_ov4 -i 100 -c @srcdir@/test_conf2.conf; then if $* ./test_conf_parser_ov4 -r "bar" --float 2.14 -i 100 -c @srcdir@/test_conf2.conf; then false; else true; fi else false; figengetopt-2.22.6/tests/test_redef_help_cmd.h.test0000664000175000017500000001541412045003074016772 00000000000000/** @file test_redef_help_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_REDEF_HELP_CMD_H #define TEST_REDEF_HELP_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_REDEF_HELP_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_REDEF_HELP_CMD_PARSER_PACKAGE "test_redef_help" #endif #ifndef TEST_REDEF_HELP_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_REDEF_HELP_CMD_PARSER_PACKAGE_NAME "test_redef_help" #endif #ifndef TEST_REDEF_HELP_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_REDEF_HELP_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ const char *height_help; /**< @brief height help description. */ const char *vavoom_help; /**< @brief vavoom instead of version help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int height_given ; /**< @brief Whether height was given. */ unsigned int vavoom_given ; /**< @brief Whether vavoom was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_redef_help_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_redef_help_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_redef_help_cmd_parser_ext() instead */ int test_redef_help_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_redef_help_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_redef_help_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_redef_help_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_redef_help_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_redef_help_cmd_parser_print_help(void); /** * Print the version */ void test_redef_help_cmd_parser_print_version(void); /** * Initializes all the fields a test_redef_help_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_redef_help_cmd_parser_params_init(struct test_redef_help_cmd_parser_params *params); /** * Allocates dynamically a test_redef_help_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_redef_help_cmd_parser_params structure */ struct test_redef_help_cmd_parser_params *test_redef_help_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_redef_help_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_redef_help_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_redef_help_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_REDEF_HELP_CMD_H */ gengetopt-2.22.6/tests/no_optgiven.sh.in0000664000175000017500000000024112044745036015156 00000000000000#! @SHELL@ # the next program must exit with error if $* ./no_optgiven; then false; else if $* ./no_optgiven2; then false; else true; fi fi gengetopt-2.22.6/tests/no_unamed_cmd.h.test0000664000175000017500000001467212045003074015610 00000000000000/** @file no_unamed_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef NO_UNAMED_CMD_H #define NO_UNAMED_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef NO_UNAMED_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define NO_UNAMED_CMD_PARSER_PACKAGE "no_unamed" #endif #ifndef NO_UNAMED_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define NO_UNAMED_CMD_PARSER_PACKAGE_NAME "no_unamed" #endif #ifndef NO_UNAMED_CMD_PARSER_VERSION /** @brief the program version */ #define NO_UNAMED_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * foo_arg; /**< @brief foo string option. */ char * foo_orig; /**< @brief foo string option original value given at command line. */ const char *foo_help; /**< @brief foo string option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ } ; /** @brief The additional parameters to pass to parser functions */ struct no_unamed_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int no_unamed_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use no_unamed_cmd_parser_ext() instead */ int no_unamed_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int no_unamed_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_unamed_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int no_unamed_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int no_unamed_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void no_unamed_cmd_parser_print_help(void); /** * Print the version */ void no_unamed_cmd_parser_print_version(void); /** * Initializes all the fields a no_unamed_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void no_unamed_cmd_parser_params_init(struct no_unamed_cmd_parser_params *params); /** * Allocates dynamically a no_unamed_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized no_unamed_cmd_parser_params structure */ struct no_unamed_cmd_parser_params *no_unamed_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void no_unamed_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void no_unamed_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int no_unamed_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* NO_UNAMED_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser_err_string.sh.in0000664000175000017500000000050612044745036020431 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_conf_parser -r "bar" -a 100 -c @srcdir@/test_conf_err_string.conf; then false; else if $* ./test_conf_parser -r "bar" -a 100 -c @srcdir@/test_conf_err_string2.conf; then false; else true; fi fi gengetopt-2.22.6/tests/test_groups_cmd.h.test0000664000175000017500000001771212045003074016217 00000000000000/** @file test_groups_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_GROUPS_CMD_H #define TEST_GROUPS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_GROUPS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_GROUPS_CMD_PARSER_PACKAGE "test_groups" #endif #ifndef TEST_GROUPS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_GROUPS_CMD_PARSER_PACKAGE_NAME "test_groups" #endif #ifndef TEST_GROUPS_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_GROUPS_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ unsigned int opta_min; /**< @brief string a's minimum occurreces */ unsigned int opta_max; /**< @brief string a's maximum occurreces */ const char *opta_help; /**< @brief string a help description. */ char * optA_arg; /**< @brief string A. */ char * optA_orig; /**< @brief string A original value given at command line. */ const char *optA_help; /**< @brief string A help description. */ char ** optAmul_arg; /**< @brief string M. */ char ** optAmul_orig; /**< @brief string M original value given at command line. */ unsigned int optAmul_min; /**< @brief string M's minimum occurreces */ unsigned int optAmul_max; /**< @brief string M's maximum occurreces */ const char *optAmul_help; /**< @brief string M help description. */ const char *optb_help; /**< @brief string b help description. */ const char *optc_help; /**< @brief string c help description. */ const char *optd_help; /**< @brief string d help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int opta_given ; /**< @brief Whether opta was given. */ int opta_group ; /**< @brief Whether opta's was updated. */ unsigned int optA_given ; /**< @brief Whether optA was given. */ unsigned int optAmul_given ; /**< @brief Whether optAmul was given. */ int optAmul_group ; /**< @brief Whether optAmul's was updated. */ unsigned int optb_given ; /**< @brief Whether optb was given. */ unsigned int optc_given ; /**< @brief Whether optc was given. */ unsigned int optd_given ; /**< @brief Whether optd was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int grp1_group_counter; /**< @brief Counter for group grp1 */ int my_grp2_group_counter; /**< @brief Counter for group my_grp2 */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_groups_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_groups_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_groups_cmd_parser_ext() instead */ int test_groups_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_groups_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_groups_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_groups_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_groups_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_groups_cmd_parser_print_help(void); /** * Print the version */ void test_groups_cmd_parser_print_version(void); /** * Initializes all the fields a test_groups_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_groups_cmd_parser_params_init(struct test_groups_cmd_parser_params *params); /** * Allocates dynamically a test_groups_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_groups_cmd_parser_params structure */ struct test_groups_cmd_parser_params *test_groups_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_groups_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_groups_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_groups_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_GROUPS_CMD_H */ gengetopt-2.22.6/tests/no_multi_strings.c0000664000175000017500000000065712045003074015432 00000000000000/* no_multi_strings.c test contains multiple options none of which are strings inspired by Dave Swegen */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "no_multi_strings_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (no_multi_strings_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; } gengetopt-2.22.6/tests/cmdline.h.test0000664000175000017500000001516112045003074014425 00000000000000/** @file cmdline.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef CMDLINE_H #define CMDLINE_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef CMDLINE_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define CMDLINE_PARSER_PACKAGE PACKAGE #endif #ifndef CMDLINE_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define CMDLINE_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define CMDLINE_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef CMDLINE_PARSER_VERSION /** @brief the program version */ #define CMDLINE_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_arg; /**< @brief foo option (default='15000'). */ char * foo_orig; /**< @brief foo option original value given at command line. */ const char *foo_help; /**< @brief foo option help description. */ char * bar_arg; /**< @brief bar option (default='this is a default'). */ char * bar_orig; /**< @brief bar option original value given at command line. */ const char *bar_help; /**< @brief bar option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ unsigned int bar_given ; /**< @brief Whether bar was given. */ } ; /** @brief The additional parameters to pass to parser functions */ struct cmdline_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use cmdline_parser_ext() instead */ int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void cmdline_parser_print_help(void); /** * Print the version */ void cmdline_parser_print_version(void); /** * Initializes all the fields a cmdline_parser_params structure * to their default values * @param params the structure to initialize */ void cmdline_parser_params_init(struct cmdline_parser_params *params); /** * Allocates dynamically a cmdline_parser_params structure and initializes * all its fields to their default values * @return the created and initialized cmdline_parser_params structure */ struct cmdline_parser_params *cmdline_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void cmdline_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void cmdline_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* CMDLINE_H */ gengetopt-2.22.6/tests/no_unamed.c0000664000175000017500000000050212045003074013765 00000000000000/* no_unamed.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "no_unamed_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (no_unamed_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; } gengetopt-2.22.6/tests/Makefile.in0000664000175000017500000032242612046536525013752 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2009 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @NO_CROSSCOMPILING_TRUE@TESTS = $(am__EXEEXT_1) test_show_help.sh \ @NO_CROSSCOMPILING_TRUE@ test_err.sh @NO_CROSSCOMPILING_TRUE@check_PROGRAMS = no_strings$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_strings$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_types$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_unamed$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_optgiven$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_optgiven2$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ more_than_once$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_prog_name$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ canonize-names$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ default_values$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ default_cmdline$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_groups$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_modes$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov2$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov3$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov4$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_file_save$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_multiple$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_simple_multiple$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_sections$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_values$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_values_cc$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_redef_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_manual_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_no_handle_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_multiple_parsers$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_sections_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_groups_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_modes_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_no_options$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_newlines$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_text$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_only_flags$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_usage$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/more_than_once.sh.in $(srcdir)/no_optgiven.sh.in \ $(srcdir)/test_all_opts.sh.in \ $(srcdir)/test_all_opts_file_save.sh.in \ $(srcdir)/test_conf.conf.in $(srcdir)/test_conf_inc.conf.in \ $(srcdir)/test_conf_parser.sh.in \ $(srcdir)/test_conf_parser_err.sh.in \ $(srcdir)/test_conf_parser_err_string.sh.in \ $(srcdir)/test_conf_parser_grp.sh.in \ $(srcdir)/test_conf_parser_ov.sh.in \ $(srcdir)/test_conf_parser_ov2.c.in \ $(srcdir)/test_conf_parser_ov2.sh.in \ $(srcdir)/test_conf_parser_ov3.c.in \ $(srcdir)/test_conf_parser_ov3.sh.in \ $(srcdir)/test_conf_parser_ov4.c.in \ $(srcdir)/test_conf_parser_ov4.sh.in \ $(srcdir)/test_conf_parser_save.sh.in \ $(srcdir)/test_default_values.sh.in $(srcdir)/test_dep.sh.in \ $(srcdir)/test_err.sh.in $(srcdir)/test_groups.sh.in \ $(srcdir)/test_manual_help.sh.in $(srcdir)/test_modes.sh.in \ $(srcdir)/test_multiple.sh.in \ $(srcdir)/test_multiple_err.sh.in \ $(srcdir)/test_multiple_parsers.sh.in \ $(srcdir)/test_sections.sh.in $(srcdir)/test_show_help.sh.in \ $(srcdir)/test_simple_multiple.sh.in \ $(srcdir)/test_simple_multiple_default.sh.in \ $(srcdir)/test_values.sh.in $(srcdir)/test_values_err.sh.in \ $(srcdir)/valgrind_suppressions.sh.in \ $(srcdir)/valgrind_tests.sh.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = test_conf.conf test_conf_inc.conf \ test_conf_parser_ov2.c test_conf_parser_ov3.c \ test_conf_parser_ov4.c no_optgiven.sh valgrind_tests.sh \ valgrind_suppressions.sh more_than_once.sh test_all_opts.sh \ test_all_opts_file_save.sh test_groups.sh test_modes.sh \ test_conf_parser.sh test_conf_parser_save.sh \ test_conf_parser_grp.sh test_conf_parser_ov.sh \ test_conf_parser_ov2.sh test_conf_parser_ov3.sh \ test_conf_parser_ov4.sh test_conf_parser_err.sh \ test_conf_parser_err_string.sh test_multiple.sh \ test_multiple_err.sh test_simple_multiple_default.sh \ test_simple_multiple.sh test_sections.sh \ test_default_values.sh test_values.sh test_values_err.sh \ test_show_help.sh test_err.sh test_dep.sh test_manual_help.sh \ test_multiple_parsers.sh CONFIG_CLEAN_VPATH_FILES = am__canonize_names_SOURCES_DIST = canonize-names-cmd.ggo \ canonize-names.c @NO_CROSSCOMPILING_TRUE@am_canonize_names_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ canonize-names-cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ canonize-names.$(OBJEXT) canonize_names_OBJECTS = $(am_canonize_names_OBJECTS) canonize_names_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@canonize_names_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__default_cmdline_SOURCES_DIST = cmdline.ggo default_cmdline.c @NO_CROSSCOMPILING_TRUE@am_default_cmdline_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ cmdline.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ default_cmdline.$(OBJEXT) default_cmdline_OBJECTS = $(am_default_cmdline_OBJECTS) default_cmdline_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@default_cmdline_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__default_values_SOURCES_DIST = default_values_cmd.ggo \ default_values.c @NO_CROSSCOMPILING_TRUE@am_default_values_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ default_values_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ default_values.$(OBJEXT) default_values_OBJECTS = $(am_default_values_OBJECTS) default_values_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@default_values_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__more_than_once_SOURCES_DIST = more_than_once_cmd.ggo \ more_than_once.c @NO_CROSSCOMPILING_TRUE@am_more_than_once_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ more_than_once_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ more_than_once.$(OBJEXT) more_than_once_OBJECTS = $(am_more_than_once_OBJECTS) more_than_once_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@more_than_once_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_multi_strings_SOURCES_DIST = no_multi_strings_cmd.ggo \ no_multi_strings.c @NO_CROSSCOMPILING_TRUE@am_no_multi_strings_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_multi_strings_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_strings.$(OBJEXT) no_multi_strings_OBJECTS = $(am_no_multi_strings_OBJECTS) no_multi_strings_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_multi_strings_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_multi_types_SOURCES_DIST = no_multi_types_cmd.ggo \ no_multi_types.c @NO_CROSSCOMPILING_TRUE@am_no_multi_types_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_multi_types_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_types.$(OBJEXT) no_multi_types_OBJECTS = $(am_no_multi_types_OBJECTS) no_multi_types_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_multi_types_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_optgiven_SOURCES_DIST = no_optgiven_cmd.ggo no_optgiven.c @NO_CROSSCOMPILING_TRUE@am_no_optgiven_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_optgiven_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_optgiven.$(OBJEXT) no_optgiven_OBJECTS = $(am_no_optgiven_OBJECTS) no_optgiven_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_optgiven_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_optgiven2_SOURCES_DIST = no_optgiven_cmd.ggo no_optgiven2.c @NO_CROSSCOMPILING_TRUE@am_no_optgiven2_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_optgiven_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_optgiven2.$(OBJEXT) no_optgiven2_OBJECTS = $(am_no_optgiven2_OBJECTS) no_optgiven2_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_optgiven2_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_prog_name_SOURCES_DIST = test_all_opts_cmd.ggo no_prog_name.c @NO_CROSSCOMPILING_TRUE@am_no_prog_name_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_prog_name.$(OBJEXT) no_prog_name_OBJECTS = $(am_no_prog_name_OBJECTS) no_prog_name_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_prog_name_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_strings_SOURCES_DIST = no_strings_cmd.ggo no_strings.c @NO_CROSSCOMPILING_TRUE@am_no_strings_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_strings_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_strings.$(OBJEXT) no_strings_OBJECTS = $(am_no_strings_OBJECTS) no_strings_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_strings_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__no_unamed_SOURCES_DIST = no_unamed_cmd.ggonu no_unamed.c @NO_CROSSCOMPILING_TRUE@am_no_unamed_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ no_unamed_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ no_unamed.$(OBJEXT) no_unamed_OBJECTS = $(am_no_unamed_OBJECTS) no_unamed_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@no_unamed_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_all_opts_SOURCES_DIST = test_all_opts_cmd.ggo test_all_opts.c @NO_CROSSCOMPILING_TRUE@am_test_all_opts_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts.$(OBJEXT) test_all_opts_OBJECTS = $(am_test_all_opts_OBJECTS) test_all_opts_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_all_opts_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_all_opts_option_help_SOURCES_DIST = test_all_opts_cmd.ggo \ test_all_opts_option_help.c @NO_CROSSCOMPILING_TRUE@am_test_all_opts_option_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_option_help.$(OBJEXT) test_all_opts_option_help_OBJECTS = \ $(am_test_all_opts_option_help_OBJECTS) test_all_opts_option_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_all_opts_option_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_SOURCES_DIST = test_conf_parser_cmd.ggoconf \ test_conf_parser.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser.$(OBJEXT) test_conf_parser_OBJECTS = $(am_test_conf_parser_OBJECTS) test_conf_parser_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_file_save_SOURCES_DIST = \ test_conf_parser_cmd.ggoconf test_conf_parser_file_save.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_file_save_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_file_save.$(OBJEXT) test_conf_parser_file_save_OBJECTS = \ $(am_test_conf_parser_file_save_OBJECTS) test_conf_parser_file_save_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_file_save_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_ov_SOURCES_DIST = test_conf_parser_cmd.ggoconf \ test_conf_parser_ov.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_ov_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov.$(OBJEXT) test_conf_parser_ov_OBJECTS = $(am_test_conf_parser_ov_OBJECTS) test_conf_parser_ov_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_ov2_SOURCES_DIST = test_conf_parser_cmd.ggoconf \ test_conf_parser_ov2.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_ov2_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov2.$(OBJEXT) test_conf_parser_ov2_OBJECTS = $(am_test_conf_parser_ov2_OBJECTS) test_conf_parser_ov2_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov2_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_ov3_SOURCES_DIST = test_conf_parser_cmd.ggoconf \ test_conf_parser_ov3.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_ov3_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov3.$(OBJEXT) test_conf_parser_ov3_OBJECTS = $(am_test_conf_parser_ov3_OBJECTS) test_conf_parser_ov3_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov3_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_conf_parser_ov4_SOURCES_DIST = test_conf_parser_cmd.ggoconf \ test_conf_parser_ov4.c @NO_CROSSCOMPILING_TRUE@am_test_conf_parser_ov4_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov4.$(OBJEXT) test_conf_parser_ov4_OBJECTS = $(am_test_conf_parser_ov4_OBJECTS) test_conf_parser_ov4_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov4_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_groups_SOURCES_DIST = test_groups_cmd.ggo test_groups.c @NO_CROSSCOMPILING_TRUE@am_test_groups_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_groups_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_groups.$(OBJEXT) test_groups_OBJECTS = $(am_test_groups_OBJECTS) test_groups_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_groups_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_groups_option_help_SOURCES_DIST = test_groups_cmd.ggo \ test_groups_option_help.c @NO_CROSSCOMPILING_TRUE@am_test_groups_option_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_groups_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_groups_option_help.$(OBJEXT) test_groups_option_help_OBJECTS = \ $(am_test_groups_option_help_OBJECTS) test_groups_option_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_groups_option_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_manual_help_SOURCES_DIST = test_manual_help_cmd.ggo \ test_manual_help.c @NO_CROSSCOMPILING_TRUE@am_test_manual_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_manual_help_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_manual_help.$(OBJEXT) test_manual_help_OBJECTS = $(am_test_manual_help_OBJECTS) test_manual_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_manual_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_modes_SOURCES_DIST = test_modes_cmd.ggo test_modes.c @NO_CROSSCOMPILING_TRUE@am_test_modes_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_modes_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_modes.$(OBJEXT) test_modes_OBJECTS = $(am_test_modes_OBJECTS) test_modes_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_modes_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_modes_option_help_SOURCES_DIST = test_modes_cmd.ggo \ test_modes_option_help.c @NO_CROSSCOMPILING_TRUE@am_test_modes_option_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_modes_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_modes_option_help.$(OBJEXT) test_modes_option_help_OBJECTS = $(am_test_modes_option_help_OBJECTS) test_modes_option_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_modes_option_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_multiple_SOURCES_DIST = test_multiple_cmd.ggo \ test_multiple.cc @NO_CROSSCOMPILING_TRUE@am_test_multiple_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_multiple_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_multiple.$(OBJEXT) test_multiple_OBJECTS = $(am_test_multiple_OBJECTS) test_multiple_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_multiple_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_multiple_parsers_SOURCES_DIST = test_main_cmdline_cmd.ggo \ test_first_cmdline_cmd.ggostr test_second_cmdline_cmd.ggostr \ test_multiple_parsers.c @NO_CROSSCOMPILING_TRUE@am_test_multiple_parsers_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_main_cmdline_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_first_cmdline_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_second_cmdline_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_multiple_parsers.$(OBJEXT) test_multiple_parsers_OBJECTS = $(am_test_multiple_parsers_OBJECTS) test_multiple_parsers_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_multiple_parsers_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_newlines_SOURCES_DIST = test_newlines_cmd.ggo test_newlines.c @NO_CROSSCOMPILING_TRUE@am_test_newlines_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_newlines_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_newlines.$(OBJEXT) test_newlines_OBJECTS = $(am_test_newlines_OBJECTS) test_newlines_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_newlines_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_no_handle_help_SOURCES_DIST = test_no_handle_help_cmd.ggo \ test_no_handle_help.c @NO_CROSSCOMPILING_TRUE@am_test_no_handle_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_no_handle_help_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_no_handle_help.$(OBJEXT) test_no_handle_help_OBJECTS = $(am_test_no_handle_help_OBJECTS) test_no_handle_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_no_handle_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_no_options_SOURCES_DIST = test_no_options_cmd.ggo \ test_no_options.c @NO_CROSSCOMPILING_TRUE@am_test_no_options_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_no_options_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_no_options.$(OBJEXT) test_no_options_OBJECTS = $(am_test_no_options_OBJECTS) test_no_options_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_no_options_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_only_flags_SOURCES_DIST = test_only_flags_cmd.ggo \ test_only_flags.c @NO_CROSSCOMPILING_TRUE@am_test_only_flags_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_only_flags_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_only_flags.$(OBJEXT) test_only_flags_OBJECTS = $(am_test_only_flags_OBJECTS) test_only_flags_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_only_flags_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_redef_help_SOURCES_DIST = test_redef_help_cmd.ggo \ test_redef_help.c @NO_CROSSCOMPILING_TRUE@am_test_redef_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_redef_help_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_redef_help.$(OBJEXT) test_redef_help_OBJECTS = $(am_test_redef_help_OBJECTS) test_redef_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_redef_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_sections_SOURCES_DIST = test_sections_cmd.ggo test_sections.c @NO_CROSSCOMPILING_TRUE@am_test_sections_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_sections_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_sections.$(OBJEXT) test_sections_OBJECTS = $(am_test_sections_OBJECTS) test_sections_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_sections_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_sections_option_help_SOURCES_DIST = test_sections_cmd.ggo \ test_sections_option_help.c @NO_CROSSCOMPILING_TRUE@am_test_sections_option_help_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_sections_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_sections_option_help.$(OBJEXT) test_sections_option_help_OBJECTS = \ $(am_test_sections_option_help_OBJECTS) test_sections_option_help_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_sections_option_help_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_simple_multiple_SOURCES_DIST = test_simple_multiple_cmd.ggo \ test_simple_multiple.cc @NO_CROSSCOMPILING_TRUE@am_test_simple_multiple_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_simple_multiple_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_simple_multiple.$(OBJEXT) test_simple_multiple_OBJECTS = $(am_test_simple_multiple_OBJECTS) test_simple_multiple_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_simple_multiple_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_text_SOURCES_DIST = test_text_cmd.ggo test_text.c @NO_CROSSCOMPILING_TRUE@am_test_text_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_text_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_text.$(OBJEXT) test_text_OBJECTS = $(am_test_text_OBJECTS) test_text_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_text_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_usage_SOURCES_DIST = test_usage_cmd.ggo test_usage.c @NO_CROSSCOMPILING_TRUE@am_test_usage_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_usage_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_usage.$(OBJEXT) test_usage_OBJECTS = $(am_test_usage_OBJECTS) test_usage_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_usage_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_values_SOURCES_DIST = test_values_cmd.ggo test_values.c @NO_CROSSCOMPILING_TRUE@am_test_values_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_values_cmd.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_values.$(OBJEXT) test_values_OBJECTS = $(am_test_values_OBJECTS) test_values_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_values_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la am__test_values_cc_SOURCES_DIST = test_values_cmd_cc.cc \ test_values_cc.cc @NO_CROSSCOMPILING_TRUE@am_test_values_cc_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_values_cmd_cc.$(OBJEXT) \ @NO_CROSSCOMPILING_TRUE@ test_values_cc.$(OBJEXT) test_values_cc_OBJECTS = $(am_test_values_cc_OBJECTS) test_values_cc_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_values_cc_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/gl/libgnu.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(canonize_names_SOURCES) $(default_cmdline_SOURCES) \ $(default_values_SOURCES) $(more_than_once_SOURCES) \ $(no_multi_strings_SOURCES) $(no_multi_types_SOURCES) \ $(no_optgiven_SOURCES) $(no_optgiven2_SOURCES) \ $(no_prog_name_SOURCES) $(no_strings_SOURCES) \ $(no_unamed_SOURCES) $(test_all_opts_SOURCES) \ $(test_all_opts_option_help_SOURCES) \ $(test_conf_parser_SOURCES) \ $(test_conf_parser_file_save_SOURCES) \ $(test_conf_parser_ov_SOURCES) $(test_conf_parser_ov2_SOURCES) \ $(test_conf_parser_ov3_SOURCES) \ $(test_conf_parser_ov4_SOURCES) $(test_groups_SOURCES) \ $(test_groups_option_help_SOURCES) $(test_manual_help_SOURCES) \ $(test_modes_SOURCES) $(test_modes_option_help_SOURCES) \ $(test_multiple_SOURCES) $(test_multiple_parsers_SOURCES) \ $(test_newlines_SOURCES) $(test_no_handle_help_SOURCES) \ $(test_no_options_SOURCES) $(test_only_flags_SOURCES) \ $(test_redef_help_SOURCES) $(test_sections_SOURCES) \ $(test_sections_option_help_SOURCES) \ $(test_simple_multiple_SOURCES) $(test_text_SOURCES) \ $(test_usage_SOURCES) $(test_values_SOURCES) \ $(test_values_cc_SOURCES) DIST_SOURCES = $(am__canonize_names_SOURCES_DIST) \ $(am__default_cmdline_SOURCES_DIST) \ $(am__default_values_SOURCES_DIST) \ $(am__more_than_once_SOURCES_DIST) \ $(am__no_multi_strings_SOURCES_DIST) \ $(am__no_multi_types_SOURCES_DIST) \ $(am__no_optgiven_SOURCES_DIST) \ $(am__no_optgiven2_SOURCES_DIST) \ $(am__no_prog_name_SOURCES_DIST) \ $(am__no_strings_SOURCES_DIST) $(am__no_unamed_SOURCES_DIST) \ $(am__test_all_opts_SOURCES_DIST) \ $(am__test_all_opts_option_help_SOURCES_DIST) \ $(am__test_conf_parser_SOURCES_DIST) \ $(am__test_conf_parser_file_save_SOURCES_DIST) \ $(am__test_conf_parser_ov_SOURCES_DIST) \ $(am__test_conf_parser_ov2_SOURCES_DIST) \ $(am__test_conf_parser_ov3_SOURCES_DIST) \ $(am__test_conf_parser_ov4_SOURCES_DIST) \ $(am__test_groups_SOURCES_DIST) \ $(am__test_groups_option_help_SOURCES_DIST) \ $(am__test_manual_help_SOURCES_DIST) \ $(am__test_modes_SOURCES_DIST) \ $(am__test_modes_option_help_SOURCES_DIST) \ $(am__test_multiple_SOURCES_DIST) \ $(am__test_multiple_parsers_SOURCES_DIST) \ $(am__test_newlines_SOURCES_DIST) \ $(am__test_no_handle_help_SOURCES_DIST) \ $(am__test_no_options_SOURCES_DIST) \ $(am__test_only_flags_SOURCES_DIST) \ $(am__test_redef_help_SOURCES_DIST) \ $(am__test_sections_SOURCES_DIST) \ $(am__test_sections_option_help_SOURCES_DIST) \ $(am__test_simple_multiple_SOURCES_DIST) \ $(am__test_text_SOURCES_DIST) $(am__test_usage_SOURCES_DIST) \ $(am__test_values_SOURCES_DIST) \ $(am__test_values_cc_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(gengetoptexamplesdir)" DATA = $(gengetoptexamples_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= @NO_CROSSCOMPILING_TRUE@am__EXEEXT_1 = no_strings$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_strings$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_multi_types$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_unamed$(EXEEXT) no_optgiven.sh \ @NO_CROSSCOMPILING_TRUE@ more_than_once.sh \ @NO_CROSSCOMPILING_TRUE@ canonize-names$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ no_prog_name$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ default_values$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ default_cmdline$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts.sh \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_file_save.sh \ @NO_CROSSCOMPILING_TRUE@ test_groups.sh test_modes.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov2.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov3.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_ov4.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_err.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_err_string.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_grp.sh \ @NO_CROSSCOMPILING_TRUE@ test_conf_parser_save.sh \ @NO_CROSSCOMPILING_TRUE@ test_multiple.sh \ @NO_CROSSCOMPILING_TRUE@ test_simple_multiple_default.sh \ @NO_CROSSCOMPILING_TRUE@ test_simple_multiple.sh \ @NO_CROSSCOMPILING_TRUE@ test_multiple_err.sh test_sections.sh \ @NO_CROSSCOMPILING_TRUE@ test_default_values.sh test_values.sh \ @NO_CROSSCOMPILING_TRUE@ test_values_err.sh test_dep.sh \ @NO_CROSSCOMPILING_TRUE@ test_manual_help.sh \ @NO_CROSSCOMPILING_TRUE@ test_multiple_parsers.sh \ @NO_CROSSCOMPILING_TRUE@ test_sections_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_all_opts_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_groups_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_modes_option_help$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_no_options$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_newlines$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_text$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_only_flags$(EXEEXT) \ @NO_CROSSCOMPILING_TRUE@ test_usage$(EXEEXT) DIST_SUBDIRS = output_dir output_header_dir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @NO_CROSSCOMPILING_TRUE@SUBDIRS = output_dir output_header_dir # .ggonu is used in this test suite for command line parsers that have # to be created without --unamed-opt @NO_CROSSCOMPILING_TRUE@SUFFIXES = .ggo .ggonu .ggoconf .ggostr # we do not generate the gengetopt version number in the output # file so that the number does not disturb in diffing when changing # gengetopt version @NO_CROSSCOMPILING_TRUE@PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT) --gen-version @NO_CROSSCOMPILING_TRUE@PROGNAMESHOWHELP = $(PROGNAME) --show-help --long-help @NO_CROSSCOMPILING_TRUE@PROGNAMESHOWFULLHELP = $(PROGNAME) --show-full-help --long-help @NO_CROSSCOMPILING_TRUE@PROGNAMESHOWDETAILEDHELP = $(PROGNAME) --show-detailed-help --long-help @NO_CROSSCOMPILING_TRUE@PROGNAMESHOWHELPREQUIRED = $(PROGNAME) --show-help --long-help --show-required @NO_CROSSCOMPILING_TRUE@GGO_COMPILE = $(PROGNAME) --input=$< --func-name=$*_parser --file-name=$* # INCLUDES is added to LDFLAGS because .ggo file are sources, and thus # the .c files are passed to the linker, which also compiles, thus # the include options should be passed to it as well @NO_CROSSCOMPILING_TRUE@AM_LDFLAGS = $(DEFS) $(INCLUDES) #LDADD = $(GETOPTLONG_O) $(STRDUP_O) -lefence # these are for gnulib @NO_CROSSCOMPILING_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl #AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl -Wall -Wunused -W -Wcast-align -Wfloat-equal -Wpointer-arith -Wwrite-strings @NO_CROSSCOMPILING_TRUE@LDADD = $(top_builddir)/gl/libgnu.la @NO_CROSSCOMPILING_TRUE@OUTPUTDIR = $(top_builddir)/tests/output_dir @NO_CROSSCOMPILING_TRUE@OUTPUT_SRC_DIR = $(top_builddir)/tests/output_dir @NO_CROSSCOMPILING_TRUE@OUTPUT_HEADER_DIR = $(top_builddir)/tests/output_header_dir @NO_CROSSCOMPILING_TRUE@OUTPUTDIR_OPTION = --output-dir=$(OUTPUTDIR) @NO_CROSSCOMPILING_TRUE@OUTPUTDIRS_OPTION = --src-output-dir=$(OUTPUT_SRC_DIR) --header-output-dir=$(OUTPUT_HEADER_DIR) @NO_CROSSCOMPILING_TRUE@EXPECT = 1 @NO_CROSSCOMPILING_TRUE@VALGRINDTESTS = no_strings \ @NO_CROSSCOMPILING_TRUE@no_multi_strings no_multi_types \ @NO_CROSSCOMPILING_TRUE@no_unamed no_optgiven.sh \ @NO_CROSSCOMPILING_TRUE@more_than_once.sh canonize-names \ @NO_CROSSCOMPILING_TRUE@no_prog_name \ @NO_CROSSCOMPILING_TRUE@default_values default_cmdline test_all_opts.sh \ @NO_CROSSCOMPILING_TRUE@test_all_opts_file_save.sh \ @NO_CROSSCOMPILING_TRUE@test_groups.sh test_modes.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser.sh test_conf_parser_ov.sh test_conf_parser_ov2.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov3.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov4.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_err.sh test_conf_parser_err_string.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_grp.sh \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_save.sh \ @NO_CROSSCOMPILING_TRUE@test_multiple.sh \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple_default.sh \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple.sh \ @NO_CROSSCOMPILING_TRUE@test_multiple_err.sh \ @NO_CROSSCOMPILING_TRUE@test_sections.sh \ @NO_CROSSCOMPILING_TRUE@test_default_values.sh \ @NO_CROSSCOMPILING_TRUE@test_values.sh test_values_err.sh \ @NO_CROSSCOMPILING_TRUE@test_dep.sh \ @NO_CROSSCOMPILING_TRUE@test_manual_help.sh \ @NO_CROSSCOMPILING_TRUE@test_multiple_parsers.sh \ @NO_CROSSCOMPILING_TRUE@test_sections_option_help \ @NO_CROSSCOMPILING_TRUE@test_all_opts_option_help \ @NO_CROSSCOMPILING_TRUE@test_groups_option_help \ @NO_CROSSCOMPILING_TRUE@test_modes_option_help \ @NO_CROSSCOMPILING_TRUE@test_no_options \ @NO_CROSSCOMPILING_TRUE@test_newlines \ @NO_CROSSCOMPILING_TRUE@test_text \ @NO_CROSSCOMPILING_TRUE@test_only_flags \ @NO_CROSSCOMPILING_TRUE@test_usage @NO_CROSSCOMPILING_TRUE@hidden_options_programs = test_all_opts @NO_CROSSCOMPILING_TRUE@details_options_programs = test_all_opts test_no_handle_help @NO_CROSSCOMPILING_TRUE@no_strings_SOURCES = no_strings_cmd.ggo no_strings.c @NO_CROSSCOMPILING_TRUE@no_multi_strings_SOURCES = no_multi_strings_cmd.ggo no_multi_strings.c @NO_CROSSCOMPILING_TRUE@no_multi_types_SOURCES = no_multi_types_cmd.ggo no_multi_types.c @NO_CROSSCOMPILING_TRUE@no_unamed_SOURCES = no_unamed_cmd.ggonu no_unamed.c @NO_CROSSCOMPILING_TRUE@no_optgiven_SOURCES = no_optgiven_cmd.ggo no_optgiven.c @NO_CROSSCOMPILING_TRUE@no_optgiven2_SOURCES = no_optgiven_cmd.ggo no_optgiven2.c @NO_CROSSCOMPILING_TRUE@more_than_once_SOURCES = more_than_once_cmd.ggo more_than_once.c @NO_CROSSCOMPILING_TRUE@canonize_names_SOURCES = canonize-names-cmd.ggo canonize-names.c @NO_CROSSCOMPILING_TRUE@default_values_SOURCES = default_values_cmd.ggo default_values.c @NO_CROSSCOMPILING_TRUE@default_cmdline_SOURCES = cmdline.ggo default_cmdline.c #default_cmdline_CPPFLAGS = -DPACKAGE_NAME="\"default_cmdline\"" @NO_CROSSCOMPILING_TRUE@test_all_opts_SOURCES = test_all_opts_cmd.ggo test_all_opts.c @NO_CROSSCOMPILING_TRUE@no_prog_name_SOURCES = test_all_opts_cmd.ggo no_prog_name.c # force using our version of getopt @NO_CROSSCOMPILING_TRUE@test_groups_SOURCES = test_groups_cmd.ggo test_groups.c @NO_CROSSCOMPILING_TRUE@test_modes_SOURCES = test_modes_cmd.ggo test_modes.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov2_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov2.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov3_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov3.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov4_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov4.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_file_save_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_file_save.c @NO_CROSSCOMPILING_TRUE@test_multiple_SOURCES = test_multiple_cmd.ggo test_multiple.cc @NO_CROSSCOMPILING_TRUE@test_simple_multiple_SOURCES = test_simple_multiple_cmd.ggo test_simple_multiple.cc @NO_CROSSCOMPILING_TRUE@test_sections_SOURCES = test_sections_cmd.ggo test_sections.c @NO_CROSSCOMPILING_TRUE@test_values_SOURCES = test_values_cmd.ggo test_values.c @NO_CROSSCOMPILING_TRUE@test_values_cc_SOURCES = test_values_cmd_cc.cc test_values_cc.cc @NO_CROSSCOMPILING_TRUE@test_redef_help_SOURCES = test_redef_help_cmd.ggo test_redef_help.c @NO_CROSSCOMPILING_TRUE@test_manual_help_SOURCES = test_manual_help_cmd.ggo test_manual_help.c @NO_CROSSCOMPILING_TRUE@test_manual_help_args_SOURCES = test_manual_help_args_cmd.ggo @NO_CROSSCOMPILING_TRUE@test_no_handle_help_SOURCES = test_no_handle_help_cmd.ggo test_no_handle_help.c @NO_CROSSCOMPILING_TRUE@test_multiple_parsers_SOURCES = test_main_cmdline_cmd.ggo test_first_cmdline_cmd.ggostr test_second_cmdline_cmd.ggostr test_multiple_parsers.c @NO_CROSSCOMPILING_TRUE@test_sections_option_help_SOURCES = test_sections_cmd.ggo test_sections_option_help.c @NO_CROSSCOMPILING_TRUE@test_all_opts_option_help_SOURCES = test_all_opts_cmd.ggo test_all_opts_option_help.c @NO_CROSSCOMPILING_TRUE@test_groups_option_help_SOURCES = test_groups_cmd.ggo test_groups_option_help.c @NO_CROSSCOMPILING_TRUE@test_modes_option_help_SOURCES = test_modes_cmd.ggo test_modes_option_help.c @NO_CROSSCOMPILING_TRUE@test_no_options_SOURCES = test_no_options_cmd.ggo test_no_options.c @NO_CROSSCOMPILING_TRUE@test_newlines_SOURCES = test_newlines_cmd.ggo test_newlines.c @NO_CROSSCOMPILING_TRUE@test_text_SOURCES = test_text_cmd.ggo test_text.c @NO_CROSSCOMPILING_TRUE@test_only_flags_SOURCES = test_only_flags_cmd.ggo test_only_flags.c @NO_CROSSCOMPILING_TRUE@test_usage_SOURCES = test_usage_cmd.ggo test_usage.c @NO_CROSSCOMPILING_TRUE@CHECKDIFFFILES = no_strings_cmd.c no_strings_cmd.h \ @NO_CROSSCOMPILING_TRUE@no_multi_strings_cmd.c no_multi_strings_cmd.h \ @NO_CROSSCOMPILING_TRUE@no_multi_types_cmd.c no_multi_types_cmd.h \ @NO_CROSSCOMPILING_TRUE@no_unamed_cmd.c no_unamed_cmd.h \ @NO_CROSSCOMPILING_TRUE@no_optgiven_cmd.c no_optgiven_cmd.h \ @NO_CROSSCOMPILING_TRUE@more_than_once_cmd.c more_than_once_cmd.h \ @NO_CROSSCOMPILING_TRUE@canonize-names-cmd.c canonize-names-cmd.h \ @NO_CROSSCOMPILING_TRUE@default_values_cmd.c default_values_cmd.h \ @NO_CROSSCOMPILING_TRUE@cmdline.c cmdline.h \ @NO_CROSSCOMPILING_TRUE@test_all_opts_cmd.c test_all_opts_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_groups_cmd.c test_groups_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_modes_cmd.c test_modes_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_cmd.c test_conf_parser_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_multiple_cmd.c test_multiple_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple_cmd.c test_simple_multiple_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_sections_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_values_cmd.c test_values_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_redef_help_cmd.c test_redef_help_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_manual_help_cmd.c test_manual_help_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_manual_help_args_cmd.c test_manual_help_args_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_no_handle_help_cmd.c test_no_handle_help_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_main_cmdline_cmd.c test_main_cmdline_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_first_cmdline_cmd.c test_first_cmdline_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_second_cmdline_cmd.c test_second_cmdline_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_no_options_cmd.h test_no_options_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_newlines_cmd.h test_newlines_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_align_cmd.h test_align_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_text_cmd.h test_text_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_only_flags_cmd.h test_only_flags_cmd.c \ @NO_CROSSCOMPILING_TRUE@test_usage_cmd.h test_usage_cmd.c @NO_CROSSCOMPILING_TRUE@BUILT_SOURCES = $(CHECKDIFFFILES) @NO_CROSSCOMPILING_TRUE@GENERATED_TESTS = no_strings_cmd.c.test no_strings_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@no_multi_strings_cmd.c.test no_multi_strings_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@no_unamed_cmd.c.test no_unamed_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@no_optgiven_cmd.c.test no_optgiven_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@more_than_once_cmd.c.test more_than_once_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@canonize-names-cmd.c.test canonize-names-cmd.h.test \ @NO_CROSSCOMPILING_TRUE@default_values_cmd.c.test default_values_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@cmdline.c.test cmdline.h.test \ @NO_CROSSCOMPILING_TRUE@test_all_opts_cmd.c.test test_all_opts_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_groups_cmd.c.test test_groups_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_modes_cmd.c.test test_modes_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_cmd.c.test test_conf_parser_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_multiple_cmd.c.test test_multiple_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple_cmd.c.test test_simple_multiple_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_sections_cmd.c.test \ @NO_CROSSCOMPILING_TRUE@test_values_cmd.c.test test_values_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_all_opts.save.test test_multiple.save.test \ @NO_CROSSCOMPILING_TRUE@test_conf_parser.save.test test_values.save.test \ @NO_CROSSCOMPILING_TRUE@test_redef_help_cmd.c.test test_redef_help_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_main_cmdline_cmd.c.test test_main_cmdline_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_first_cmdline_cmd.c.test test_first_cmdline_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_second_cmdline_cmd.c.test test_second_cmdline_cmd.h.test \ @NO_CROSSCOMPILING_TRUE@test_no_options_cmd.h.test test_no_options_cmd.c.test \ @NO_CROSSCOMPILING_TRUE@test_align_cmd.h.test test_align_cmd.c.test \ @NO_CROSSCOMPILING_TRUE@test_text_cmd.h.test test_text_cmd.c.test \ @NO_CROSSCOMPILING_TRUE@test_only_flags_cmd.h.test test_only_flags_cmd.c.test @NO_CROSSCOMPILING_TRUE@TESTSOUT = test.out @NO_CROSSCOMPILING_TRUE@TESTSOUTPUT = test.output @NO_CROSSCOMPILING_TRUE@ERRFILES = wrong_flag.err wrong_flag2.err wrong_group.err wrong_group2.err \ @NO_CROSSCOMPILING_TRUE@wrong_dep.err wrong_default.err wrong_numeric_value.err wrong_enum_use.err \ @NO_CROSSCOMPILING_TRUE@wrong_help_redef.err wrong_version_redef.err wrong_multiple_occurrence.err @NO_CROSSCOMPILING_TRUE@ERRGGOFILES = wrong_flag.ggo wrong_flag2.ggo wrong_group.ggo wrong_group2.ggo \ @NO_CROSSCOMPILING_TRUE@wrong_dep.ggo wrong_default.ggo wrong_numeric_value.ggo wrong_enum_use.ggo \ @NO_CROSSCOMPILING_TRUE@wrong_help_redef.ggo wrong_version_redef.ggo wrong_multiple_occurrence.ggo @NO_CROSSCOMPILING_TRUE@gengetoptexamples_DATA = test_manual_help_cmd.c test_manual_help_cmd.h \ @NO_CROSSCOMPILING_TRUE@test_manual_help_cmd.ggo test_manual_help.c @NO_CROSSCOMPILING_TRUE@EXTRA_DIST = no_optgiven.sh.in more_than_once.sh.in \ @NO_CROSSCOMPILING_TRUE@test_all_opts.sh.in test_all_opts_file_save.sh.in \ @NO_CROSSCOMPILING_TRUE@test_groups.sh.in test_modes.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser.sh.in test_conf_parser_save.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_grp.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov.sh.in test_conf_parser_ov2.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov3.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov4.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_err.sh.in test_conf_parser_err_string.sh.in \ @NO_CROSSCOMPILING_TRUE@test_multiple.sh.in test_multiple_err.sh.in test_sections.sh.in test_default_values.sh.in \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple_default.sh.in \ @NO_CROSSCOMPILING_TRUE@test_simple_multiple.sh.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov2.c.in test_conf_parser_ov3.c.in \ @NO_CROSSCOMPILING_TRUE@test_conf_parser_ov4.c.in \ @NO_CROSSCOMPILING_TRUE@test_values.sh.in test_values_err.sh.in test_show_help.sh.in \ @NO_CROSSCOMPILING_TRUE@valgrind_tests.sh.in valgrind_suppressions.sh.in test_err.sh.in \ @NO_CROSSCOMPILING_TRUE@test_dep.sh.in test_manual_help.sh.in test_multiple_parsers.sh.in \ @NO_CROSSCOMPILING_TRUE@$(GENERATED_TESTS) \ @NO_CROSSCOMPILING_TRUE@$(TESTSOUTPUT) \ @NO_CROSSCOMPILING_TRUE@$(gengetoptexamples_DATA) \ @NO_CROSSCOMPILING_TRUE@suppressions.supp \ @NO_CROSSCOMPILING_TRUE@test_conf.conf.in \ @NO_CROSSCOMPILING_TRUE@test_conf_inc.conf.in test_conf_inc_inc.conf test_conf_inc2.conf \ @NO_CROSSCOMPILING_TRUE@test_conf2.conf test_conf3.conf test_conf_err.conf \ @NO_CROSSCOMPILING_TRUE@test_conf_err_string.conf test_conf_err_string2.conf \ @NO_CROSSCOMPILING_TRUE@test_section_with_all_hidden.ggo \ @NO_CROSSCOMPILING_TRUE@test_required_optional_cmd.ggo \ @NO_CROSSCOMPILING_TRUE@test_align_cmd.ggo \ @NO_CROSSCOMPILING_TRUE@test_manual_help_args_cmd.ggo \ @NO_CROSSCOMPILING_TRUE@$(ERRFILES) $(ERRGGOFILES) @NO_CROSSCOMPILING_TRUE@CLEANFILES = *_cmd.c *_cmd.h *-cmd.h *-cmd.c cmdline.c cmdline.h *.save *.err.out all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .ggo .ggonu .ggoconf .ggostr .c .cc .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): test_conf.conf: $(top_builddir)/config.status $(srcdir)/test_conf.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_inc.conf: $(top_builddir)/config.status $(srcdir)/test_conf_inc.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov2.c: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov2.c.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov3.c: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov3.c.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov4.c: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov4.c.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ no_optgiven.sh: $(top_builddir)/config.status $(srcdir)/no_optgiven.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ valgrind_tests.sh: $(top_builddir)/config.status $(srcdir)/valgrind_tests.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ valgrind_suppressions.sh: $(top_builddir)/config.status $(srcdir)/valgrind_suppressions.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ more_than_once.sh: $(top_builddir)/config.status $(srcdir)/more_than_once.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_all_opts.sh: $(top_builddir)/config.status $(srcdir)/test_all_opts.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_all_opts_file_save.sh: $(top_builddir)/config.status $(srcdir)/test_all_opts_file_save.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_groups.sh: $(top_builddir)/config.status $(srcdir)/test_groups.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_modes.sh: $(top_builddir)/config.status $(srcdir)/test_modes.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_save.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_save.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_grp.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_grp.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov2.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov2.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov3.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov3.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_ov4.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_ov4.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_err.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_err.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_conf_parser_err_string.sh: $(top_builddir)/config.status $(srcdir)/test_conf_parser_err_string.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_multiple.sh: $(top_builddir)/config.status $(srcdir)/test_multiple.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_multiple_err.sh: $(top_builddir)/config.status $(srcdir)/test_multiple_err.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_simple_multiple_default.sh: $(top_builddir)/config.status $(srcdir)/test_simple_multiple_default.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_simple_multiple.sh: $(top_builddir)/config.status $(srcdir)/test_simple_multiple.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_sections.sh: $(top_builddir)/config.status $(srcdir)/test_sections.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_default_values.sh: $(top_builddir)/config.status $(srcdir)/test_default_values.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_values.sh: $(top_builddir)/config.status $(srcdir)/test_values.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_values_err.sh: $(top_builddir)/config.status $(srcdir)/test_values_err.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_show_help.sh: $(top_builddir)/config.status $(srcdir)/test_show_help.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_err.sh: $(top_builddir)/config.status $(srcdir)/test_err.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_dep.sh: $(top_builddir)/config.status $(srcdir)/test_dep.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_manual_help.sh: $(top_builddir)/config.status $(srcdir)/test_manual_help.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_multiple_parsers.sh: $(top_builddir)/config.status $(srcdir)/test_multiple_parsers.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list canonize-names$(EXEEXT): $(canonize_names_OBJECTS) $(canonize_names_DEPENDENCIES) $(EXTRA_canonize_names_DEPENDENCIES) @rm -f canonize-names$(EXEEXT) $(LINK) $(canonize_names_OBJECTS) $(canonize_names_LDADD) $(LIBS) default_cmdline$(EXEEXT): $(default_cmdline_OBJECTS) $(default_cmdline_DEPENDENCIES) $(EXTRA_default_cmdline_DEPENDENCIES) @rm -f default_cmdline$(EXEEXT) $(LINK) $(default_cmdline_OBJECTS) $(default_cmdline_LDADD) $(LIBS) default_values$(EXEEXT): $(default_values_OBJECTS) $(default_values_DEPENDENCIES) $(EXTRA_default_values_DEPENDENCIES) @rm -f default_values$(EXEEXT) $(LINK) $(default_values_OBJECTS) $(default_values_LDADD) $(LIBS) more_than_once$(EXEEXT): $(more_than_once_OBJECTS) $(more_than_once_DEPENDENCIES) $(EXTRA_more_than_once_DEPENDENCIES) @rm -f more_than_once$(EXEEXT) $(LINK) $(more_than_once_OBJECTS) $(more_than_once_LDADD) $(LIBS) no_multi_strings$(EXEEXT): $(no_multi_strings_OBJECTS) $(no_multi_strings_DEPENDENCIES) $(EXTRA_no_multi_strings_DEPENDENCIES) @rm -f no_multi_strings$(EXEEXT) $(LINK) $(no_multi_strings_OBJECTS) $(no_multi_strings_LDADD) $(LIBS) no_multi_types$(EXEEXT): $(no_multi_types_OBJECTS) $(no_multi_types_DEPENDENCIES) $(EXTRA_no_multi_types_DEPENDENCIES) @rm -f no_multi_types$(EXEEXT) $(LINK) $(no_multi_types_OBJECTS) $(no_multi_types_LDADD) $(LIBS) no_optgiven$(EXEEXT): $(no_optgiven_OBJECTS) $(no_optgiven_DEPENDENCIES) $(EXTRA_no_optgiven_DEPENDENCIES) @rm -f no_optgiven$(EXEEXT) $(LINK) $(no_optgiven_OBJECTS) $(no_optgiven_LDADD) $(LIBS) no_optgiven2$(EXEEXT): $(no_optgiven2_OBJECTS) $(no_optgiven2_DEPENDENCIES) $(EXTRA_no_optgiven2_DEPENDENCIES) @rm -f no_optgiven2$(EXEEXT) $(LINK) $(no_optgiven2_OBJECTS) $(no_optgiven2_LDADD) $(LIBS) no_prog_name$(EXEEXT): $(no_prog_name_OBJECTS) $(no_prog_name_DEPENDENCIES) $(EXTRA_no_prog_name_DEPENDENCIES) @rm -f no_prog_name$(EXEEXT) $(LINK) $(no_prog_name_OBJECTS) $(no_prog_name_LDADD) $(LIBS) no_strings$(EXEEXT): $(no_strings_OBJECTS) $(no_strings_DEPENDENCIES) $(EXTRA_no_strings_DEPENDENCIES) @rm -f no_strings$(EXEEXT) $(LINK) $(no_strings_OBJECTS) $(no_strings_LDADD) $(LIBS) no_unamed$(EXEEXT): $(no_unamed_OBJECTS) $(no_unamed_DEPENDENCIES) $(EXTRA_no_unamed_DEPENDENCIES) @rm -f no_unamed$(EXEEXT) $(LINK) $(no_unamed_OBJECTS) $(no_unamed_LDADD) $(LIBS) test_all_opts$(EXEEXT): $(test_all_opts_OBJECTS) $(test_all_opts_DEPENDENCIES) $(EXTRA_test_all_opts_DEPENDENCIES) @rm -f test_all_opts$(EXEEXT) $(LINK) $(test_all_opts_OBJECTS) $(test_all_opts_LDADD) $(LIBS) test_all_opts_option_help$(EXEEXT): $(test_all_opts_option_help_OBJECTS) $(test_all_opts_option_help_DEPENDENCIES) $(EXTRA_test_all_opts_option_help_DEPENDENCIES) @rm -f test_all_opts_option_help$(EXEEXT) $(LINK) $(test_all_opts_option_help_OBJECTS) $(test_all_opts_option_help_LDADD) $(LIBS) test_conf_parser$(EXEEXT): $(test_conf_parser_OBJECTS) $(test_conf_parser_DEPENDENCIES) $(EXTRA_test_conf_parser_DEPENDENCIES) @rm -f test_conf_parser$(EXEEXT) $(LINK) $(test_conf_parser_OBJECTS) $(test_conf_parser_LDADD) $(LIBS) test_conf_parser_file_save$(EXEEXT): $(test_conf_parser_file_save_OBJECTS) $(test_conf_parser_file_save_DEPENDENCIES) $(EXTRA_test_conf_parser_file_save_DEPENDENCIES) @rm -f test_conf_parser_file_save$(EXEEXT) $(LINK) $(test_conf_parser_file_save_OBJECTS) $(test_conf_parser_file_save_LDADD) $(LIBS) test_conf_parser_ov$(EXEEXT): $(test_conf_parser_ov_OBJECTS) $(test_conf_parser_ov_DEPENDENCIES) $(EXTRA_test_conf_parser_ov_DEPENDENCIES) @rm -f test_conf_parser_ov$(EXEEXT) $(LINK) $(test_conf_parser_ov_OBJECTS) $(test_conf_parser_ov_LDADD) $(LIBS) test_conf_parser_ov2$(EXEEXT): $(test_conf_parser_ov2_OBJECTS) $(test_conf_parser_ov2_DEPENDENCIES) $(EXTRA_test_conf_parser_ov2_DEPENDENCIES) @rm -f test_conf_parser_ov2$(EXEEXT) $(LINK) $(test_conf_parser_ov2_OBJECTS) $(test_conf_parser_ov2_LDADD) $(LIBS) test_conf_parser_ov3$(EXEEXT): $(test_conf_parser_ov3_OBJECTS) $(test_conf_parser_ov3_DEPENDENCIES) $(EXTRA_test_conf_parser_ov3_DEPENDENCIES) @rm -f test_conf_parser_ov3$(EXEEXT) $(LINK) $(test_conf_parser_ov3_OBJECTS) $(test_conf_parser_ov3_LDADD) $(LIBS) test_conf_parser_ov4$(EXEEXT): $(test_conf_parser_ov4_OBJECTS) $(test_conf_parser_ov4_DEPENDENCIES) $(EXTRA_test_conf_parser_ov4_DEPENDENCIES) @rm -f test_conf_parser_ov4$(EXEEXT) $(LINK) $(test_conf_parser_ov4_OBJECTS) $(test_conf_parser_ov4_LDADD) $(LIBS) test_groups$(EXEEXT): $(test_groups_OBJECTS) $(test_groups_DEPENDENCIES) $(EXTRA_test_groups_DEPENDENCIES) @rm -f test_groups$(EXEEXT) $(LINK) $(test_groups_OBJECTS) $(test_groups_LDADD) $(LIBS) test_groups_option_help$(EXEEXT): $(test_groups_option_help_OBJECTS) $(test_groups_option_help_DEPENDENCIES) $(EXTRA_test_groups_option_help_DEPENDENCIES) @rm -f test_groups_option_help$(EXEEXT) $(LINK) $(test_groups_option_help_OBJECTS) $(test_groups_option_help_LDADD) $(LIBS) test_manual_help$(EXEEXT): $(test_manual_help_OBJECTS) $(test_manual_help_DEPENDENCIES) $(EXTRA_test_manual_help_DEPENDENCIES) @rm -f test_manual_help$(EXEEXT) $(LINK) $(test_manual_help_OBJECTS) $(test_manual_help_LDADD) $(LIBS) test_modes$(EXEEXT): $(test_modes_OBJECTS) $(test_modes_DEPENDENCIES) $(EXTRA_test_modes_DEPENDENCIES) @rm -f test_modes$(EXEEXT) $(LINK) $(test_modes_OBJECTS) $(test_modes_LDADD) $(LIBS) test_modes_option_help$(EXEEXT): $(test_modes_option_help_OBJECTS) $(test_modes_option_help_DEPENDENCIES) $(EXTRA_test_modes_option_help_DEPENDENCIES) @rm -f test_modes_option_help$(EXEEXT) $(LINK) $(test_modes_option_help_OBJECTS) $(test_modes_option_help_LDADD) $(LIBS) test_multiple$(EXEEXT): $(test_multiple_OBJECTS) $(test_multiple_DEPENDENCIES) $(EXTRA_test_multiple_DEPENDENCIES) @rm -f test_multiple$(EXEEXT) $(CXXLINK) $(test_multiple_OBJECTS) $(test_multiple_LDADD) $(LIBS) test_multiple_parsers$(EXEEXT): $(test_multiple_parsers_OBJECTS) $(test_multiple_parsers_DEPENDENCIES) $(EXTRA_test_multiple_parsers_DEPENDENCIES) @rm -f test_multiple_parsers$(EXEEXT) $(LINK) $(test_multiple_parsers_OBJECTS) $(test_multiple_parsers_LDADD) $(LIBS) test_newlines$(EXEEXT): $(test_newlines_OBJECTS) $(test_newlines_DEPENDENCIES) $(EXTRA_test_newlines_DEPENDENCIES) @rm -f test_newlines$(EXEEXT) $(LINK) $(test_newlines_OBJECTS) $(test_newlines_LDADD) $(LIBS) test_no_handle_help$(EXEEXT): $(test_no_handle_help_OBJECTS) $(test_no_handle_help_DEPENDENCIES) $(EXTRA_test_no_handle_help_DEPENDENCIES) @rm -f test_no_handle_help$(EXEEXT) $(LINK) $(test_no_handle_help_OBJECTS) $(test_no_handle_help_LDADD) $(LIBS) test_no_options$(EXEEXT): $(test_no_options_OBJECTS) $(test_no_options_DEPENDENCIES) $(EXTRA_test_no_options_DEPENDENCIES) @rm -f test_no_options$(EXEEXT) $(LINK) $(test_no_options_OBJECTS) $(test_no_options_LDADD) $(LIBS) test_only_flags$(EXEEXT): $(test_only_flags_OBJECTS) $(test_only_flags_DEPENDENCIES) $(EXTRA_test_only_flags_DEPENDENCIES) @rm -f test_only_flags$(EXEEXT) $(LINK) $(test_only_flags_OBJECTS) $(test_only_flags_LDADD) $(LIBS) test_redef_help$(EXEEXT): $(test_redef_help_OBJECTS) $(test_redef_help_DEPENDENCIES) $(EXTRA_test_redef_help_DEPENDENCIES) @rm -f test_redef_help$(EXEEXT) $(LINK) $(test_redef_help_OBJECTS) $(test_redef_help_LDADD) $(LIBS) test_sections$(EXEEXT): $(test_sections_OBJECTS) $(test_sections_DEPENDENCIES) $(EXTRA_test_sections_DEPENDENCIES) @rm -f test_sections$(EXEEXT) $(LINK) $(test_sections_OBJECTS) $(test_sections_LDADD) $(LIBS) test_sections_option_help$(EXEEXT): $(test_sections_option_help_OBJECTS) $(test_sections_option_help_DEPENDENCIES) $(EXTRA_test_sections_option_help_DEPENDENCIES) @rm -f test_sections_option_help$(EXEEXT) $(LINK) $(test_sections_option_help_OBJECTS) $(test_sections_option_help_LDADD) $(LIBS) test_simple_multiple$(EXEEXT): $(test_simple_multiple_OBJECTS) $(test_simple_multiple_DEPENDENCIES) $(EXTRA_test_simple_multiple_DEPENDENCIES) @rm -f test_simple_multiple$(EXEEXT) $(CXXLINK) $(test_simple_multiple_OBJECTS) $(test_simple_multiple_LDADD) $(LIBS) test_text$(EXEEXT): $(test_text_OBJECTS) $(test_text_DEPENDENCIES) $(EXTRA_test_text_DEPENDENCIES) @rm -f test_text$(EXEEXT) $(LINK) $(test_text_OBJECTS) $(test_text_LDADD) $(LIBS) test_usage$(EXEEXT): $(test_usage_OBJECTS) $(test_usage_DEPENDENCIES) $(EXTRA_test_usage_DEPENDENCIES) @rm -f test_usage$(EXEEXT) $(LINK) $(test_usage_OBJECTS) $(test_usage_LDADD) $(LIBS) test_values$(EXEEXT): $(test_values_OBJECTS) $(test_values_DEPENDENCIES) $(EXTRA_test_values_DEPENDENCIES) @rm -f test_values$(EXEEXT) $(LINK) $(test_values_OBJECTS) $(test_values_LDADD) $(LIBS) test_values_cc$(EXEEXT): $(test_values_cc_OBJECTS) $(test_values_cc_DEPENDENCIES) $(EXTRA_test_values_cc_DEPENDENCIES) @rm -f test_values_cc$(EXEEXT) $(CXXLINK) $(test_values_cc_OBJECTS) $(test_values_cc_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonize-names-cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonize-names.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default_cmdline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default_values.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default_values_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/more_than_once.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/more_than_once_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_multi_strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_multi_strings_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_multi_types.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_multi_types_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_optgiven.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_optgiven2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_optgiven_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_prog_name.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_strings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_strings_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_unamed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no_unamed_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_all_opts.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_all_opts_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_all_opts_option_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_file_save.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_ov.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_ov2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_ov3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conf_parser_ov4.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_first_cmdline_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_groups.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_groups_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_groups_option_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_main_cmdline_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_manual_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_manual_help_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_modes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_modes_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_modes_option_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multiple.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multiple_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_multiple_parsers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_newlines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_newlines_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_no_handle_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_no_handle_help_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_no_options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_no_options_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_only_flags.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_only_flags_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_redef_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_redef_help_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_second_cmdline_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sections.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sections_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sections_option_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_simple_multiple.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_simple_multiple_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_text_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_usage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_usage_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_values.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_values_cc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_values_cmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_values_cmd_cc.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-gengetoptexamplesDATA: $(gengetoptexamples_DATA) @$(NORMAL_INSTALL) @list='$(gengetoptexamples_DATA)'; test -n "$(gengetoptexamplesdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gengetoptexamplesdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gengetoptexamplesdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gengetoptexamplesdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gengetoptexamplesdir)" || exit $$?; \ done uninstall-gengetoptexamplesDATA: @$(NORMAL_UNINSTALL) @list='$(gengetoptexamples_DATA)'; test -n "$(gengetoptexamplesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(gengetoptexamplesdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(gengetoptexamplesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-gengetoptexamplesDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-gengetoptexamplesDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ check-am ctags-recursive install install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-gengetoptexamplesDATA install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-gengetoptexamplesDATA @NO_CROSSCOMPILING_TRUE@.ggo.c: @NO_CROSSCOMPILING_TRUE@ $(GGO_COMPILE) --unamed-opt --show-required @NO_CROSSCOMPILING_TRUE@.ggonu.c: @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --input $< --func-name $*_parser --file-name $* @NO_CROSSCOMPILING_TRUE@.ggoconf.c: @NO_CROSSCOMPILING_TRUE@ $(GGO_COMPILE) --unamed-opt="OTHER NAMES" --conf-parser --arg-struct-name="my_args_info" --no-handle-error @NO_CROSSCOMPILING_TRUE@.ggostr.c: @NO_CROSSCOMPILING_TRUE@ $(GGO_COMPILE) --unamed-opt="OTHER NAMES" --string-parser --arg-struct-name=$*_struct --include-getopt #.ggo.err: # $(PROGNAME) --unamed-opt -i $< --file-name null 2> $@ || true @NO_CROSSCOMPILING_TRUE@test_manual_help_cmd.c: $(srcdir)/test_manual_help_cmd.ggo @NO_CROSSCOMPILING_TRUE@ $(GGO_COMPILE) --unamed-opt --show-required --no-help --no-version # in order to make it work with parallel make we need to make # these deps explicit # NOTE: this problem shows only on distribution tarballs # since files in .deps are empty @NO_CROSSCOMPILING_TRUE@no_strings_cmd.h: no_strings_cmd.c @NO_CROSSCOMPILING_TRUE@no_multi_strings_cmd.h: no_multi_strings_cmd.c @NO_CROSSCOMPILING_TRUE@no_multi_types_cmd.h: no_multi_types_cmd.c @NO_CROSSCOMPILING_TRUE@no_unamed_cmd.h: no_unamed_cmd.c @NO_CROSSCOMPILING_TRUE@no_optgiven_cmd.h: no_optgiven_cmd.c @NO_CROSSCOMPILING_TRUE@more_than_once_cmd.h: more_than_once_cmd.c @NO_CROSSCOMPILING_TRUE@canonize-names-cmd.h: canonize-names-cmd.c @NO_CROSSCOMPILING_TRUE@default_values_cmd.h: default_values_cmd.c @NO_CROSSCOMPILING_TRUE@cmdline.h: cmdline.c @NO_CROSSCOMPILING_TRUE@test_all_opts_cmd.h: test_all_opts_cmd.c @NO_CROSSCOMPILING_TRUE@test_groups_cmd.h: test_groups_cmd.c @NO_CROSSCOMPILING_TRUE@test_modes_cmd.h: test_modes_cmd.c @NO_CROSSCOMPILING_TRUE@test_conf_parser_cmd.h: test_conf_parser_cmd.c @NO_CROSSCOMPILING_TRUE@test_multiple_cmd.h: test_multiple_cmd.c @NO_CROSSCOMPILING_TRUE@test_simple_multiple_cmd.h: test_simple_multiple_cmd.c @NO_CROSSCOMPILING_TRUE@test_sections_cmd.h: test_sections_cmd.c @NO_CROSSCOMPILING_TRUE@test_values_cmd.h: test_values_cmd.c @NO_CROSSCOMPILING_TRUE@test_values_cmd_cc.cc: test_values_cmd.c @NO_CROSSCOMPILING_TRUE@test_redef_help_cmd.h: test_redef_help_cmd.c @NO_CROSSCOMPILING_TRUE@test_manual_help_cmd.h: test_manual_help_cmd.c @NO_CROSSCOMPILING_TRUE@test_manual_help_args_cmd.h: test_manual_help_args_cmd.c @NO_CROSSCOMPILING_TRUE@test_no_handle_help_cmd.h: test_no_handle_help_cmd.c @NO_CROSSCOMPILING_TRUE@test_main_cmdline_cmd.h: test_main_cmdline_cmd.c @NO_CROSSCOMPILING_TRUE@test_first_cmdline_cmd.h: test_first_cmdline_cmd.c @NO_CROSSCOMPILING_TRUE@test_second_cmdline_cmd.h: test_second_cmdline_cmd.c @NO_CROSSCOMPILING_TRUE@test_no_options_cmd.h: test_no_options_cmd.c @NO_CROSSCOMPILING_TRUE@test_align_cmd.h: test_align_cmd.c @NO_CROSSCOMPILING_TRUE@test_newlines_cmd.h: test_newlines_cmd.c @NO_CROSSCOMPILING_TRUE@test_text_cmd.h: test_text_cmd.c @NO_CROSSCOMPILING_TRUE@test_only_flags_cmd.h: test_only_flags_cmd.c @NO_CROSSCOMPILING_TRUE@test_usage_cmd.h: test_usage_cmd.c # the original command line used to be: # $(GGO_COMPILE) --no-handle-error -u # but now are in the input .ggo file @NO_CROSSCOMPILING_TRUE@no_optgiven_cmd.c: no_optgiven_cmd.ggo @NO_CROSSCOMPILING_TRUE@ $(GGO_COMPILE) # using $(top_builddir) should test also the removal of leading path # for the generation of the #ifndef in the generated header file @NO_CROSSCOMPILING_TRUE@canonize-names-cmd.c: canonize-names-cmd.ggo @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --input $(srcdir)/canonize-names-cmd.ggo --func-name $*-parser --file-name $(top_builddir)/tests/$* @NO_CROSSCOMPILING_TRUE@cmdline.c: cmdline.ggo @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --input $(srcdir)/cmdline.ggo @NO_CROSSCOMPILING_TRUE@check-am: check-output-dir check-output-dirs @NO_CROSSCOMPILING_TRUE@check-output-dir: @NO_CROSSCOMPILING_TRUE@ rm -f $(OUTPUTDIR)/cmdline.c $(OUTPUTDIR)/cmdline.h @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --unamed-opt --show-required $(OUTPUTDIR_OPTION) -i $(srcdir)/cmdline.ggo @NO_CROSSCOMPILING_TRUE@ test -f $(OUTPUTDIR)/cmdline.c @NO_CROSSCOMPILING_TRUE@ test -f $(OUTPUTDIR)/cmdline.h @NO_CROSSCOMPILING_TRUE@check-output-dirs: @NO_CROSSCOMPILING_TRUE@ rm -f $(OUTPUTDIR)/cmdline.c $(OUTPUTDIR)/cmdline.h @NO_CROSSCOMPILING_TRUE@ rm -f $(OUTPUT_SRC_DIR)/cmdline.c $(OUTPUT_HEADER_DIR)/cmdline.h @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --unamed-opt --show-required $(OUTPUTDIRS_OPTION) -i $(srcdir)/cmdline.ggo @NO_CROSSCOMPILING_TRUE@ test -f $(OUTPUT_SRC_DIR)/cmdline.c @NO_CROSSCOMPILING_TRUE@ test -f $(OUTPUT_HEADER_DIR)/cmdline.h @NO_CROSSCOMPILING_TRUE@check-err: $(ERRFILES) @NO_CROSSCOMPILING_TRUE@ for source in $(ERRFILES); do \ @NO_CROSSCOMPILING_TRUE@ test_input="`echo $$source|sed s/err/ggo/`"; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --unamed-opt -i $(srcdir)/$$test_input --file-name null 2> $$source.out || true ; \ @NO_CROSSCOMPILING_TRUE@ sed -i -e "s/.*\///" $$source.out ; \ @NO_CROSSCOMPILING_TRUE@ echo "diff $$source.out $$source"; \ @NO_CROSSCOMPILING_TRUE@ if ! diff $$source.out $(srcdir)/$$source; \ @NO_CROSSCOMPILING_TRUE@ then errors=1; fi; \ @NO_CROSSCOMPILING_TRUE@ done ; \ @NO_CROSSCOMPILING_TRUE@ test -z $$errors @NO_CROSSCOMPILING_TRUE@$(TESTSOUTPUT): @NO_CROSSCOMPILING_TRUE@ rm -f $(TESTSOUTPUT); \ @NO_CROSSCOMPILING_TRUE@ for source in $(TESTS); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$source" >> $@; \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$source >> $@ 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for source in $(check_PROGRAMS); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$source -h" >> $@; \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$source -h >> $@ 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for source in $(hidden_options_programs); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$source --full-help" >> $@; \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$source --full-help >> $@ 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for source in $(details_options_programs); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$source --detailed-help" >> $@; \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$source --detailed-help >> $@ 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_modes_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --show-help < $(srcdir)/test_align_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --show-full-help < $(srcdir)/test_align_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELPREQUIRED) < $(srcdir)/test_required_optional_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELPREQUIRED) --default-optional < $(srcdir)/test_required_optional_cmd.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) $(srcdir)/test_strict_hidden.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWDETAILEDHELP) $(srcdir)/test_strict_hidden.ggo >> $@ 2>&1; @NO_CROSSCOMPILING_TRUE@store-backup: $(BUILT_SOURCES) $(TESTSOUTPUT) @NO_CROSSCOMPILING_TRUE@ rm -f *.test; \ @NO_CROSSCOMPILING_TRUE@ for source in $(BUILT_SOURCES); do \ @NO_CROSSCOMPILING_TRUE@ back_output="`echo $$source.test`"; \ @NO_CROSSCOMPILING_TRUE@ echo "saving $$back_output"; \ @NO_CROSSCOMPILING_TRUE@ cp $$source $(srcdir)/$$back_output; \ @NO_CROSSCOMPILING_TRUE@ done; \ @NO_CROSSCOMPILING_TRUE@ for source in `ls *.save`; do \ @NO_CROSSCOMPILING_TRUE@ test_output="`echo $$source|sed s/save/save\.test/`"; \ @NO_CROSSCOMPILING_TRUE@ cp $$source $(srcdir)/$$test_output; \ @NO_CROSSCOMPILING_TRUE@ done; \ @NO_CROSSCOMPILING_TRUE@ cp $(TESTSOUT) $(srcdir)/$(TESTSOUTPUT); \ @NO_CROSSCOMPILING_TRUE@ rm -f *.err.test @NO_CROSSCOMPILING_TRUE@check-diff: @NO_CROSSCOMPILING_TRUE@ for source in $(CHECKDIFFFILES); do \ @NO_CROSSCOMPILING_TRUE@ back_output="`echo $$source.test`"; \ @NO_CROSSCOMPILING_TRUE@ echo "diff $$source $$back_output"; \ @NO_CROSSCOMPILING_TRUE@ if ! diff $$source $(srcdir)/$$back_output; \ @NO_CROSSCOMPILING_TRUE@ then errors=1; fi; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ echo "creating output of tests..."; \ @NO_CROSSCOMPILING_TRUE@ rm -f $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ for tests in $(TESTS); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$tests" >> $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$tests >> $(TESTSOUT) 2>&1 ; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for tests in $(check_PROGRAMS); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$tests -h" >> $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$tests -h >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for tests in $(hidden_options_programs); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$tests --full-help" >> $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$tests --full-help >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ for tests in $(details_options_programs); do \ @NO_CROSSCOMPILING_TRUE@ echo "*** $$tests --detailed-help" >> $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/$$tests --detailed-help >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ done && \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_modes_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --show-help < $(srcdir)/test_align_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAME) --show-full-help < $(srcdir)/test_align_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELPREQUIRED) < $(srcdir)/test_required_optional_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWHELPREQUIRED) --default-optional < $(srcdir)/test_required_optional_cmd.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_strict_hidden.ggo >> $(TESTSOUT) 2>&1; \ @NO_CROSSCOMPILING_TRUE@ $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_strict_hidden.ggo >> ${TESTSOUT} 2>&1; \ @NO_CROSSCOMPILING_TRUE@ sed -i -e "s/\.exe//g" $(TESTSOUT) ; \ @NO_CROSSCOMPILING_TRUE@ echo "diff $(TESTSOUTPUT) $(TESTSOUT)"; \ @NO_CROSSCOMPILING_TRUE@ if ! diff $(srcdir)/$(TESTSOUTPUT) $(TESTSOUT); \ @NO_CROSSCOMPILING_TRUE@ then errors=1; fi; \ @NO_CROSSCOMPILING_TRUE@ for source in `ls *.save`; do \ @NO_CROSSCOMPILING_TRUE@ test_output="`echo $$source|sed s/save/save\.test/`"; \ @NO_CROSSCOMPILING_TRUE@ echo "diff $$source $(srcdir)/$$test_output"; \ @NO_CROSSCOMPILING_TRUE@ if ! diff $$source $(srcdir)/$$test_output; \ @NO_CROSSCOMPILING_TRUE@ then errors=1; fi; \ @NO_CROSSCOMPILING_TRUE@ done; \ @NO_CROSSCOMPILING_TRUE@ test -z $$errors @NO_CROSSCOMPILING_TRUE@my-check: clean check check-diff @NO_CROSSCOMPILING_TRUE@check-valgrind: @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/valgrind_tests.sh $(VALGRINDTESTS) @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/default_values$(EXEEXT) --help @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/default_values$(EXEEXT) --version @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/test_all_opts$(EXEEXT) --help @NO_CROSSCOMPILING_TRUE@clean-err: @NO_CROSSCOMPILING_TRUE@ rm -f *.err # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/tests/test_text_cmd.ggo0000664000175000017500000000061612044745036015240 00000000000000# text after options section "Section 1" option "str-opt" s "A string option, for a filename" optional string typestr="filename" text " explain more about the string option" section "Section 2" text " some text after section 2" option "int-opt" i "A int option" int optional text " some final text"gengetopt-2.22.6/tests/cmdline.ggo0000664000175000017500000000032412044745036014001 00000000000000# cmdline.ggo # test default values #package "default_values" version "1.0" option "foo" f "foo option" int default="15000" no option "bar" b "bar option" string default="this is a default" no gengetopt-2.22.6/tests/no_optgiven_cmd.ggo0000664000175000017500000000027312044745036015543 00000000000000# no_optgiven_cmd.ggo # This test an input file with some required options package "no_optgiven" version "1.0" args "--no-handle-error -u" option "foo" i "foo option" int yes gengetopt-2.22.6/tests/no_multi_types_cmd.ggo0000664000175000017500000000037312044745036016267 00000000000000package "no multi types" version "0.1" purpose "Has multiple options none of which has type" option "test" t "This is a test option" int typestr="A test value" default="5" no option "multi" - "This is a multi option with no type" multiple optional gengetopt-2.22.6/tests/default_cmdline.c0000664000175000017500000000077112045003074015147 00000000000000/* default_cmdline.c test */ /* the cmdline parser is generated with default names */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "cmdline.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; printf ("Value of foo: %d\n", args_info.foo_arg); printf ("Value of bar: %s\n", args_info.bar_arg); cmdline_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_redef_help_cmd.c.test0000664000175000017500000003332212045003074016763 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_redef_help_cmd.ggo --func-name=test_redef_help_cmd_parser --file-name=test_redef_help_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_redef_help_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_redef_help [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " --help Print help and exit", " --version Print version and exit", " -h, --height height", " -V, --vavoom vavoom instead of version", 0 }; typedef enum {ARG_NO } test_redef_help_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_redef_help_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_redef_help_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->height_given = 0 ; args_info->vavoom_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->height_help = gengetopt_args_info_help[2] ; args_info->vavoom_help = gengetopt_args_info_help[3] ; } void test_redef_help_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_REDEF_HELP_CMD_PARSER_PACKAGE_NAME) ? TEST_REDEF_HELP_CMD_PARSER_PACKAGE_NAME : TEST_REDEF_HELP_CMD_PARSER_PACKAGE), TEST_REDEF_HELP_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_redef_help_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_redef_help_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_redef_help_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_redef_help_cmd_parser_params_init(struct test_redef_help_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_redef_help_cmd_parser_params * test_redef_help_cmd_parser_params_create(void) { struct test_redef_help_cmd_parser_params *params = (struct test_redef_help_cmd_parser_params *)malloc(sizeof(struct test_redef_help_cmd_parser_params)); test_redef_help_cmd_parser_params_init(params); return params; } static void test_redef_help_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_redef_help_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_REDEF_HELP_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->height_given) write_into_file(outfile, "height", 0, 0 ); if (args_info->vavoom_given) write_into_file(outfile, "vavoom", 0, 0 ); i = EXIT_SUCCESS; return i; } int test_redef_help_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_REDEF_HELP_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_redef_help_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_redef_help_cmd_parser_free (struct gengetopt_args_info *args_info) { test_redef_help_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_redef_help_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_redef_help_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_redef_help_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_redef_help_cmd_parser_params *params) { int result; result = test_redef_help_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_redef_help_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_redef_help_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_redef_help_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_redef_help_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_redef_help_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_redef_help_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_redef_help_cmd_parser_params.check_ambiguity * @param override @see test_redef_help_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_redef_help_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_redef_help_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_redef_help_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_redef_help_cmd_parser_init (args_info); test_redef_help_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 0 }, { "version", 0, NULL, 0 }, { "height", 0, NULL, 'h' }, { "vavoom", 0, NULL, 'V' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hV", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* height. */ if (update_arg( 0 , 0 , &(args_info->height_given), &(local_args_info.height_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "height", 'h', additional_error)) goto failure; break; case 'V': /* vavoom instead of version. */ if (update_arg( 0 , 0 , &(args_info->vavoom_given), &(local_args_info.vavoom_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "vavoom", 'V', additional_error)) goto failure; break; case 0: /* Long option with no short option */ if (strcmp (long_options[option_index].name, "help") == 0) { test_redef_help_cmd_parser_print_help (); test_redef_help_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); } if (strcmp (long_options[option_index].name, "version") == 0) { test_redef_help_cmd_parser_print_version (); test_redef_help_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); } case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_REDEF_HELP_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_redef_help_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_redef_help_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/wrong_version_redef.ggo0000664000175000017500000000025512044745036016437 00000000000000# test for error when trying redefining help option "depok" - "option depends on opt1" dependon="opt1" string no option "version" H "my version redefined" optional gengetopt-2.22.6/tests/test_conf2.conf0000664000175000017500000000037212044745036014610 00000000000000 # the # may not be the first char in a line # required option required "this is a test" float 3.14 no-short multi-string "first" # group option opta "BAR" string another # multiple options M "second" multi-string = multi-string "third" gengetopt-2.22.6/tests/wrong_flag2.err0000664000175000017500000000010112044745036014602 00000000000000wrong_flag2.ggo:4: invalid specification for this kind of option gengetopt-2.22.6/tests/test_text.c0000664000175000017500000000062012045003074014044 00000000000000/* test_text.c test */ /* test when text is specified in options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_text_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_text_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; test_text_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_values_cmd.h.test0000664000175000017500000004504612045003074016200 00000000000000/** @file test_values_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_VALUES_CMD_H #define TEST_VALUES_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_VALUES_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_VALUES_CMD_PARSER_PACKAGE "test_values" #endif #ifndef TEST_VALUES_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_VALUES_CMD_PARSER_PACKAGE_NAME "test_values" #endif #ifndef TEST_VALUES_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_VALUES_CMD_PARSER_VERSION "1.0" #endif enum enum_values_first_enums { values_first_enums__NULL = -1, values_first_enums_arg_FOO = 0, values_first_enums_arg_BAR, values_first_enums_arg_ANOTHER, values_first_enums_arg_SOMETHING }; enum enum_values_first_enums_plus { values_first_enums_plus__NULL = -1, values_first_enums_plus_arg_PLUS_foo = 0, values_first_enums_plus_arg_PLUS_bar, values_first_enums_plus_arg_MINUS_foo, values_first_enums_plus_arg_MINUS_bar, values_first_enums_plus_arg_all }; enum enum_values_second_enums { values_second_enums__NULL = -1, values_second_enums_arg_90 = 0, values_second_enums_arg_180, values_second_enums_arg_270, values_second_enums_arg_360 }; enum enum_values_multiple_enums { values_multiple_enums__NULL = -1, values_multiple_enums_arg_FIRST = 0, values_multiple_enums_arg_SECOND, values_multiple_enums_arg_THIRD, values_multiple_enums_arg_FOURTH }; enum enum_values_unspecified_enums { values_unspecified_enums__NULL = -1, values_unspecified_enums_arg_FOO = 0, values_unspecified_enums_arg_BAR, values_unspecified_enums_arg_ANOTHER, values_unspecified_enums_arg_SOMETHING }; /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * string_values_arg; /**< @brief string option with values. */ char * string_values_orig; /**< @brief string option with values original value given at command line. */ const char *string_values_help; /**< @brief string option with values help description. */ char * string_values_plus_arg; /**< @brief string option with values containing + and -. */ char * string_values_plus_orig; /**< @brief string option with values containing + and - original value given at command line. */ const char *string_values_plus_help; /**< @brief string option with values containing + and - help description. */ char * string_values_def_arg; /**< @brief string option with values and default (default='bar'). */ char * string_values_def_orig; /**< @brief string option with values and default original value given at command line. */ const char *string_values_def_help; /**< @brief string option with values and default help description. */ char * string_values_def_argopt_arg; /**< @brief string option with values and default and optional argument (default='foobar'). */ char * string_values_def_argopt_orig; /**< @brief string option with values and default and optional argument original value given at command line. */ const char *string_values_def_argopt_help; /**< @brief string option with values and default and optional argument help description. */ char * string_values_no_short_arg; /**< @brief string option with values no short. */ char * string_values_no_short_orig; /**< @brief string option with values no short original value given at command line. */ const char *string_values_no_short_help; /**< @brief string option with values no short help description. */ char ** multistring_values_arg; /**< @brief multiple string option with values. */ char ** multistring_values_orig; /**< @brief multiple string option with values original value given at command line. */ unsigned int multistring_values_min; /**< @brief multiple string option with values's minimum occurreces */ unsigned int multistring_values_max; /**< @brief multiple string option with values's maximum occurreces */ const char *multistring_values_help; /**< @brief multiple string option with values help description. */ char ** multistring_values_def_arg; /**< @brief multiple string option with values and default (default='foo'). */ char ** multistring_values_def_orig; /**< @brief multiple string option with values and default original value given at command line. */ unsigned int multistring_values_def_min; /**< @brief multiple string option with values and default's minimum occurreces */ unsigned int multistring_values_def_max; /**< @brief multiple string option with values and default's maximum occurreces */ const char *multistring_values_def_help; /**< @brief multiple string option with values and default help description. */ char ** multistring_values_no_short_arg; /**< @brief multiple string option with values no-short. */ char ** multistring_values_no_short_orig; /**< @brief multiple string option with values no-short original value given at command line. */ unsigned int multistring_values_no_short_min; /**< @brief multiple string option with values no-short's minimum occurreces */ unsigned int multistring_values_no_short_max; /**< @brief multiple string option with values no-short's maximum occurreces */ const char *multistring_values_no_short_help; /**< @brief multiple string option with values no-short help description. */ char * string_values_group_arg; /**< @brief group string option with values and default (default='bar'). */ char * string_values_group_orig; /**< @brief group string option with values and default original value given at command line. */ const char *string_values_group_help; /**< @brief group string option with values and default help description. */ int int_values_arg; /**< @brief int option with values. */ char * int_values_orig; /**< @brief int option with values original value given at command line. */ const char *int_values_help; /**< @brief int option with values help description. */ int* int_values_m_arg; /**< @brief multiple int option with values. */ char ** int_values_m_orig; /**< @brief multiple int option with values original value given at command line. */ unsigned int int_values_m_min; /**< @brief multiple int option with values's minimum occurreces */ unsigned int int_values_m_max; /**< @brief multiple int option with values's maximum occurreces */ const char *int_values_m_help; /**< @brief multiple int option with values help description. */ int int_values_def_arg; /**< @brief int option with values and default (default='180'). */ char * int_values_def_orig; /**< @brief int option with values and default original value given at command line. */ const char *int_values_def_help; /**< @brief int option with values and default help description. */ enum enum_values_first_enums values_first_enums_arg; /**< @brief option with values and enums 1. */ char * values_first_enums_orig; /**< @brief option with values and enums 1 original value given at command line. */ const char *values_first_enums_help; /**< @brief option with values and enums 1 help description. */ enum enum_values_first_enums_plus values_first_enums_plus_arg; /**< @brief option with values and enums with plus and minus 1. */ char * values_first_enums_plus_orig; /**< @brief option with values and enums with plus and minus 1 original value given at command line. */ const char *values_first_enums_plus_help; /**< @brief option with values and enums with plus and minus 1 help description. */ enum enum_values_second_enums values_second_enums_arg; /**< @brief option with values and enums 2 with default (default='180'). */ char * values_second_enums_orig; /**< @brief option with values and enums 2 with default original value given at command line. */ const char *values_second_enums_help; /**< @brief option with values and enums 2 with default help description. */ enum enum_values_multiple_enums *values_multiple_enums_arg; /**< @brief multiple option with values and enums (default='FOURTH'). */ char ** values_multiple_enums_orig; /**< @brief multiple option with values and enums original value given at command line. */ unsigned int values_multiple_enums_min; /**< @brief multiple option with values and enums's minimum occurreces */ unsigned int values_multiple_enums_max; /**< @brief multiple option with values and enums's maximum occurreces */ const char *values_multiple_enums_help; /**< @brief multiple option with values and enums help description. */ enum enum_values_unspecified_enums values_unspecified_enums_arg; /**< @brief option with values that will not be specified on the command line. */ char * values_unspecified_enums_orig; /**< @brief option with values that will not be specified on the command line original value given at command line. */ const char *values_unspecified_enums_help; /**< @brief option with values that will not be specified on the command line help description. */ char * file_save_arg; /**< @brief save the passed options into a file. */ char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */ const char *file_save_help; /**< @brief save the passed options into a file help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int string_values_given ; /**< @brief Whether string-values was given. */ unsigned int string_values_plus_given ; /**< @brief Whether string-values-plus was given. */ unsigned int string_values_def_given ; /**< @brief Whether string-values-def was given. */ unsigned int string_values_def_argopt_given ; /**< @brief Whether string-values-def-argopt was given. */ unsigned int string_values_no_short_given ; /**< @brief Whether string-values-no-short was given. */ unsigned int multistring_values_given ; /**< @brief Whether multistring-values was given. */ unsigned int multistring_values_def_given ; /**< @brief Whether multistring-values-def was given. */ unsigned int multistring_values_no_short_given ; /**< @brief Whether multistring-values-no-short was given. */ unsigned int string_values_group_given ; /**< @brief Whether string-values-group was given. */ unsigned int int_values_given ; /**< @brief Whether int-values was given. */ unsigned int int_values_m_given ; /**< @brief Whether int-values-m was given. */ unsigned int int_values_def_given ; /**< @brief Whether int-values-def was given. */ unsigned int values_first_enums_given ; /**< @brief Whether values-first-enums was given. */ unsigned int values_first_enums_plus_given ; /**< @brief Whether values-first-enums-plus was given. */ unsigned int values_second_enums_given ; /**< @brief Whether values-second-enums was given. */ unsigned int values_multiple_enums_given ; /**< @brief Whether values-multiple-enums was given. */ unsigned int values_unspecified_enums_given ; /**< @brief Whether values-unspecified-enums was given. */ unsigned int file_save_given ; /**< @brief Whether file-save was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int group1_group_counter; /**< @brief Counter for group group1 */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_values_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_values_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_values_cmd_parser_ext() instead */ int test_values_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_values_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_values_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_values_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_values_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_values_cmd_parser_print_help(void); /** * Print the version */ void test_values_cmd_parser_print_version(void); /** * Initializes all the fields a test_values_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_values_cmd_parser_params_init(struct test_values_cmd_parser_params *params); /** * Allocates dynamically a test_values_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_values_cmd_parser_params structure */ struct test_values_cmd_parser_params *test_values_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_values_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_values_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_values_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); extern const char *test_values_cmd_parser_string_values_values[]; /**< @brief Possible values for string-values. */ extern const char *test_values_cmd_parser_string_values_plus_values[]; /**< @brief Possible values for string-values-plus. */ extern const char *test_values_cmd_parser_string_values_def_values[]; /**< @brief Possible values for string-values-def. */ extern const char *test_values_cmd_parser_string_values_def_argopt_values[]; /**< @brief Possible values for string-values-def-argopt. */ extern const char *test_values_cmd_parser_string_values_no_short_values[]; /**< @brief Possible values for string-values-no-short. */ extern const char *test_values_cmd_parser_multistring_values_values[]; /**< @brief Possible values for multistring-values. */ extern const char *test_values_cmd_parser_multistring_values_def_values[]; /**< @brief Possible values for multistring-values-def. */ extern const char *test_values_cmd_parser_multistring_values_no_short_values[]; /**< @brief Possible values for multistring-values-no-short. */ extern const char *test_values_cmd_parser_string_values_group_values[]; /**< @brief Possible values for string-values-group. */ extern const char *test_values_cmd_parser_int_values_values[]; /**< @brief Possible values for int-values. */ extern const char *test_values_cmd_parser_int_values_m_values[]; /**< @brief Possible values for int-values-m. */ extern const char *test_values_cmd_parser_int_values_def_values[]; /**< @brief Possible values for int-values-def. */ extern const char *test_values_cmd_parser_values_first_enums_values[]; /**< @brief Possible values for values-first-enums. */ extern const char *test_values_cmd_parser_values_first_enums_plus_values[]; /**< @brief Possible values for values-first-enums-plus. */ extern const char *test_values_cmd_parser_values_second_enums_values[]; /**< @brief Possible values for values-second-enums. */ extern const char *test_values_cmd_parser_values_multiple_enums_values[]; /**< @brief Possible values for values-multiple-enums. */ extern const char *test_values_cmd_parser_values_unspecified_enums_values[]; /**< @brief Possible values for values-unspecified-enums. */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_VALUES_CMD_H */ gengetopt-2.22.6/tests/wrong_group.ggo0000664000175000017500000000030112044745036014731 00000000000000# test for problems in group options defgroup "foogroup" groupoption "group-ok" f "flag option OK" string group="foogroup" option "group" F "flag option" string group="foogroup" gengetopt-2.22.6/tests/wrong_group2.ggo0000664000175000017500000000031212044745036015015 00000000000000# test for problems in group options: groupoption without group specification defgroup "foogroup" groupoption "group-ok" f "flag option OK" string option "group" F "flag option" string gengetopt-2.22.6/tests/test_all_opts_cmd.c.test0000664000175000017500000011517112045003074016506 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_all_opts_cmd.ggo --func-name=test_all_opts_cmd_parser --file-name=test_all_opts_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_all_opts_cmd.h" const char *gengetopt_args_info_purpose = "This is just a gengetopt's test file"; const char *gengetopt_args_info_usage = "Usage: test_all_opts [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = "This text is printed after the version during --version\nthis is a test this is a test this is a test this is a test this is a test this\nis a test this is a test this is a test this is a test this is a test!"; const char *gengetopt_args_info_description = "This is just a test file\n\nto test all possible\ncommand line type options.\n\nIn ggo files comments start with # and end at EOL"; const char *gengetopt_args_info_detailed_help[] = { " -h, --help Print help and exit", " --detailed-help Print help, including all details and hidden\n options, and exit", " --full-help Print help, including hidden options, and exit", " -V, --version Print version and exit", "", " -s, --string=STRING string option", " -i, --int=INT int option", " -S, --short=SHORT short option", " -l, --long=LONG long option", " -f, --float=FLOAT float option", " -d, --double=DOUBLE double option", " -D, --longdouble=LONGDOUBLE longdouble option", " -L, --longlong=LONGLONG longlong option", " -F, --flag flag option (default=on)", " -u, --function function option", " \n a `function' option is basically an option with no argument. It can be used,\n e.g., to specify a specific behavior for a program.\n\n Well, this further explanation is quite useless, but it's only to show an\n example of an option with details, which will be printed only when\n --detailed-help is given at the command line.\n", " --no-short no short option", " --opt-arg[=STRING] option with optional arg", " -o, --opt-arg-short[=STRING] option with optional arg (short)", " -r, --required=STRING required option (mandatory)", " NOTICE: This option is required, so, unless you specify (-h)--help or\n (-V)--version, you must always specify this option (and its argument) at\n command line.", "\nBefore the dependant option there is a hidden option, so it shouldn't be\nvisible in the output of --help, but it will be visible in the output of\n--full-help.\n", " -H, --hidden=INT hidden option", " -A, --dependant=STRING option that depends on opt-arg", "\nThis is a text line just to write something in the output\n\nNotice that a text line can contain line breaks, just like this very text, and\nthat, just like all the other texts, it is wrapped by gengetopt automatically\nif it's too long.\n\nMoreover, text can be specified more than once in the input file.\n", " --very-very-long-option=STRING\n the name of this option is long enough to make\n this description begin on a new line", " -y, --assume-multimeth-virtual\n the name of this option is just as long as the\n maximum allowed, so this description begin on\n a new line", " --file-save=STRING save the passed options into a file", "\nA text after all options.", 0 }; static void init_full_help_array(void) { gengetopt_args_info_full_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_full_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_full_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_full_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_full_help[4] = gengetopt_args_info_detailed_help[4]; gengetopt_args_info_full_help[5] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_full_help[6] = gengetopt_args_info_detailed_help[6]; gengetopt_args_info_full_help[7] = gengetopt_args_info_detailed_help[7]; gengetopt_args_info_full_help[8] = gengetopt_args_info_detailed_help[8]; gengetopt_args_info_full_help[9] = gengetopt_args_info_detailed_help[9]; gengetopt_args_info_full_help[10] = gengetopt_args_info_detailed_help[10]; gengetopt_args_info_full_help[11] = gengetopt_args_info_detailed_help[11]; gengetopt_args_info_full_help[12] = gengetopt_args_info_detailed_help[12]; gengetopt_args_info_full_help[13] = gengetopt_args_info_detailed_help[13]; gengetopt_args_info_full_help[14] = gengetopt_args_info_detailed_help[14]; gengetopt_args_info_full_help[15] = gengetopt_args_info_detailed_help[16]; gengetopt_args_info_full_help[16] = gengetopt_args_info_detailed_help[17]; gengetopt_args_info_full_help[17] = gengetopt_args_info_detailed_help[18]; gengetopt_args_info_full_help[18] = gengetopt_args_info_detailed_help[19]; gengetopt_args_info_full_help[19] = gengetopt_args_info_detailed_help[21]; gengetopt_args_info_full_help[20] = gengetopt_args_info_detailed_help[22]; gengetopt_args_info_full_help[21] = gengetopt_args_info_detailed_help[23]; gengetopt_args_info_full_help[22] = gengetopt_args_info_detailed_help[24]; gengetopt_args_info_full_help[23] = gengetopt_args_info_detailed_help[25]; gengetopt_args_info_full_help[24] = gengetopt_args_info_detailed_help[26]; gengetopt_args_info_full_help[25] = gengetopt_args_info_detailed_help[27]; gengetopt_args_info_full_help[26] = gengetopt_args_info_detailed_help[28]; gengetopt_args_info_full_help[27] = 0; } const char *gengetopt_args_info_full_help[28]; static void init_help_array(void) { gengetopt_args_info_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_help[4] = gengetopt_args_info_detailed_help[4]; gengetopt_args_info_help[5] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_help[6] = gengetopt_args_info_detailed_help[6]; gengetopt_args_info_help[7] = gengetopt_args_info_detailed_help[7]; gengetopt_args_info_help[8] = gengetopt_args_info_detailed_help[8]; gengetopt_args_info_help[9] = gengetopt_args_info_detailed_help[9]; gengetopt_args_info_help[10] = gengetopt_args_info_detailed_help[10]; gengetopt_args_info_help[11] = gengetopt_args_info_detailed_help[11]; gengetopt_args_info_help[12] = gengetopt_args_info_detailed_help[12]; gengetopt_args_info_help[13] = gengetopt_args_info_detailed_help[13]; gengetopt_args_info_help[14] = gengetopt_args_info_detailed_help[14]; gengetopt_args_info_help[15] = gengetopt_args_info_detailed_help[16]; gengetopt_args_info_help[16] = gengetopt_args_info_detailed_help[17]; gengetopt_args_info_help[17] = gengetopt_args_info_detailed_help[18]; gengetopt_args_info_help[18] = gengetopt_args_info_detailed_help[19]; gengetopt_args_info_help[19] = gengetopt_args_info_detailed_help[21]; gengetopt_args_info_help[20] = gengetopt_args_info_detailed_help[23]; gengetopt_args_info_help[21] = gengetopt_args_info_detailed_help[24]; gengetopt_args_info_help[22] = gengetopt_args_info_detailed_help[25]; gengetopt_args_info_help[23] = gengetopt_args_info_detailed_help[26]; gengetopt_args_info_help[24] = gengetopt_args_info_detailed_help[27]; gengetopt_args_info_help[25] = gengetopt_args_info_detailed_help[28]; gengetopt_args_info_help[26] = 0; } const char *gengetopt_args_info_help[27]; typedef enum {ARG_NO , ARG_FLAG , ARG_STRING , ARG_INT , ARG_SHORT , ARG_LONG , ARG_FLOAT , ARG_DOUBLE , ARG_LONGDOUBLE , ARG_LONGLONG } test_all_opts_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_all_opts_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_all_opts_cmd_parser_params *params, const char *additional_error); static int test_all_opts_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->detailed_help_given = 0 ; args_info->full_help_given = 0 ; args_info->version_given = 0 ; args_info->string_given = 0 ; args_info->int_given = 0 ; args_info->short_given = 0 ; args_info->long_given = 0 ; args_info->float_given = 0 ; args_info->double_given = 0 ; args_info->longdouble_given = 0 ; args_info->longlong_given = 0 ; args_info->flag_given = 0 ; args_info->function_given = 0 ; args_info->no_short_given = 0 ; args_info->opt_arg_given = 0 ; args_info->opt_arg_short_given = 0 ; args_info->required_given = 0 ; args_info->hidden_given = 0 ; args_info->dependant_given = 0 ; args_info->very_very_long_option_given = 0 ; args_info->assume_multimeth_virtual_given = 0 ; args_info->file_save_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->string_arg = NULL; args_info->string_orig = NULL; args_info->int_orig = NULL; args_info->short_orig = NULL; args_info->long_orig = NULL; args_info->float_orig = NULL; args_info->double_orig = NULL; args_info->longdouble_orig = NULL; args_info->longlong_orig = NULL; args_info->flag_flag = 1; args_info->opt_arg_arg = NULL; args_info->opt_arg_orig = NULL; args_info->opt_arg_short_arg = NULL; args_info->opt_arg_short_orig = NULL; args_info->required_arg = NULL; args_info->required_orig = NULL; args_info->hidden_orig = NULL; args_info->dependant_arg = NULL; args_info->dependant_orig = NULL; args_info->very_very_long_option_arg = NULL; args_info->very_very_long_option_orig = NULL; args_info->file_save_arg = NULL; args_info->file_save_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { init_full_help_array(); init_help_array(); args_info->help_help = gengetopt_args_info_detailed_help[0] ; args_info->detailed_help_help = gengetopt_args_info_detailed_help[1] ; args_info->full_help_help = gengetopt_args_info_detailed_help[2] ; args_info->version_help = gengetopt_args_info_detailed_help[3] ; args_info->string_help = gengetopt_args_info_detailed_help[5] ; args_info->int_help = gengetopt_args_info_detailed_help[6] ; args_info->short_help = gengetopt_args_info_detailed_help[7] ; args_info->long_help = gengetopt_args_info_detailed_help[8] ; args_info->float_help = gengetopt_args_info_detailed_help[9] ; args_info->double_help = gengetopt_args_info_detailed_help[10] ; args_info->longdouble_help = gengetopt_args_info_detailed_help[11] ; args_info->longlong_help = gengetopt_args_info_detailed_help[12] ; args_info->flag_help = gengetopt_args_info_detailed_help[13] ; args_info->function_help = gengetopt_args_info_detailed_help[14] ; args_info->no_short_help = gengetopt_args_info_detailed_help[16] ; args_info->opt_arg_help = gengetopt_args_info_detailed_help[17] ; args_info->opt_arg_short_help = gengetopt_args_info_detailed_help[18] ; args_info->required_help = gengetopt_args_info_detailed_help[19] ; args_info->hidden_help = gengetopt_args_info_detailed_help[22] ; args_info->dependant_help = gengetopt_args_info_detailed_help[23] ; args_info->very_very_long_option_help = gengetopt_args_info_detailed_help[25] ; args_info->assume_multimeth_virtual_help = gengetopt_args_info_detailed_help[26] ; args_info->file_save_help = gengetopt_args_info_detailed_help[27] ; } void test_all_opts_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_ALL_OPTS_CMD_PARSER_PACKAGE_NAME) ? TEST_ALL_OPTS_CMD_PARSER_PACKAGE_NAME : TEST_ALL_OPTS_CMD_PARSER_PACKAGE), TEST_ALL_OPTS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_all_opts_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_all_opts_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_all_opts_cmd_parser_print_full_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_full_help[i]) printf("%s\n", gengetopt_args_info_full_help[i++]); } void test_all_opts_cmd_parser_print_detailed_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_detailed_help[i]) printf("%s\n", gengetopt_args_info_detailed_help[i++]); } void test_all_opts_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_all_opts_cmd_parser_params_init(struct test_all_opts_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_all_opts_cmd_parser_params * test_all_opts_cmd_parser_params_create(void) { struct test_all_opts_cmd_parser_params *params = (struct test_all_opts_cmd_parser_params *)malloc(sizeof(struct test_all_opts_cmd_parser_params)); test_all_opts_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void test_all_opts_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->string_arg)); free_string_field (&(args_info->string_orig)); free_string_field (&(args_info->int_orig)); free_string_field (&(args_info->short_orig)); free_string_field (&(args_info->long_orig)); free_string_field (&(args_info->float_orig)); free_string_field (&(args_info->double_orig)); free_string_field (&(args_info->longdouble_orig)); free_string_field (&(args_info->longlong_orig)); free_string_field (&(args_info->opt_arg_arg)); free_string_field (&(args_info->opt_arg_orig)); free_string_field (&(args_info->opt_arg_short_arg)); free_string_field (&(args_info->opt_arg_short_orig)); free_string_field (&(args_info->required_arg)); free_string_field (&(args_info->required_orig)); free_string_field (&(args_info->hidden_orig)); free_string_field (&(args_info->dependant_arg)); free_string_field (&(args_info->dependant_orig)); free_string_field (&(args_info->very_very_long_option_arg)); free_string_field (&(args_info->very_very_long_option_orig)); free_string_field (&(args_info->file_save_arg)); free_string_field (&(args_info->file_save_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_all_opts_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_ALL_OPTS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->detailed_help_given) write_into_file(outfile, "detailed-help", 0, 0 ); if (args_info->full_help_given) write_into_file(outfile, "full-help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->string_given) write_into_file(outfile, "string", args_info->string_orig, 0); if (args_info->int_given) write_into_file(outfile, "int", args_info->int_orig, 0); if (args_info->short_given) write_into_file(outfile, "short", args_info->short_orig, 0); if (args_info->long_given) write_into_file(outfile, "long", args_info->long_orig, 0); if (args_info->float_given) write_into_file(outfile, "float", args_info->float_orig, 0); if (args_info->double_given) write_into_file(outfile, "double", args_info->double_orig, 0); if (args_info->longdouble_given) write_into_file(outfile, "longdouble", args_info->longdouble_orig, 0); if (args_info->longlong_given) write_into_file(outfile, "longlong", args_info->longlong_orig, 0); if (args_info->flag_given) write_into_file(outfile, "flag", 0, 0 ); if (args_info->function_given) write_into_file(outfile, "function", 0, 0 ); if (args_info->no_short_given) write_into_file(outfile, "no-short", 0, 0 ); if (args_info->opt_arg_given) write_into_file(outfile, "opt-arg", args_info->opt_arg_orig, 0); if (args_info->opt_arg_short_given) write_into_file(outfile, "opt-arg-short", args_info->opt_arg_short_orig, 0); if (args_info->required_given) write_into_file(outfile, "required", args_info->required_orig, 0); if (args_info->hidden_given) write_into_file(outfile, "hidden", args_info->hidden_orig, 0); if (args_info->dependant_given) write_into_file(outfile, "dependant", args_info->dependant_orig, 0); if (args_info->very_very_long_option_given) write_into_file(outfile, "very-very-long-option", args_info->very_very_long_option_orig, 0); if (args_info->assume_multimeth_virtual_given) write_into_file(outfile, "assume-multimeth-virtual", 0, 0 ); if (args_info->file_save_given) write_into_file(outfile, "file-save", args_info->file_save_orig, 0); i = EXIT_SUCCESS; return i; } int test_all_opts_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_ALL_OPTS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_all_opts_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_all_opts_cmd_parser_free (struct gengetopt_args_info *args_info) { test_all_opts_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_all_opts_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_all_opts_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_all_opts_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_all_opts_cmd_parser_params *params) { int result; result = test_all_opts_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_all_opts_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_all_opts_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_all_opts_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_all_opts_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_all_opts_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_all_opts_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_all_opts_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_all_opts_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_all_opts_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->required_given) { fprintf (stderr, "%s: '--required' ('-r') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ if (args_info->dependant_given && ! args_info->opt_arg_given) { fprintf (stderr, "%s: '--dependant' ('-A') option depends on option 'opt-arg'%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_all_opts_cmd_parser_params.check_ambiguity * @param override @see test_all_opts_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_all_opts_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_SHORT: if (val) *((short *)field) = (short)strtol (val, &stop_char, 0); break; case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; case ARG_DOUBLE: if (val) *((double *)field) = strtod (val, &stop_char); break; case ARG_LONGDOUBLE: if (val) *((long double *)field) = (long double)strtod (val, &stop_char); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0); #else if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); #endif break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_all_opts_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_all_opts_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_all_opts_cmd_parser_init (args_info); test_all_opts_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "detailed-help", 0, NULL, 0 }, { "full-help", 0, NULL, 0 }, { "version", 0, NULL, 'V' }, { "string", 1, NULL, 's' }, { "int", 1, NULL, 'i' }, { "short", 1, NULL, 'S' }, { "long", 1, NULL, 'l' }, { "float", 1, NULL, 'f' }, { "double", 1, NULL, 'd' }, { "longdouble", 1, NULL, 'D' }, { "longlong", 1, NULL, 'L' }, { "flag", 0, NULL, 'F' }, { "function", 0, NULL, 'u' }, { "no-short", 0, NULL, 0 }, { "opt-arg", 2, NULL, 0 }, { "opt-arg-short", 2, NULL, 'o' }, { "required", 1, NULL, 'r' }, { "hidden", 1, NULL, 'H' }, { "dependant", 1, NULL, 'A' }, { "very-very-long-option", 1, NULL, 0 }, { "assume-multimeth-virtual", 0, NULL, 'y' }, { "file-save", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:i:S:l:f:d:D:L:Fuo::r:H:A:y", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_all_opts_cmd_parser_print_help (); test_all_opts_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_all_opts_cmd_parser_print_version (); test_all_opts_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* string option. */ if (update_arg( (void *)&(args_info->string_arg), &(args_info->string_orig), &(args_info->string_given), &(local_args_info.string_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string", 's', additional_error)) goto failure; break; case 'i': /* int option. */ if (update_arg( (void *)&(args_info->int_arg), &(args_info->int_orig), &(args_info->int_given), &(local_args_info.int_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "int", 'i', additional_error)) goto failure; break; case 'S': /* short option. */ if (update_arg( (void *)&(args_info->short_arg), &(args_info->short_orig), &(args_info->short_given), &(local_args_info.short_given), optarg, 0, 0, ARG_SHORT, check_ambiguity, override, 0, 0, "short", 'S', additional_error)) goto failure; break; case 'l': /* long option. */ if (update_arg( (void *)&(args_info->long_arg), &(args_info->long_orig), &(args_info->long_given), &(local_args_info.long_given), optarg, 0, 0, ARG_LONG, check_ambiguity, override, 0, 0, "long", 'l', additional_error)) goto failure; break; case 'f': /* float option. */ if (update_arg( (void *)&(args_info->float_arg), &(args_info->float_orig), &(args_info->float_given), &(local_args_info.float_given), optarg, 0, 0, ARG_FLOAT, check_ambiguity, override, 0, 0, "float", 'f', additional_error)) goto failure; break; case 'd': /* double option. */ if (update_arg( (void *)&(args_info->double_arg), &(args_info->double_orig), &(args_info->double_given), &(local_args_info.double_given), optarg, 0, 0, ARG_DOUBLE, check_ambiguity, override, 0, 0, "double", 'd', additional_error)) goto failure; break; case 'D': /* longdouble option. */ if (update_arg( (void *)&(args_info->longdouble_arg), &(args_info->longdouble_orig), &(args_info->longdouble_given), &(local_args_info.longdouble_given), optarg, 0, 0, ARG_LONGDOUBLE, check_ambiguity, override, 0, 0, "longdouble", 'D', additional_error)) goto failure; break; case 'L': /* longlong option. */ if (update_arg( (void *)&(args_info->longlong_arg), &(args_info->longlong_orig), &(args_info->longlong_given), &(local_args_info.longlong_given), optarg, 0, 0, ARG_LONGLONG, check_ambiguity, override, 0, 0, "longlong", 'L', additional_error)) goto failure; break; case 'F': /* flag option. */ if (update_arg((void *)&(args_info->flag_flag), 0, &(args_info->flag_given), &(local_args_info.flag_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "flag", 'F', additional_error)) goto failure; break; case 'u': /* function option. */ if (update_arg( 0 , 0 , &(args_info->function_given), &(local_args_info.function_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "function", 'u', additional_error)) goto failure; break; case 'o': /* option with optional arg (short). */ if (update_arg( (void *)&(args_info->opt_arg_short_arg), &(args_info->opt_arg_short_orig), &(args_info->opt_arg_short_given), &(local_args_info.opt_arg_short_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "opt-arg-short", 'o', additional_error)) goto failure; break; case 'r': /* required option. */ if (update_arg( (void *)&(args_info->required_arg), &(args_info->required_orig), &(args_info->required_given), &(local_args_info.required_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "required", 'r', additional_error)) goto failure; break; case 'H': /* hidden option. */ if (update_arg( (void *)&(args_info->hidden_arg), &(args_info->hidden_orig), &(args_info->hidden_given), &(local_args_info.hidden_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "hidden", 'H', additional_error)) goto failure; break; case 'A': /* option that depends on opt-arg. */ if (update_arg( (void *)&(args_info->dependant_arg), &(args_info->dependant_orig), &(args_info->dependant_given), &(local_args_info.dependant_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "dependant", 'A', additional_error)) goto failure; break; case 'y': /* the name of this option is just as long as the maximum allowed, so this description begin on a new line. */ if (update_arg( 0 , 0 , &(args_info->assume_multimeth_virtual_given), &(local_args_info.assume_multimeth_virtual_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "assume-multimeth-virtual", 'y', additional_error)) goto failure; break; case 0: /* Long option with no short option */ if (strcmp (long_options[option_index].name, "detailed-help") == 0) { test_all_opts_cmd_parser_print_detailed_help (); test_all_opts_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); } if (strcmp (long_options[option_index].name, "full-help") == 0) { test_all_opts_cmd_parser_print_full_help (); test_all_opts_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); } /* no short option. */ if (strcmp (long_options[option_index].name, "no-short") == 0) { if (update_arg( 0 , 0 , &(args_info->no_short_given), &(local_args_info.no_short_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-short", '-', additional_error)) goto failure; } /* option with optional arg. */ else if (strcmp (long_options[option_index].name, "opt-arg") == 0) { if (update_arg( (void *)&(args_info->opt_arg_arg), &(args_info->opt_arg_orig), &(args_info->opt_arg_given), &(local_args_info.opt_arg_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "opt-arg", '-', additional_error)) goto failure; } /* the name of this option is long enough to make this description begin on a new line. */ else if (strcmp (long_options[option_index].name, "very-very-long-option") == 0) { if (update_arg( (void *)&(args_info->very_very_long_option_arg), &(args_info->very_very_long_option_orig), &(args_info->very_very_long_option_given), &(local_args_info.very_very_long_option_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "very-very-long-option", '-', additional_error)) goto failure; } /* save the passed options into a file. */ else if (strcmp (long_options[option_index].name, "file-save") == 0) { if (update_arg( (void *)&(args_info->file_save_arg), &(args_info->file_save_orig), &(args_info->file_save_given), &(local_args_info.file_save_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "file-save", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_ALL_OPTS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (check_required) { error_occurred += test_all_opts_cmd_parser_required2 (args_info, argv[0], additional_error); } test_all_opts_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_all_opts_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_no_handle_help_cmd.ggo0000664000175000017500000000066712044745036017221 00000000000000# test_no_handle_help_cmd.ggo # test no handle help and version options # use args in the .ggo file args "--no-handle-version --no-handle-help --no-handle-error --string-parser" package "test_no_handle_help" version "1.0" option "height" - "this is the description of height" optional int details="These are the details of option height" option "vavoom" - "this is the description of vavoom" optional string gengetopt-2.22.6/tests/test_align_cmd.h.test0000664000175000017500000001642012045003074015765 00000000000000/** @file test_align_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_ALIGN_CMD_H #define TEST_ALIGN_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_ALIGN_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_ALIGN_CMD_PARSER_PACKAGE "test align" #endif #ifndef TEST_ALIGN_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_ALIGN_CMD_PARSER_PACKAGE_NAME "test align" #endif #ifndef TEST_ALIGN_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_ALIGN_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ const char *hidden_option_help; /**< @brief This is the hidden option that is printed only with --full-help; thanks to its long description we force a possible different alignment for --full-help help description. */ const char *non_hidden_help; /**< @brief non-hidden option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int full_help_given ; /**< @brief Whether full-help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int hidden_option_given ; /**< @brief Whether hidden-option was given. */ unsigned int non_hidden_given ; /**< @brief Whether non-hidden was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int standalone_mode_counter; /**< @brief Counter for mode standalone */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_align_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** @brief all the lines making the full help output (including hidden options) */ extern const char *gengetopt_args_info_full_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_align_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_align_cmd_parser_ext() instead */ int test_align_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_align_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_align_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_align_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_align_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_align_cmd_parser_print_help(void); /** * Print the full help (including hidden options) */ void test_align_cmd_parser_print_full_help(void); /** * Print the version */ void test_align_cmd_parser_print_version(void); /** * Initializes all the fields a test_align_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_align_cmd_parser_params_init(struct test_align_cmd_parser_params *params); /** * Allocates dynamically a test_align_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_align_cmd_parser_params structure */ struct test_align_cmd_parser_params *test_align_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_align_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_align_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_align_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_ALIGN_CMD_H */ gengetopt-2.22.6/tests/test_all_opts.sh.in0000664000175000017500000000032412044745036015505 00000000000000#! @SHELL@ # the next program must exit with error $* ./test_all_opts -r "foo" --opt-arg -o $* ./test_all_opts -r "foo" --opt-arg="bar" -o"foobar" if $* ./test_all_opts -r "foo" -H10; then true; else false; fi gengetopt-2.22.6/tests/test_only_flags_cmd.c.test0000664000175000017500000003220512045003074017022 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_only_flags_cmd.ggo --func-name=test_only_flags_cmd_parser --file-name=test_only_flags_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_only_flags_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_only_flags [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -f, --foo foo option (default=on)", 0 }; typedef enum {ARG_NO , ARG_FLAG } test_only_flags_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_only_flags_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_only_flags_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_flag = 1; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; } void test_only_flags_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME) ? TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME : TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE), TEST_ONLY_FLAGS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_only_flags_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_only_flags_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_only_flags_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_only_flags_cmd_parser_params_init(struct test_only_flags_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_only_flags_cmd_parser_params * test_only_flags_cmd_parser_params_create(void) { struct test_only_flags_cmd_parser_params *params = (struct test_only_flags_cmd_parser_params *)malloc(sizeof(struct test_only_flags_cmd_parser_params)); test_only_flags_cmd_parser_params_init(params); return params; } static void test_only_flags_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_only_flags_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", 0, 0 ); i = EXIT_SUCCESS; return i; } int test_only_flags_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_only_flags_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_only_flags_cmd_parser_free (struct gengetopt_args_info *args_info) { test_only_flags_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_only_flags_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_only_flags_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_only_flags_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_only_flags_cmd_parser_params *params) { int result; result = test_only_flags_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_only_flags_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_only_flags_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_only_flags_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_only_flags_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_only_flags_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_only_flags_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_only_flags_cmd_parser_params.check_ambiguity * @param override @see test_only_flags_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_only_flags_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_only_flags_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_only_flags_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_only_flags_cmd_parser_init (args_info); test_only_flags_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 0, NULL, 'f' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVf", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_only_flags_cmd_parser_print_help (); test_only_flags_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_only_flags_cmd_parser_print_version (); test_only_flags_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'f': /* foo option. */ if (update_arg((void *)&(args_info->foo_flag), 0, &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "foo", 'f', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_only_flags_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_only_flags_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_simple_multiple.cc0000664000175000017500000000142512045003074016433 00000000000000/* test_simple_multiple.cc test */ /* test options that can be given more than once */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "test_simple_multiple_cmd.h" static struct gengetopt_args_info args_info; using namespace std; int main (int argc, char **argv) { unsigned int i = 0; int result = 0; if (test_simple_multiple_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } if (args_info.string_given) { for (i = 0; i < args_info.string_given; ++i) printf ("passed string: %s\n", args_info.string_arg[i]); } else { printf ("default value: %s\n", args_info.string_arg[0]); } end: test_simple_multiple_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/more_than_once_cmd.c.test0000664000175000017500000003512412045003074016611 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/more_than_once_cmd.ggo --func-name=more_than_once_cmd_parser --file-name=more_than_once_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "more_than_once_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: more_than_once [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -f, --foo=INT foo option", " -b, --bar=STRING bar option", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT } more_than_once_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int more_than_once_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct more_than_once_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; args_info->bar_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_orig = NULL; args_info->bar_arg = NULL; args_info->bar_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; args_info->bar_help = gengetopt_args_info_help[3] ; } void more_than_once_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(MORE_THAN_ONCE_CMD_PARSER_PACKAGE_NAME) ? MORE_THAN_ONCE_CMD_PARSER_PACKAGE_NAME : MORE_THAN_ONCE_CMD_PARSER_PACKAGE), MORE_THAN_ONCE_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { more_than_once_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void more_than_once_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void more_than_once_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void more_than_once_cmd_parser_params_init(struct more_than_once_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct more_than_once_cmd_parser_params * more_than_once_cmd_parser_params_create(void) { struct more_than_once_cmd_parser_params *params = (struct more_than_once_cmd_parser_params *)malloc(sizeof(struct more_than_once_cmd_parser_params)); more_than_once_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void more_than_once_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->foo_orig)); free_string_field (&(args_info->bar_arg)); free_string_field (&(args_info->bar_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int more_than_once_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", MORE_THAN_ONCE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); if (args_info->bar_given) write_into_file(outfile, "bar", args_info->bar_orig, 0); i = EXIT_SUCCESS; return i; } int more_than_once_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", MORE_THAN_ONCE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = more_than_once_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void more_than_once_cmd_parser_free (struct gengetopt_args_info *args_info) { more_than_once_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int more_than_once_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return more_than_once_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int more_than_once_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct more_than_once_cmd_parser_params *params) { int result; result = more_than_once_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { more_than_once_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int more_than_once_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct more_than_once_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = more_than_once_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { more_than_once_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int more_than_once_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see more_than_once_cmd_parser_params.check_ambiguity * @param override @see more_than_once_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, more_than_once_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int more_than_once_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct more_than_once_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) more_than_once_cmd_parser_init (args_info); more_than_once_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'f' }, { "bar", 1, NULL, 'b' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVf:b:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ more_than_once_cmd_parser_print_help (); more_than_once_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ more_than_once_cmd_parser_print_version (); more_than_once_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'f': /* foo option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "foo", 'f', additional_error)) goto failure; break; case 'b': /* bar option. */ if (update_arg( (void *)&(args_info->bar_arg), &(args_info->bar_orig), &(args_info->bar_given), &(local_args_info.bar_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "bar", 'b', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", MORE_THAN_ONCE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ more_than_once_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: more_than_once_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/wrong_enum_use.err0000664000175000017500000000011612044745036015435 00000000000000wrong_enum_use.ggo:4: enum type can only be specified for options with values gengetopt-2.22.6/tests/no_strings_cmd.c.test0000664000175000017500000003250512045003074016016 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/no_strings_cmd.ggo --func-name=no_strings_cmd_parser --file-name=no_strings_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "no_strings_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: no_strings [--foo|-i] "; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -i, --foo=INT foo option", 0 }; typedef enum {ARG_NO , ARG_INT } no_strings_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int no_strings_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_strings_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; } void no_strings_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(NO_STRINGS_CMD_PARSER_PACKAGE_NAME) ? NO_STRINGS_CMD_PARSER_PACKAGE_NAME : NO_STRINGS_CMD_PARSER_PACKAGE), NO_STRINGS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { no_strings_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void no_strings_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void no_strings_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void no_strings_cmd_parser_params_init(struct no_strings_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct no_strings_cmd_parser_params * no_strings_cmd_parser_params_create(void) { struct no_strings_cmd_parser_params *params = (struct no_strings_cmd_parser_params *)malloc(sizeof(struct no_strings_cmd_parser_params)); no_strings_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void no_strings_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->foo_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int no_strings_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", NO_STRINGS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); i = EXIT_SUCCESS; return i; } int no_strings_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", NO_STRINGS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = no_strings_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void no_strings_cmd_parser_free (struct gengetopt_args_info *args_info) { no_strings_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int no_strings_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return no_strings_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int no_strings_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_strings_cmd_parser_params *params) { int result; result = no_strings_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { no_strings_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_strings_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct no_strings_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = no_strings_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { no_strings_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_strings_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see no_strings_cmd_parser_params.check_ambiguity * @param override @see no_strings_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, no_strings_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int no_strings_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct no_strings_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) no_strings_cmd_parser_init (args_info); no_strings_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'i' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVi:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ no_strings_cmd_parser_print_help (); no_strings_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ no_strings_cmd_parser_print_version (); no_strings_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'i': /* foo option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "foo", 'i', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", NO_STRINGS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ no_strings_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: no_strings_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_manual_help_cmd.h0000664000175000017500000001723512044775610016222 00000000000000/** @file test_manual_help_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_MANUAL_HELP_CMD_H #define TEST_MANUAL_HELP_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_MANUAL_HELP_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_MANUAL_HELP_CMD_PARSER_PACKAGE "test_manual_help" #endif #ifndef TEST_MANUAL_HELP_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_MANUAL_HELP_CMD_PARSER_PACKAGE_NAME "test_manual_help" #endif #ifndef TEST_MANUAL_HELP_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_MANUAL_HELP_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief show help (possibly of other options) help description. */ const char *detailed_help_help; /**< @brief show detailed help help description. */ const char *version_help; /**< @brief show version of the program help description. */ int height_arg; /**< @brief this is the description of height. */ char * height_orig; /**< @brief this is the description of height original value given at command line. */ const char *height_help; /**< @brief this is the description of height help description. */ char * vavoom_arg; /**< @brief this is the description of vavoom. */ char * vavoom_orig; /**< @brief this is the description of vavoom original value given at command line. */ const char *vavoom_help; /**< @brief this is the description of vavoom help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int detailed_help_given ; /**< @brief Whether detailed-help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int height_given ; /**< @brief Whether height was given. */ unsigned int vavoom_given ; /**< @brief Whether vavoom was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_manual_help_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** @brief all the lines making the detailed help output (including hidden options and details) */ extern const char *gengetopt_args_info_detailed_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_manual_help_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_manual_help_cmd_parser_ext() instead */ int test_manual_help_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_manual_help_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_manual_help_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_manual_help_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_manual_help_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_manual_help_cmd_parser_print_help(void); /** * Print the detailed help (including hidden options and details) */ void test_manual_help_cmd_parser_print_detailed_help(void); /** * Print the version */ void test_manual_help_cmd_parser_print_version(void); /** * Initializes all the fields a test_manual_help_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_manual_help_cmd_parser_params_init(struct test_manual_help_cmd_parser_params *params); /** * Allocates dynamically a test_manual_help_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_manual_help_cmd_parser_params structure */ struct test_manual_help_cmd_parser_params *test_manual_help_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_manual_help_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_manual_help_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_manual_help_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_MANUAL_HELP_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser_ov4.c.in0000664000175000017500000000346312045003074016566 00000000000000/* test_conf_parser_ov4.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan the conf file and then the command line; however, if options were specified in the conf file and also in the command line we get an error (uses check_ambiguity parameter */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { int result = 0; struct test_conf_parser_cmd_parser_params *params; /* initialize the parameters structure */ params = test_conf_parser_cmd_parser_params_create(); /* initialize args_info, but don't check for required options NOTICE: the other fields are initialized to their default values */ params->check_required = 0; /* call the config file parser */ if (test_conf_parser_cmd_parser_config_file ("@srcdir@/test_conf2.conf", &args_info, params) != 0) { result = 1; goto stop; } /* check ambiguity with config file options, do not initialize args_info, check for required options. */ params->initialize = 0; params->check_ambiguity = 1; params->check_required = 1; /* call the command line parser */ if (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0) { result = 1; goto stop; } printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); stop: /* deallocate structures */ test_conf_parser_cmd_parser_free (&args_info); free (params); return result; } gengetopt-2.22.6/tests/test_conf_parser_cmd.c.test0000664000175000017500000015517112045003074017176 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_conf_parser_cmd.ggoconf --func-name=test_conf_parser_cmd_parser --file-name=test_conf_parser_cmd --unamed-opt=OTHER NAMES --conf-parser --arg-struct-name=my_args_info --no-handle-error The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_conf_parser_cmd.h" const char *my_args_info_purpose = ""; const char *my_args_info_usage = "Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]..."; const char *my_args_info_versiontext = ""; const char *my_args_info_description = ""; const char *my_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", "\n Group: grp1\n an option of this group is required", " -a, --opta=STRING string a", " -b, --optb=STRING string b", "\n Group: my grp2", " --optc string c", " -C, --optd string d", " -s, --string=STRING string option", " -i, --int=INT int option", " -S, --short=SHORT short option", " -l, --long=LONG long option", " -f, --float=FLOAT float option", " -d, --double=DOUBLE double option", " -D, --longdouble=LONGDOUBLE longdouble option", " -L, --longlong=LONGLONG longlong option", " -F, --flag flag option (default=on)", " -u, --function function option", " --no-short no short option", " -r, --required=STRING required option", " -c, --conf-file=STRING config file (default=`test_conf.conf')", " -M, --multi-string=STRING multiple string option", " --multi-string-def=STRING multiple string option with default\n (default=`this default')", " -n, --noarg multiple option with no arg", " --noarg-noshort multiple option with no arg and no short", " --opt-arg[=STRING] option with optional arg", " --file-save=STRING save the passed options into a file", 0 }; typedef enum {ARG_NO , ARG_FLAG , ARG_STRING , ARG_INT , ARG_SHORT , ARG_LONG , ARG_FLOAT , ARG_DOUBLE , ARG_LONGDOUBLE , ARG_LONGLONG } test_conf_parser_cmd_parser_arg_type; static void clear_given (struct my_args_info *args_info); static void clear_args (struct my_args_info *args_info); static int test_conf_parser_cmd_parser_internal (int argc, char **argv, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params, const char *additional_error); static int test_conf_parser_cmd_parser_required2 (struct my_args_info *args_info, const char *prog_name, const char *additional_error); struct line_list { char * string_arg; struct line_list * next; }; static struct line_list *cmd_line_list = 0; static struct line_list *cmd_line_list_tmp = 0; static void free_cmd_list(void) { /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } } } static char * gengetopt_strdup (const char *s); static void clear_given (struct my_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->opta_given = 0 ; args_info->optb_given = 0 ; args_info->optc_given = 0 ; args_info->optd_given = 0 ; args_info->string_given = 0 ; args_info->int_given = 0 ; args_info->short_given = 0 ; args_info->long_given = 0 ; args_info->float_given = 0 ; args_info->double_given = 0 ; args_info->longdouble_given = 0 ; args_info->longlong_given = 0 ; args_info->flag_given = 0 ; args_info->function_given = 0 ; args_info->no_short_given = 0 ; args_info->required_given = 0 ; args_info->conf_file_given = 0 ; args_info->multi_string_given = 0 ; args_info->multi_string_def_given = 0 ; args_info->noarg_given = 0 ; args_info->noarg_noshort_given = 0 ; args_info->opt_arg_given = 0 ; args_info->file_save_given = 0 ; args_info->grp1_group_counter = 0 ; args_info->my_grp2_group_counter = 0 ; } static void clear_args (struct my_args_info *args_info) { FIX_UNUSED (args_info); args_info->opta_arg = NULL; args_info->opta_orig = NULL; args_info->optb_arg = NULL; args_info->optb_orig = NULL; args_info->string_arg = NULL; args_info->string_orig = NULL; args_info->int_orig = NULL; args_info->short_orig = NULL; args_info->long_orig = NULL; args_info->float_orig = NULL; args_info->double_orig = NULL; args_info->longdouble_orig = NULL; args_info->longlong_orig = NULL; args_info->flag_flag = 1; args_info->required_arg = NULL; args_info->required_orig = NULL; args_info->conf_file_arg = gengetopt_strdup ("test_conf.conf"); args_info->conf_file_orig = NULL; args_info->multi_string_arg = NULL; args_info->multi_string_orig = NULL; args_info->multi_string_def_arg = NULL; args_info->multi_string_def_orig = NULL; args_info->opt_arg_arg = NULL; args_info->opt_arg_orig = NULL; args_info->file_save_arg = NULL; args_info->file_save_orig = NULL; } static void init_args_info(struct my_args_info *args_info) { args_info->help_help = my_args_info_help[0] ; args_info->version_help = my_args_info_help[1] ; args_info->opta_help = my_args_info_help[3] ; args_info->optb_help = my_args_info_help[4] ; args_info->optc_help = my_args_info_help[6] ; args_info->optd_help = my_args_info_help[7] ; args_info->string_help = my_args_info_help[8] ; args_info->int_help = my_args_info_help[9] ; args_info->short_help = my_args_info_help[10] ; args_info->long_help = my_args_info_help[11] ; args_info->float_help = my_args_info_help[12] ; args_info->double_help = my_args_info_help[13] ; args_info->longdouble_help = my_args_info_help[14] ; args_info->longlong_help = my_args_info_help[15] ; args_info->flag_help = my_args_info_help[16] ; args_info->function_help = my_args_info_help[17] ; args_info->no_short_help = my_args_info_help[18] ; args_info->required_help = my_args_info_help[19] ; args_info->conf_file_help = my_args_info_help[20] ; args_info->multi_string_help = my_args_info_help[21] ; args_info->multi_string_min = 0; args_info->multi_string_max = 0; args_info->multi_string_def_help = my_args_info_help[22] ; args_info->multi_string_def_min = 0; args_info->multi_string_def_max = 0; args_info->noarg_help = my_args_info_help[23] ; args_info->noarg_min = 0; args_info->noarg_max = 0; args_info->noarg_noshort_help = my_args_info_help[24] ; args_info->noarg_noshort_min = 0; args_info->noarg_noshort_max = 0; args_info->opt_arg_help = my_args_info_help[25] ; args_info->file_save_help = my_args_info_help[26] ; } void test_conf_parser_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME) ? TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME : TEST_CONF_PARSER_CMD_PARSER_PACKAGE), TEST_CONF_PARSER_CMD_PARSER_VERSION); if (strlen(my_args_info_versiontext) > 0) printf("\n%s\n", my_args_info_versiontext); } static void print_help_common(void) { test_conf_parser_cmd_parser_print_version (); if (strlen(my_args_info_purpose) > 0) printf("\n%s\n", my_args_info_purpose); if (strlen(my_args_info_usage) > 0) printf("\n%s\n", my_args_info_usage); printf("\n"); if (strlen(my_args_info_description) > 0) printf("%s\n\n", my_args_info_description); } void test_conf_parser_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (my_args_info_help[i]) printf("%s\n", my_args_info_help[i++]); } void test_conf_parser_cmd_parser_init (struct my_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_conf_parser_cmd_parser_params_init(struct test_conf_parser_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_conf_parser_cmd_parser_params * test_conf_parser_cmd_parser_params_create(void) { struct test_conf_parser_cmd_parser_params *params = (struct test_conf_parser_cmd_parser_params *)malloc(sizeof(struct test_conf_parser_cmd_parser_params)); test_conf_parser_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; short short_arg; long long_arg; float float_arg; double double_arg; long double longdouble_arg; #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; #else long longlong_arg; #endif char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_conf_parser_cmd_parser_release (struct my_args_info *args_info) { unsigned int i; free_string_field (&(args_info->opta_arg)); free_string_field (&(args_info->opta_orig)); free_string_field (&(args_info->optb_arg)); free_string_field (&(args_info->optb_orig)); free_string_field (&(args_info->string_arg)); free_string_field (&(args_info->string_orig)); free_string_field (&(args_info->int_orig)); free_string_field (&(args_info->short_orig)); free_string_field (&(args_info->long_orig)); free_string_field (&(args_info->float_orig)); free_string_field (&(args_info->double_orig)); free_string_field (&(args_info->longdouble_orig)); free_string_field (&(args_info->longlong_orig)); free_string_field (&(args_info->required_arg)); free_string_field (&(args_info->required_orig)); free_string_field (&(args_info->conf_file_arg)); free_string_field (&(args_info->conf_file_orig)); free_multiple_string_field (args_info->multi_string_given, &(args_info->multi_string_arg), &(args_info->multi_string_orig)); free_multiple_string_field (args_info->multi_string_def_given, &(args_info->multi_string_def_arg), &(args_info->multi_string_def_orig)); free_string_field (&(args_info->opt_arg_arg)); free_string_field (&(args_info->opt_arg_orig)); free_string_field (&(args_info->file_save_arg)); free_string_field (&(args_info->file_save_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_conf_parser_cmd_parser_dump(FILE *outfile, struct my_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->opta_given) write_into_file(outfile, "opta", args_info->opta_orig, 0); if (args_info->optb_given) write_into_file(outfile, "optb", args_info->optb_orig, 0); if (args_info->optc_given) write_into_file(outfile, "optc", 0, 0 ); if (args_info->optd_given) write_into_file(outfile, "optd", 0, 0 ); if (args_info->string_given) write_into_file(outfile, "string", args_info->string_orig, 0); if (args_info->int_given) write_into_file(outfile, "int", args_info->int_orig, 0); if (args_info->short_given) write_into_file(outfile, "short", args_info->short_orig, 0); if (args_info->long_given) write_into_file(outfile, "long", args_info->long_orig, 0); if (args_info->float_given) write_into_file(outfile, "float", args_info->float_orig, 0); if (args_info->double_given) write_into_file(outfile, "double", args_info->double_orig, 0); if (args_info->longdouble_given) write_into_file(outfile, "longdouble", args_info->longdouble_orig, 0); if (args_info->longlong_given) write_into_file(outfile, "longlong", args_info->longlong_orig, 0); if (args_info->flag_given) write_into_file(outfile, "flag", 0, 0 ); if (args_info->function_given) write_into_file(outfile, "function", 0, 0 ); if (args_info->no_short_given) write_into_file(outfile, "no-short", 0, 0 ); if (args_info->required_given) write_into_file(outfile, "required", args_info->required_orig, 0); if (args_info->conf_file_given) write_into_file(outfile, "conf-file", args_info->conf_file_orig, 0); write_multiple_into_file(outfile, args_info->multi_string_given, "multi-string", args_info->multi_string_orig, 0); write_multiple_into_file(outfile, args_info->multi_string_def_given, "multi-string-def", args_info->multi_string_def_orig, 0); write_multiple_into_file(outfile, args_info->noarg_given, "noarg", 0, 0); write_multiple_into_file(outfile, args_info->noarg_noshort_given, "noarg-noshort", 0, 0); if (args_info->opt_arg_given) write_into_file(outfile, "opt-arg", args_info->opt_arg_orig, 0); if (args_info->file_save_given) write_into_file(outfile, "file-save", args_info->file_save_orig, 0); i = EXIT_SUCCESS; return i; } int test_conf_parser_cmd_parser_file_save(const char *filename, struct my_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_conf_parser_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_conf_parser_cmd_parser_free (struct my_args_info *args_info) { test_conf_parser_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } static void reset_group_grp1(struct my_args_info *args_info) { if (! args_info->grp1_group_counter) return; args_info->opta_given = 0 ; free_string_field (&(args_info->opta_arg)); free_string_field (&(args_info->opta_orig)); args_info->optb_given = 0 ; free_string_field (&(args_info->optb_arg)); free_string_field (&(args_info->optb_orig)); args_info->grp1_group_counter = 0; } static void reset_group_my_grp2(struct my_args_info *args_info) { if (! args_info->my_grp2_group_counter) return; args_info->optc_given = 0 ; args_info->optd_given = 0 ; args_info->my_grp2_group_counter = 0; } int test_conf_parser_cmd_parser (int argc, char **argv, struct my_args_info *args_info) { return test_conf_parser_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_conf_parser_cmd_parser_ext (int argc, char **argv, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params) { int result; result = test_conf_parser_cmd_parser_internal (argc, argv, args_info, params, 0); return result; } int test_conf_parser_cmd_parser2 (int argc, char **argv, struct my_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_conf_parser_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_conf_parser_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); return result; } int test_conf_parser_cmd_parser_required (struct my_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_conf_parser_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; return result; } int test_conf_parser_cmd_parser_required2 (struct my_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->required_given) { fprintf (stderr, "%s: '--required' ('-r') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } if (check_multiple_option_occurrences(prog_name, args_info->multi_string_given, args_info->multi_string_min, args_info->multi_string_max, "'--multi-string' ('-M')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->multi_string_def_given, args_info->multi_string_def_min, args_info->multi_string_def_max, "'--multi-string-def'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->noarg_given, args_info->noarg_min, args_info->noarg_max, "'--noarg' ('-n')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->noarg_noshort_given, args_info->noarg_noshort_min, args_info->noarg_noshort_max, "'--noarg-noshort'")) error_occurred = 1; if (args_info->grp1_group_counter == 0) { fprintf (stderr, "%s: %d options of group grp1 were given. One is required%s.\n", prog_name, args_info->grp1_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_conf_parser_cmd_parser_params.check_ambiguity * @param override @see test_conf_parser_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_conf_parser_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_SHORT: if (val) *((short *)field) = (short)strtol (val, &stop_char, 0); break; case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; case ARG_DOUBLE: if (val) *((double *)field) = strtod (val, &stop_char); break; case ARG_LONGDOUBLE: if (val) *((long double *)field) = (long double)strtod (val, &stop_char); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0); #else if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); #endif break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_conf_parser_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_conf_parser_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; case ARG_SHORT: *((short **)field) = (short *)realloc (*((short **)field), (field_given + prev_given) * sizeof (short)); break; case ARG_LONG: *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; case ARG_FLOAT: *((float **)field) = (float *)realloc (*((float **)field), (field_given + prev_given) * sizeof (float)); break; case ARG_DOUBLE: *((double **)field) = (double *)realloc (*((double **)field), (field_given + prev_given) * sizeof (double)); break; case ARG_LONGDOUBLE: *((long double **)field) = (long double *)realloc (*((long double **)field), (field_given + prev_given) * sizeof (long double)); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) *((long long int **)field) = (long long int *)realloc (*((long long int **)field), (field_given + prev_given) * sizeof (long long int)); break; #else *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; #endif case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_SHORT: (*((short **)field))[i + field_given] = tmp->arg.short_arg; break; case ARG_LONG: (*((long **)field))[i + field_given] = tmp->arg.long_arg; break; case ARG_FLOAT: (*((float **)field))[i + field_given] = tmp->arg.float_arg; break; case ARG_DOUBLE: (*((double **)field))[i + field_given] = tmp->arg.double_arg; break; case ARG_LONGDOUBLE: (*((long double **)field))[i + field_given] = tmp->arg.longdouble_arg; break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) (*((long long int **)field))[i + field_given] = tmp->arg.longlong_arg; break; #else (*((long **)field))[i + field_given] = tmp->arg.longlong_arg; break; #endif case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; case ARG_SHORT: if (! *((short **)field)) { *((short **)field) = (short *)malloc (sizeof (short)); (*((short **)field))[0] = default_value->short_arg; } break; case ARG_LONG: if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->long_arg; } break; case ARG_FLOAT: if (! *((float **)field)) { *((float **)field) = (float *)malloc (sizeof (float)); (*((float **)field))[0] = default_value->float_arg; } break; case ARG_DOUBLE: if (! *((double **)field)) { *((double **)field) = (double *)malloc (sizeof (double)); (*((double **)field))[0] = default_value->double_arg; } break; case ARG_LONGDOUBLE: if (! *((long double **)field)) { *((long double **)field) = (long double *)malloc (sizeof (long double)); (*((long double **)field))[0] = default_value->longdouble_arg; } break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (! *((long long int **)field)) { *((long long int **)field) = (long long int *)malloc (sizeof (long long int)); (*((long long int **)field))[0] = default_value->longlong_arg; } #else if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->longlong_arg; } #endif break; case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_conf_parser_cmd_parser_internal ( int argc, char **argv, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ union generic_value multiple_default_value; struct generic_list * multi_string_list = NULL; struct generic_list * multi_string_def_list = NULL; int error_occurred = 0; struct my_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_conf_parser_cmd_parser_init (args_info); test_conf_parser_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "opta", 1, NULL, 'a' }, { "optb", 1, NULL, 'b' }, { "optc", 0, NULL, 0 }, { "optd", 0, NULL, 'C' }, { "string", 1, NULL, 's' }, { "int", 1, NULL, 'i' }, { "short", 1, NULL, 'S' }, { "long", 1, NULL, 'l' }, { "float", 1, NULL, 'f' }, { "double", 1, NULL, 'd' }, { "longdouble", 1, NULL, 'D' }, { "longlong", 1, NULL, 'L' }, { "flag", 0, NULL, 'F' }, { "function", 0, NULL, 'u' }, { "no-short", 0, NULL, 0 }, { "required", 1, NULL, 'r' }, { "conf-file", 1, NULL, 'c' }, { "multi-string", 1, NULL, 'M' }, { "multi-string-def", 1, NULL, 0 }, { "noarg", 0, NULL, 'n' }, { "noarg-noshort", 0, NULL, 0 }, { "opt-arg", 2, NULL, 0 }, { "file-save", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVa:b:Cs:i:S:l:f:d:D:L:Fur:c:M:n", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_conf_parser_cmd_parser_print_help (); test_conf_parser_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_conf_parser_cmd_parser_print_version (); test_conf_parser_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'a': /* string a. */ if (args_info->grp1_group_counter && override) reset_group_grp1 (args_info); args_info->grp1_group_counter += 1; if (update_arg( (void *)&(args_info->opta_arg), &(args_info->opta_orig), &(args_info->opta_given), &(local_args_info.opta_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "opta", 'a', additional_error)) goto failure; break; case 'b': /* string b. */ if (args_info->grp1_group_counter && override) reset_group_grp1 (args_info); args_info->grp1_group_counter += 1; if (update_arg( (void *)&(args_info->optb_arg), &(args_info->optb_orig), &(args_info->optb_given), &(local_args_info.optb_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "optb", 'b', additional_error)) goto failure; break; case 'C': /* string d. */ if (args_info->my_grp2_group_counter && override) reset_group_my_grp2 (args_info); args_info->my_grp2_group_counter += 1; if (update_arg( 0 , 0 , &(args_info->optd_given), &(local_args_info.optd_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optd", 'C', additional_error)) goto failure; break; case 's': /* string option. */ if (update_arg( (void *)&(args_info->string_arg), &(args_info->string_orig), &(args_info->string_given), &(local_args_info.string_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string", 's', additional_error)) goto failure; break; case 'i': /* int option. */ if (update_arg( (void *)&(args_info->int_arg), &(args_info->int_orig), &(args_info->int_given), &(local_args_info.int_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "int", 'i', additional_error)) goto failure; break; case 'S': /* short option. */ if (update_arg( (void *)&(args_info->short_arg), &(args_info->short_orig), &(args_info->short_given), &(local_args_info.short_given), optarg, 0, 0, ARG_SHORT, check_ambiguity, override, 0, 0, "short", 'S', additional_error)) goto failure; break; case 'l': /* long option. */ if (update_arg( (void *)&(args_info->long_arg), &(args_info->long_orig), &(args_info->long_given), &(local_args_info.long_given), optarg, 0, 0, ARG_LONG, check_ambiguity, override, 0, 0, "long", 'l', additional_error)) goto failure; break; case 'f': /* float option. */ if (update_arg( (void *)&(args_info->float_arg), &(args_info->float_orig), &(args_info->float_given), &(local_args_info.float_given), optarg, 0, 0, ARG_FLOAT, check_ambiguity, override, 0, 0, "float", 'f', additional_error)) goto failure; break; case 'd': /* double option. */ if (update_arg( (void *)&(args_info->double_arg), &(args_info->double_orig), &(args_info->double_given), &(local_args_info.double_given), optarg, 0, 0, ARG_DOUBLE, check_ambiguity, override, 0, 0, "double", 'd', additional_error)) goto failure; break; case 'D': /* longdouble option. */ if (update_arg( (void *)&(args_info->longdouble_arg), &(args_info->longdouble_orig), &(args_info->longdouble_given), &(local_args_info.longdouble_given), optarg, 0, 0, ARG_LONGDOUBLE, check_ambiguity, override, 0, 0, "longdouble", 'D', additional_error)) goto failure; break; case 'L': /* longlong option. */ if (update_arg( (void *)&(args_info->longlong_arg), &(args_info->longlong_orig), &(args_info->longlong_given), &(local_args_info.longlong_given), optarg, 0, 0, ARG_LONGLONG, check_ambiguity, override, 0, 0, "longlong", 'L', additional_error)) goto failure; break; case 'F': /* flag option. */ if (update_arg((void *)&(args_info->flag_flag), 0, &(args_info->flag_given), &(local_args_info.flag_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "flag", 'F', additional_error)) goto failure; break; case 'u': /* function option. */ if (update_arg( 0 , 0 , &(args_info->function_given), &(local_args_info.function_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "function", 'u', additional_error)) goto failure; break; case 'r': /* required option. */ if (update_arg( (void *)&(args_info->required_arg), &(args_info->required_orig), &(args_info->required_given), &(local_args_info.required_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "required", 'r', additional_error)) goto failure; break; case 'c': /* config file. */ if (update_arg( (void *)&(args_info->conf_file_arg), &(args_info->conf_file_orig), &(args_info->conf_file_given), &(local_args_info.conf_file_given), optarg, 0, "test_conf.conf", ARG_STRING, check_ambiguity, override, 0, 0, "conf-file", 'c', additional_error)) goto failure; break; case 'M': /* multiple string option. */ if (update_multiple_arg_temp(&multi_string_list, &(local_args_info.multi_string_given), optarg, 0, 0, ARG_STRING, "multi-string", 'M', additional_error)) goto failure; break; case 'n': /* multiple option with no arg. */ local_args_info.noarg_given++; break; case 0: /* Long option with no short option */ /* string c. */ if (strcmp (long_options[option_index].name, "optc") == 0) { if (args_info->my_grp2_group_counter && override) reset_group_my_grp2 (args_info); args_info->my_grp2_group_counter += 1; if (update_arg( 0 , 0 , &(args_info->optc_given), &(local_args_info.optc_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optc", '-', additional_error)) goto failure; } /* no short option. */ else if (strcmp (long_options[option_index].name, "no-short") == 0) { if (update_arg( 0 , 0 , &(args_info->no_short_given), &(local_args_info.no_short_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-short", '-', additional_error)) goto failure; } /* multiple string option with default. */ else if (strcmp (long_options[option_index].name, "multi-string-def") == 0) { if (update_multiple_arg_temp(&multi_string_def_list, &(local_args_info.multi_string_def_given), optarg, 0, "this default", ARG_STRING, "multi-string-def", '-', additional_error)) goto failure; } /* multiple option with no arg and no short. */ else if (strcmp (long_options[option_index].name, "noarg-noshort") == 0) { local_args_info.noarg_noshort_given++; } /* option with optional arg. */ else if (strcmp (long_options[option_index].name, "opt-arg") == 0) { if (update_arg( (void *)&(args_info->opt_arg_arg), &(args_info->opt_arg_orig), &(args_info->opt_arg_given), &(local_args_info.opt_arg_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "opt-arg", '-', additional_error)) goto failure; } /* save the passed options into a file. */ else if (strcmp (long_options[option_index].name, "file-save") == 0) { if (update_arg( (void *)&(args_info->file_save_arg), &(args_info->file_save_orig), &(args_info->file_save_given), &(local_args_info.file_save_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "file-save", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (args_info->grp1_group_counter > 1) { fprintf (stderr, "%s: %d options of group grp1 were given. One is required%s.\n", argv[0], args_info->grp1_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } if (args_info->my_grp2_group_counter > 1) { fprintf (stderr, "%s: %d options of group my grp2 were given. At most one is required%s.\n", argv[0], args_info->my_grp2_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } update_multiple_arg((void *)&(args_info->multi_string_arg), &(args_info->multi_string_orig), args_info->multi_string_given, local_args_info.multi_string_given, 0, ARG_STRING, multi_string_list); multiple_default_value.default_string_arg = "this default"; update_multiple_arg((void *)&(args_info->multi_string_def_arg), &(args_info->multi_string_def_orig), args_info->multi_string_def_given, local_args_info.multi_string_def_given, &multiple_default_value, ARG_STRING, multi_string_def_list); args_info->multi_string_given += local_args_info.multi_string_given; local_args_info.multi_string_given = 0; args_info->multi_string_def_given += local_args_info.multi_string_def_given; local_args_info.multi_string_def_given = 0; args_info->noarg_given += local_args_info.noarg_given; local_args_info.noarg_given = 0; args_info->noarg_noshort_given += local_args_info.noarg_noshort_given; local_args_info.noarg_noshort_given = 0; if (check_required) { error_occurred += test_conf_parser_cmd_parser_required2 (args_info, argv[0], additional_error); } test_conf_parser_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (multi_string_list, 1 ); free_list (multi_string_def_list, 1 ); test_conf_parser_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } #ifndef CONFIG_FILE_LINE_SIZE #define CONFIG_FILE_LINE_SIZE 2048 #endif #define ADDITIONAL_ERROR " in configuration file " #define CONFIG_FILE_LINE_BUFFER_SIZE (CONFIG_FILE_LINE_SIZE+3) /* 3 is for "--" and "=" */ static int _test_conf_parser_cmd_parser_configfile (const char *filename, int *my_argc) { FILE* file; char my_argv[CONFIG_FILE_LINE_BUFFER_SIZE+1]; char linebuf[CONFIG_FILE_LINE_SIZE]; int line_num = 0; int result = 0, equal; char *fopt, *farg; char *str_index; size_t len, next_token; char delimiter; if ((file = fopen(filename, "r")) == 0) { fprintf (stderr, "%s: Error opening configuration file '%s'\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != 0) { ++line_num; my_argv[0] = '\0'; len = strlen(linebuf); if (len > (CONFIG_FILE_LINE_BUFFER_SIZE-1)) { fprintf (stderr, "%s:%s:%d: Line too long in configuration file\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename, line_num); result = EXIT_FAILURE; break; } /* find first non-whitespace character in the line */ next_token = strspn (linebuf, " \t\r\n"); str_index = linebuf + next_token; if ( str_index[0] == '\0' || str_index[0] == '#') continue; /* empty line or comment line is skipped */ fopt = str_index; /* truncate fopt at the end of the first non-valid character */ next_token = strcspn (fopt, " \t\r\n="); if (fopt[next_token] == '\0') /* the line is over */ { farg = 0; equal = 0; goto noarg; } /* remember if equal sign is present */ equal = (fopt[next_token] == '='); fopt[next_token++] = '\0'; /* advance pointers to the next token after the end of fopt */ next_token += strspn (fopt + next_token, " \t\r\n"); /* check for the presence of equal sign, and if so, skip it */ if ( !equal ) if ((equal = (fopt[next_token] == '='))) { next_token++; next_token += strspn (fopt + next_token, " \t\r\n"); } str_index += next_token; /* find argument */ farg = str_index; if ( farg[0] == '\"' || farg[0] == '\'' ) { /* quoted argument */ str_index = strchr (++farg, str_index[0] ); /* skip opening quote */ if (! str_index) { fprintf (stderr, "%s:%s:%d: unterminated string in configuration file\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename, line_num); result = EXIT_FAILURE; break; } } else { /* read up the remaining part up to a delimiter */ next_token = strcspn (farg, " \t\r\n#\'\""); str_index += next_token; } /* truncate farg at the delimiter and store it for further check */ delimiter = *str_index, *str_index++ = '\0'; /* everything but comment is illegal at the end of line */ if (delimiter != '\0' && delimiter != '#') { str_index += strspn(str_index, " \t\r\n"); if (*str_index != '\0' && *str_index != '#') { fprintf (stderr, "%s:%s:%d: malformed string in configuration file\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename, line_num); result = EXIT_FAILURE; break; } } noarg: if (!strcmp(fopt,"include")) { if (farg && *farg) { result = _test_conf_parser_cmd_parser_configfile(farg, my_argc); } else { fprintf(stderr, "%s:%s:%d: include requires a filename argument.\n", TEST_CONF_PARSER_CMD_PARSER_PACKAGE, filename, line_num); } continue; } len = strlen(fopt); strcat (my_argv, len > 1 ? "--" : "-"); strcat (my_argv, fopt); if (len > 1 && ((farg && *farg) || equal)) strcat (my_argv, "="); if (farg && *farg) strcat (my_argv, farg); ++(*my_argc); cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup(my_argv); } /* while */ if (file) fclose(file); return result; } int test_conf_parser_cmd_parser_configfile ( const char *filename, struct my_args_info *args_info, int override, int initialize, int check_required) { struct test_conf_parser_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return test_conf_parser_cmd_parser_config_file (filename, args_info, ¶ms); } int test_conf_parser_cmd_parser_config_file (const char *filename, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params) { int i, result; int my_argc = 1; char **my_argv_arg; char *additional_error; /* store the program name */ cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (TEST_CONF_PARSER_CMD_PARSER_PACKAGE); result = _test_conf_parser_cmd_parser_configfile(filename, &my_argc); if (result != EXIT_FAILURE) { my_argv_arg = (char **) malloc((my_argc+1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = my_argc - 1; i >= 0; --i) { my_argv_arg[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } my_argv_arg[my_argc] = 0; additional_error = (char *)malloc(strlen(filename) + strlen(ADDITIONAL_ERROR) + 1); strcpy (additional_error, ADDITIONAL_ERROR); strcat (additional_error, filename); result = test_conf_parser_cmd_parser_internal (my_argc, my_argv_arg, args_info, params, additional_error); free (additional_error); free (my_argv_arg); } free_cmd_list(); return result; } gengetopt-2.22.6/tests/test_conf_parser_cmd.h.test0000664000175000017500000003473612045003074017206 00000000000000/** @file test_conf_parser_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_CONF_PARSER_CMD_H #define TEST_CONF_PARSER_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_CONF_PARSER_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_CONF_PARSER_CMD_PARSER_PACKAGE "test_conf_parser" #endif #ifndef TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME "test_conf_parser" #endif #ifndef TEST_CONF_PARSER_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_CONF_PARSER_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct my_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * opta_arg; /**< @brief string a. */ char * opta_orig; /**< @brief string a original value given at command line. */ const char *opta_help; /**< @brief string a help description. */ char * optb_arg; /**< @brief string b. */ char * optb_orig; /**< @brief string b original value given at command line. */ const char *optb_help; /**< @brief string b help description. */ const char *optc_help; /**< @brief string c help description. */ const char *optd_help; /**< @brief string d help description. */ char * string_arg; /**< @brief string option. */ char * string_orig; /**< @brief string option original value given at command line. */ const char *string_help; /**< @brief string option help description. */ int int_arg; /**< @brief int option. */ char * int_orig; /**< @brief int option original value given at command line. */ const char *int_help; /**< @brief int option help description. */ short short_arg; /**< @brief short option. */ char * short_orig; /**< @brief short option original value given at command line. */ const char *short_help; /**< @brief short option help description. */ long long_arg; /**< @brief long option. */ char * long_orig; /**< @brief long option original value given at command line. */ const char *long_help; /**< @brief long option help description. */ float float_arg; /**< @brief float option. */ char * float_orig; /**< @brief float option original value given at command line. */ const char *float_help; /**< @brief float option help description. */ double double_arg; /**< @brief double option. */ char * double_orig; /**< @brief double option original value given at command line. */ const char *double_help; /**< @brief double option help description. */ long double longdouble_arg; /**< @brief longdouble option. */ char * longdouble_orig; /**< @brief longdouble option original value given at command line. */ const char *longdouble_help; /**< @brief longdouble option help description. */ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; /**< @brief longlong option. */ #else long longlong_arg; /**< @brief longlong option. */ #endif char * longlong_orig; /**< @brief longlong option original value given at command line. */ const char *longlong_help; /**< @brief longlong option help description. */ int flag_flag; /**< @brief flag option (default=on). */ const char *flag_help; /**< @brief flag option help description. */ const char *function_help; /**< @brief function option help description. */ const char *no_short_help; /**< @brief no short option help description. */ char * required_arg; /**< @brief required option. */ char * required_orig; /**< @brief required option original value given at command line. */ const char *required_help; /**< @brief required option help description. */ char * conf_file_arg; /**< @brief config file (default='test_conf.conf'). */ char * conf_file_orig; /**< @brief config file original value given at command line. */ const char *conf_file_help; /**< @brief config file help description. */ char ** multi_string_arg; /**< @brief multiple string option. */ char ** multi_string_orig; /**< @brief multiple string option original value given at command line. */ unsigned int multi_string_min; /**< @brief multiple string option's minimum occurreces */ unsigned int multi_string_max; /**< @brief multiple string option's maximum occurreces */ const char *multi_string_help; /**< @brief multiple string option help description. */ char ** multi_string_def_arg; /**< @brief multiple string option with default (default='this default'). */ char ** multi_string_def_orig; /**< @brief multiple string option with default original value given at command line. */ unsigned int multi_string_def_min; /**< @brief multiple string option with default's minimum occurreces */ unsigned int multi_string_def_max; /**< @brief multiple string option with default's maximum occurreces */ const char *multi_string_def_help; /**< @brief multiple string option with default help description. */ unsigned int noarg_min; /**< @brief multiple option with no arg's minimum occurreces */ unsigned int noarg_max; /**< @brief multiple option with no arg's maximum occurreces */ const char *noarg_help; /**< @brief multiple option with no arg help description. */ unsigned int noarg_noshort_min; /**< @brief multiple option with no arg and no short's minimum occurreces */ unsigned int noarg_noshort_max; /**< @brief multiple option with no arg and no short's maximum occurreces */ const char *noarg_noshort_help; /**< @brief multiple option with no arg and no short help description. */ char * opt_arg_arg; /**< @brief option with optional arg. */ char * opt_arg_orig; /**< @brief option with optional arg original value given at command line. */ const char *opt_arg_help; /**< @brief option with optional arg help description. */ char * file_save_arg; /**< @brief save the passed options into a file. */ char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */ const char *file_save_help; /**< @brief save the passed options into a file help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int opta_given ; /**< @brief Whether opta was given. */ unsigned int optb_given ; /**< @brief Whether optb was given. */ unsigned int optc_given ; /**< @brief Whether optc was given. */ unsigned int optd_given ; /**< @brief Whether optd was given. */ unsigned int string_given ; /**< @brief Whether string was given. */ unsigned int int_given ; /**< @brief Whether int was given. */ unsigned int short_given ; /**< @brief Whether short was given. */ unsigned int long_given ; /**< @brief Whether long was given. */ unsigned int float_given ; /**< @brief Whether float was given. */ unsigned int double_given ; /**< @brief Whether double was given. */ unsigned int longdouble_given ; /**< @brief Whether longdouble was given. */ unsigned int longlong_given ; /**< @brief Whether longlong was given. */ unsigned int flag_given ; /**< @brief Whether flag was given. */ unsigned int function_given ; /**< @brief Whether function was given. */ unsigned int no_short_given ; /**< @brief Whether no-short was given. */ unsigned int required_given ; /**< @brief Whether required was given. */ unsigned int conf_file_given ; /**< @brief Whether conf-file was given. */ unsigned int multi_string_given ; /**< @brief Whether multi-string was given. */ unsigned int multi_string_def_given ; /**< @brief Whether multi-string-def was given. */ unsigned int noarg_given ; /**< @brief Whether noarg was given. */ unsigned int noarg_noshort_given ; /**< @brief Whether noarg-noshort was given. */ unsigned int opt_arg_given ; /**< @brief Whether opt-arg was given. */ unsigned int file_save_given ; /**< @brief Whether file-save was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int grp1_group_counter; /**< @brief Counter for group grp1 */ int my_grp2_group_counter; /**< @brief Counter for group my_grp2 */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_conf_parser_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure my_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure my_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *my_args_info_purpose; /** @brief the usage string of the program */ extern const char *my_args_info_usage; /** @brief the description string of the program */ extern const char *my_args_info_description; /** @brief all the lines making the help output */ extern const char *my_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser (int argc, char **argv, struct my_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_conf_parser_cmd_parser_ext() instead */ int test_conf_parser_cmd_parser2 (int argc, char **argv, struct my_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_ext (int argc, char **argv, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_dump(FILE *outfile, struct my_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_file_save(const char *filename, struct my_args_info *args_info); /** * Print the help */ void test_conf_parser_cmd_parser_print_help(void); /** * Print the version */ void test_conf_parser_cmd_parser_print_version(void); /** * Initializes all the fields a test_conf_parser_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_conf_parser_cmd_parser_params_init(struct test_conf_parser_cmd_parser_params *params); /** * Allocates dynamically a test_conf_parser_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_conf_parser_cmd_parser_params structure */ struct test_conf_parser_cmd_parser_params *test_conf_parser_cmd_parser_params_create(void); /** * Initializes the passed my_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_conf_parser_cmd_parser_init (struct my_args_info *args_info); /** * Deallocates the string fields of the my_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_conf_parser_cmd_parser_free (struct my_args_info *args_info); /** * The config file parser (deprecated version) * @param filename the name of the config file * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_conf_parser_cmd_parser_config_file() instead */ int test_conf_parser_cmd_parser_configfile (const char *filename, struct my_args_info *args_info, int override, int initialize, int check_required); /** * The config file parser * @param filename the name of the config file * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_config_file (const char *filename, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_conf_parser_cmd_parser_required (struct my_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_CONF_PARSER_CMD_H */ gengetopt-2.22.6/tests/test_groups.sh.in0000664000175000017500000000122012044745036015203 00000000000000#! @SHELL@ if $* ./test_groups; then false; else if $* ./test_groups -a; then if $* ./test_groups -a -b; then false; else if $* ./test_groups --optc -d; then false; else if $* ./test_groups -a -a; then if $* ./test_groups -A; then if $* ./test_groups -Afoo; then if $* ./test_groups -Mfoo,bar -M -Maaa; then true; else false; fi else false; fi else false; fi else false; fi fi fi else false; fi fi gengetopt-2.22.6/tests/test_show_help.sh.in0000664000175000017500000000077612044745036015673 00000000000000#! @SHELL@ # the next program must not exit with error if $* ../src/gengetopt@EXEEXT@ --show-help -i @srcdir@/test_all_opts_cmd.ggo ; then if $* ../src/gengetopt@EXEEXT@ --show-version -i @srcdir@/test_all_opts_cmd.ggo ; then if $* ../src/gengetopt@EXEEXT@ --show-help -i @srcdir@/test_values_cmd.ggo ; then true; else false; fi else false; fi else false; fi gengetopt-2.22.6/tests/test_conf.conf.in0000664000175000017500000000042012044745036015125 00000000000000 # the # may not be the first char in a line # required option required "this is a test" float = 3.14 no-short multi-string="first" string another # multiple options M "second" include "test_conf_inc.conf" n include "@srcdir@/test_conf_inc2.conf" noarg-noshortgengetopt-2.22.6/tests/test_conf_inc_inc.conf0000664000175000017500000000001612044745036016203 00000000000000noarg-noshort gengetopt-2.22.6/tests/test_simple_multiple_cmd.h.test0000664000175000017500000001611612045003074020101 00000000000000/** @file test_simple_multiple_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_SIMPLE_MULTIPLE_CMD_H #define TEST_SIMPLE_MULTIPLE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE "test_simple_multiple" #endif #ifndef TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE_NAME "test_simple_multiple" #endif #ifndef TEST_SIMPLE_MULTIPLE_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_SIMPLE_MULTIPLE_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char ** string_arg; /**< @brief string option (default='foo'). */ char ** string_orig; /**< @brief string option original value given at command line. */ unsigned int string_min; /**< @brief string option's minimum occurreces */ unsigned int string_max; /**< @brief string option's maximum occurreces */ const char *string_help; /**< @brief string option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int string_given ; /**< @brief Whether string was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_simple_multiple_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_simple_multiple_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_simple_multiple_cmd_parser_ext() instead */ int test_simple_multiple_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_simple_multiple_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_simple_multiple_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_simple_multiple_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_simple_multiple_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_simple_multiple_cmd_parser_print_help(void); /** * Print the version */ void test_simple_multiple_cmd_parser_print_version(void); /** * Initializes all the fields a test_simple_multiple_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_simple_multiple_cmd_parser_params_init(struct test_simple_multiple_cmd_parser_params *params); /** * Allocates dynamically a test_simple_multiple_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_simple_multiple_cmd_parser_params structure */ struct test_simple_multiple_cmd_parser_params *test_simple_multiple_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_simple_multiple_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_simple_multiple_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_simple_multiple_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_SIMPLE_MULTIPLE_CMD_H */ gengetopt-2.22.6/tests/test_values.sh.in0000664000175000017500000000070312044745036015170 00000000000000#! @SHELL@ # test values for options $* ./test_values -s foob -S foo --string-values-no-short bar --multistring-values-no-short "foo" -S b --multistring-values-no-short "foo","bar" -S bar,foo --multistring-values-no-short "bar" --multistring-values-no-short "bar","foo" --string-values-def-argopt --multistring-values-def="bar" --multistring-values-def -I 1 -i 1 -WFI -I27 -WS,T,FOURTH --file-save="test_values.save" --values-first-enums-plus="-foo"gengetopt-2.22.6/tests/test_values_err.sh.in0000664000175000017500000000046712044745036016047 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_values -s fo ; then false; else if $* ./test_values -S fooa ; then false; else if $* ./test_values --string-values-no-short fooa ; then false; else if $* ./test_values --multistring-values-no-short bar,fooa ; then false; else true; fi fi fi fi gengetopt-2.22.6/tests/wrong_multiple_occurrence.ggo0000664000175000017500000000044012044745036017644 00000000000000# wrong specification in multiple option number occurrences option "limited-interval" - "limited multiple option (with interval)" string optional multiple(1-3) # OK option "big-limited-interval" - "limited multiple option (with interval)" string optional multiple(-1-30) # WRONG gengetopt-2.22.6/tests/test_values_cmd.c.test0000664000175000017500000015543012045003074016172 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_values_cmd.ggo --func-name=test_values_cmd_parser --file-name=test_values_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_values_cmd.h" const char *gengetopt_args_info_purpose = "This is just a test file\nto test options\nwith the list of acceptable values"; const char *gengetopt_args_info_usage = "Usage: test_values [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -s, --string-values=STRING string option with values (possible\n values=\"foo\", \"foa\", \"bar\", \"foobar\",\n \"barfoo\")", " --string-values-plus=STRING\n string option with values containing + and -\n (possible values=\"+foo\", \"-foo\", \"bar\",\n \"foobar\", \"barfoo\", \"+foobar\",\n \"-barfoo\")", " --string-values-def=STRING\n string option with values and default\n (possible values=\"foo\", \"bar\",\n \"foobar\", \"barfoo\" default=`bar')", " --string-values-def-argopt[=STRING]\n string option with values and default and\n optional argument (possible values=\"foo\",\n \"bar\", \"foobar\", \"barfoo\"\n default=`foobar')", " --string-values-no-short=STRING\n string option with values no short (possible\n values=\"foo\", \"bar\", \"foobar\",\n \"barfoo\")", " -S, --multistring-values=STRING\n multiple string option with values (possible\n values=\"foo\", \"bar\")", " --multistring-values-def[=STRING]\n multiple string option with values and default\n (possible values=\"foo\", \"bar\"\n default=`foo')", " --multistring-values-no-short=BAR\n multiple string option with values no-short\n (possible values=\"foo\", \"bar\")", "\n Group: group1", " --string-values-group=FOO group string option with values and default\n (possible values=\"foo\", \"bar\",\n \"foobar\", \"barfoo\" default=`bar')", " -i, --int-values=INT int option with values (possible\n values=\"90\", \"180\", \"270\", \"360\")", " -I, --int-values-m=INT multiple int option with values (possible\n values=\"900\", \"1800\", \"2700\", \"3600\")", " --int-values-def=INT int option with values and default (possible\n values=\"90\", \"180\", \"270\", \"360\"\n default=`180')", " -e, --values-first-enums=ENUM option with values and enums 1 (possible\n values=\"FOO\", \"BAR\", \"ANOTHER\",\n \"SOMETHING\")", " -E, --values-first-enums-plus=ENUM\n option with values and enums with plus and\n minus 1 (possible values=\"+foo\", \"+bar\",\n \"-foo\", \"-bar\", \"all\")", " --values-second-enums=ENUM\n option with values and enums 2 with default\n (possible values=\"90\", \"180\", \"270\",\n \"360\" default=`180')", " -W, --values-multiple-enums=ENUM\n multiple option with values and enums\n (possible values=\"FIRST\", \"SECOND\",\n \"THIRD\", \"FOURTH\" default=`FOURTH')", " -N, --values-unspecified-enums=ENUM\n option with values that will not be specified\n on the command line (possible\n values=\"FOO\", \"BAR\", \"ANOTHER\",\n \"SOMETHING\")", " --file-save=STRING save the passed options into a file", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT , ARG_ENUM } test_values_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_values_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_values_cmd_parser_params *params, const char *additional_error); static int test_values_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); const char *test_values_cmd_parser_string_values_values[] = {"foo", "foa", "bar", "foobar", "barfoo", 0}; /*< Possible values for string-values. */ const char *test_values_cmd_parser_string_values_plus_values[] = {"+foo", "-foo", "bar", "foobar", "barfoo", "+foobar", "-barfoo", 0}; /*< Possible values for string-values-plus. */ const char *test_values_cmd_parser_string_values_def_values[] = {"foo", "bar", "foobar", "barfoo", 0}; /*< Possible values for string-values-def. */ const char *test_values_cmd_parser_string_values_def_argopt_values[] = {"foo", "bar", "foobar", "barfoo", 0}; /*< Possible values for string-values-def-argopt. */ const char *test_values_cmd_parser_string_values_no_short_values[] = {"foo", "bar", "foobar", "barfoo", 0}; /*< Possible values for string-values-no-short. */ const char *test_values_cmd_parser_multistring_values_values[] = {"foo", "bar", 0}; /*< Possible values for multistring-values. */ const char *test_values_cmd_parser_multistring_values_def_values[] = {"foo", "bar", 0}; /*< Possible values for multistring-values-def. */ const char *test_values_cmd_parser_multistring_values_no_short_values[] = {"foo", "bar", 0}; /*< Possible values for multistring-values-no-short. */ const char *test_values_cmd_parser_string_values_group_values[] = {"foo", "bar", "foobar", "barfoo", 0}; /*< Possible values for string-values-group. */ const char *test_values_cmd_parser_int_values_values[] = {"90", "180", "270", "360", 0}; /*< Possible values for int-values. */ const char *test_values_cmd_parser_int_values_m_values[] = {"900", "1800", "2700", "3600", 0}; /*< Possible values for int-values-m. */ const char *test_values_cmd_parser_int_values_def_values[] = {"90", "180", "270", "360", 0}; /*< Possible values for int-values-def. */ const char *test_values_cmd_parser_values_first_enums_values[] = {"FOO", "BAR", "ANOTHER", "SOMETHING", 0}; /*< Possible values for values-first-enums. */ const char *test_values_cmd_parser_values_first_enums_plus_values[] = {"+foo", "+bar", "-foo", "-bar", "all", 0}; /*< Possible values for values-first-enums-plus. */ const char *test_values_cmd_parser_values_second_enums_values[] = {"90", "180", "270", "360", 0}; /*< Possible values for values-second-enums. */ const char *test_values_cmd_parser_values_multiple_enums_values[] = {"FIRST", "SECOND", "THIRD", "FOURTH", 0}; /*< Possible values for values-multiple-enums. */ const char *test_values_cmd_parser_values_unspecified_enums_values[] = {"FOO", "BAR", "ANOTHER", "SOMETHING", 0}; /*< Possible values for values-unspecified-enums. */ static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->string_values_given = 0 ; args_info->string_values_plus_given = 0 ; args_info->string_values_def_given = 0 ; args_info->string_values_def_argopt_given = 0 ; args_info->string_values_no_short_given = 0 ; args_info->multistring_values_given = 0 ; args_info->multistring_values_def_given = 0 ; args_info->multistring_values_no_short_given = 0 ; args_info->string_values_group_given = 0 ; args_info->int_values_given = 0 ; args_info->int_values_m_given = 0 ; args_info->int_values_def_given = 0 ; args_info->values_first_enums_given = 0 ; args_info->values_first_enums_plus_given = 0 ; args_info->values_second_enums_given = 0 ; args_info->values_multiple_enums_given = 0 ; args_info->values_unspecified_enums_given = 0 ; args_info->file_save_given = 0 ; args_info->group1_group_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->string_values_arg = NULL; args_info->string_values_orig = NULL; args_info->string_values_plus_arg = NULL; args_info->string_values_plus_orig = NULL; args_info->string_values_def_arg = gengetopt_strdup ("bar"); args_info->string_values_def_orig = NULL; args_info->string_values_def_argopt_arg = gengetopt_strdup ("foobar"); args_info->string_values_def_argopt_orig = NULL; args_info->string_values_no_short_arg = NULL; args_info->string_values_no_short_orig = NULL; args_info->multistring_values_arg = NULL; args_info->multistring_values_orig = NULL; args_info->multistring_values_def_arg = NULL; args_info->multistring_values_def_orig = NULL; args_info->multistring_values_no_short_arg = NULL; args_info->multistring_values_no_short_orig = NULL; args_info->string_values_group_arg = gengetopt_strdup ("bar"); args_info->string_values_group_orig = NULL; args_info->int_values_orig = NULL; args_info->int_values_m_arg = NULL; args_info->int_values_m_orig = NULL; args_info->int_values_def_arg = 180; args_info->int_values_def_orig = NULL; args_info->values_first_enums_arg = values_first_enums__NULL; args_info->values_first_enums_orig = NULL; args_info->values_first_enums_plus_arg = values_first_enums_plus__NULL; args_info->values_first_enums_plus_orig = NULL; args_info->values_second_enums_arg = values_second_enums_arg_180; args_info->values_second_enums_orig = NULL; args_info->values_multiple_enums_arg = NULL; args_info->values_multiple_enums_orig = NULL; args_info->values_unspecified_enums_arg = values_unspecified_enums__NULL; args_info->values_unspecified_enums_orig = NULL; args_info->file_save_arg = NULL; args_info->file_save_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->string_values_help = gengetopt_args_info_help[2] ; args_info->string_values_plus_help = gengetopt_args_info_help[3] ; args_info->string_values_def_help = gengetopt_args_info_help[4] ; args_info->string_values_def_argopt_help = gengetopt_args_info_help[5] ; args_info->string_values_no_short_help = gengetopt_args_info_help[6] ; args_info->multistring_values_help = gengetopt_args_info_help[7] ; args_info->multistring_values_min = 0; args_info->multistring_values_max = 0; args_info->multistring_values_def_help = gengetopt_args_info_help[8] ; args_info->multistring_values_def_min = 0; args_info->multistring_values_def_max = 0; args_info->multistring_values_no_short_help = gengetopt_args_info_help[9] ; args_info->multistring_values_no_short_min = 0; args_info->multistring_values_no_short_max = 0; args_info->string_values_group_help = gengetopt_args_info_help[11] ; args_info->int_values_help = gengetopt_args_info_help[12] ; args_info->int_values_m_help = gengetopt_args_info_help[13] ; args_info->int_values_m_min = 0; args_info->int_values_m_max = 0; args_info->int_values_def_help = gengetopt_args_info_help[14] ; args_info->values_first_enums_help = gengetopt_args_info_help[15] ; args_info->values_first_enums_plus_help = gengetopt_args_info_help[16] ; args_info->values_second_enums_help = gengetopt_args_info_help[17] ; args_info->values_multiple_enums_help = gengetopt_args_info_help[18] ; args_info->values_multiple_enums_min = 0; args_info->values_multiple_enums_max = 0; args_info->values_unspecified_enums_help = gengetopt_args_info_help[19] ; args_info->file_save_help = gengetopt_args_info_help[20] ; } void test_values_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_VALUES_CMD_PARSER_PACKAGE_NAME) ? TEST_VALUES_CMD_PARSER_PACKAGE_NAME : TEST_VALUES_CMD_PARSER_PACKAGE), TEST_VALUES_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_values_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_values_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_values_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_values_cmd_parser_params_init(struct test_values_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_values_cmd_parser_params * test_values_cmd_parser_params_create(void) { struct test_values_cmd_parser_params *params = (struct test_values_cmd_parser_params *)malloc(sizeof(struct test_values_cmd_parser_params)); test_values_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } /** * The passed arg parameter is NOT set to 0 from this function */ static void free_multiple_field(unsigned int len, void *arg, char ***orig) { unsigned int i; if (arg) { for (i = 0; i < len; ++i) { free_string_field(&((*orig)[i])); } free (arg); free (*orig); *orig = 0; } } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_values_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->string_values_arg)); free_string_field (&(args_info->string_values_orig)); free_string_field (&(args_info->string_values_plus_arg)); free_string_field (&(args_info->string_values_plus_orig)); free_string_field (&(args_info->string_values_def_arg)); free_string_field (&(args_info->string_values_def_orig)); free_string_field (&(args_info->string_values_def_argopt_arg)); free_string_field (&(args_info->string_values_def_argopt_orig)); free_string_field (&(args_info->string_values_no_short_arg)); free_string_field (&(args_info->string_values_no_short_orig)); free_multiple_string_field (args_info->multistring_values_given, &(args_info->multistring_values_arg), &(args_info->multistring_values_orig)); free_multiple_string_field (args_info->multistring_values_def_given, &(args_info->multistring_values_def_arg), &(args_info->multistring_values_def_orig)); free_multiple_string_field (args_info->multistring_values_no_short_given, &(args_info->multistring_values_no_short_arg), &(args_info->multistring_values_no_short_orig)); free_string_field (&(args_info->string_values_group_arg)); free_string_field (&(args_info->string_values_group_orig)); free_string_field (&(args_info->int_values_orig)); free_multiple_field (args_info->int_values_m_given, (void *)(args_info->int_values_m_arg), &(args_info->int_values_m_orig)); args_info->int_values_m_arg = 0; free_string_field (&(args_info->int_values_def_orig)); free_string_field (&(args_info->values_first_enums_orig)); free_string_field (&(args_info->values_first_enums_plus_orig)); free_string_field (&(args_info->values_second_enums_orig)); free_multiple_field (args_info->values_multiple_enums_given, (void *)(args_info->values_multiple_enums_arg), &(args_info->values_multiple_enums_orig)); args_info->values_multiple_enums_arg = 0; free_string_field (&(args_info->values_unspecified_enums_orig)); free_string_field (&(args_info->file_save_arg)); free_string_field (&(args_info->file_save_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } /** * @param val the value to check * @param values the possible values * @return the index of the matched value: * -1 if no value matched, * -2 if more than one value has matched */ static int check_possible_values(const char *val, const char *values[]) { int i, found, last; size_t len; if (!val) /* otherwise strlen() crashes below */ return -1; /* -1 means no argument for the option */ found = last = 0; for (i = 0, len = strlen(val); values[i]; ++i) { if (strncmp(val, values[i], len) == 0) { ++found; last = i; if (strlen(values[i]) == len) return i; /* exact macth no need to check more */ } } if (found == 1) /* one match: OK */ return last; return (found ? -2 : -1); /* return many values or none matched */ } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { int found = -1; if (arg) { if (values) { found = check_possible_values(arg, values); } if (found >= 0) fprintf(outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]); else fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_values_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_VALUES_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->string_values_given) write_into_file(outfile, "string-values", args_info->string_values_orig, test_values_cmd_parser_string_values_values); if (args_info->string_values_plus_given) write_into_file(outfile, "string-values-plus", args_info->string_values_plus_orig, test_values_cmd_parser_string_values_plus_values); if (args_info->string_values_def_given) write_into_file(outfile, "string-values-def", args_info->string_values_def_orig, test_values_cmd_parser_string_values_def_values); if (args_info->string_values_def_argopt_given) write_into_file(outfile, "string-values-def-argopt", args_info->string_values_def_argopt_orig, test_values_cmd_parser_string_values_def_argopt_values); if (args_info->string_values_no_short_given) write_into_file(outfile, "string-values-no-short", args_info->string_values_no_short_orig, test_values_cmd_parser_string_values_no_short_values); write_multiple_into_file(outfile, args_info->multistring_values_given, "multistring-values", args_info->multistring_values_orig, test_values_cmd_parser_multistring_values_values); write_multiple_into_file(outfile, args_info->multistring_values_def_given, "multistring-values-def", args_info->multistring_values_def_orig, test_values_cmd_parser_multistring_values_def_values); write_multiple_into_file(outfile, args_info->multistring_values_no_short_given, "multistring-values-no-short", args_info->multistring_values_no_short_orig, test_values_cmd_parser_multistring_values_no_short_values); if (args_info->string_values_group_given) write_into_file(outfile, "string-values-group", args_info->string_values_group_orig, test_values_cmd_parser_string_values_group_values); if (args_info->int_values_given) write_into_file(outfile, "int-values", args_info->int_values_orig, test_values_cmd_parser_int_values_values); write_multiple_into_file(outfile, args_info->int_values_m_given, "int-values-m", args_info->int_values_m_orig, test_values_cmd_parser_int_values_m_values); if (args_info->int_values_def_given) write_into_file(outfile, "int-values-def", args_info->int_values_def_orig, test_values_cmd_parser_int_values_def_values); if (args_info->values_first_enums_given) write_into_file(outfile, "values-first-enums", args_info->values_first_enums_orig, test_values_cmd_parser_values_first_enums_values); if (args_info->values_first_enums_plus_given) write_into_file(outfile, "values-first-enums-plus", args_info->values_first_enums_plus_orig, test_values_cmd_parser_values_first_enums_plus_values); if (args_info->values_second_enums_given) write_into_file(outfile, "values-second-enums", args_info->values_second_enums_orig, test_values_cmd_parser_values_second_enums_values); write_multiple_into_file(outfile, args_info->values_multiple_enums_given, "values-multiple-enums", args_info->values_multiple_enums_orig, test_values_cmd_parser_values_multiple_enums_values); if (args_info->values_unspecified_enums_given) write_into_file(outfile, "values-unspecified-enums", args_info->values_unspecified_enums_orig, test_values_cmd_parser_values_unspecified_enums_values); if (args_info->file_save_given) write_into_file(outfile, "file-save", args_info->file_save_orig, 0); i = EXIT_SUCCESS; return i; } int test_values_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_VALUES_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_values_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_values_cmd_parser_free (struct gengetopt_args_info *args_info) { test_values_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } static void reset_group_group1(struct gengetopt_args_info *args_info) { if (! args_info->group1_group_counter) return; args_info->string_values_group_given = 0 ; free_string_field (&(args_info->string_values_group_arg)); free_string_field (&(args_info->string_values_group_orig)); args_info->group1_group_counter = 0; } int test_values_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_values_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_values_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_values_cmd_parser_params *params) { int result; result = test_values_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_values_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_values_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_values_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_values_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_values_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_values_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_values_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_values_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_values_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->multistring_values_given, args_info->multistring_values_min, args_info->multistring_values_max, "'--multistring-values' ('-S')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->multistring_values_def_given, args_info->multistring_values_def_min, args_info->multistring_values_def_max, "'--multistring-values-def'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->multistring_values_no_short_given, args_info->multistring_values_no_short_min, args_info->multistring_values_no_short_max, "'--multistring-values-no-short'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->int_values_m_given, args_info->int_values_m_min, args_info->int_values_m_max, "'--int-values-m' ('-I')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->values_multiple_enums_given, args_info->values_multiple_enums_min, args_info->values_multiple_enums_max, "'--values-multiple-enums' ('-W')")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_values_cmd_parser_params.check_ambiguity * @param override @see test_values_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_values_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0) { if (short_opt != '-') fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_ENUM: if (val) *((int *)field) = found; break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_values_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_values_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: case ARG_ENUM: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_ENUM: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: case ARG_ENUM: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_values_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_values_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ union generic_value multiple_default_value; struct generic_list * multistring_values_list = NULL; struct generic_list * multistring_values_def_list = NULL; struct generic_list * multistring_values_no_short_list = NULL; struct generic_list * int_values_m_list = NULL; struct generic_list * values_multiple_enums_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_values_cmd_parser_init (args_info); test_values_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "string-values", 1, NULL, 's' }, { "string-values-plus", 1, NULL, 0 }, { "string-values-def", 1, NULL, 0 }, { "string-values-def-argopt", 2, NULL, 0 }, { "string-values-no-short", 1, NULL, 0 }, { "multistring-values", 1, NULL, 'S' }, { "multistring-values-def", 2, NULL, 0 }, { "multistring-values-no-short", 1, NULL, 0 }, { "string-values-group", 1, NULL, 0 }, { "int-values", 1, NULL, 'i' }, { "int-values-m", 1, NULL, 'I' }, { "int-values-def", 1, NULL, 0 }, { "values-first-enums", 1, NULL, 'e' }, { "values-first-enums-plus", 1, NULL, 'E' }, { "values-second-enums", 1, NULL, 0 }, { "values-multiple-enums", 1, NULL, 'W' }, { "values-unspecified-enums", 1, NULL, 'N' }, { "file-save", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:S:i:I:e:E:W:N:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_values_cmd_parser_print_help (); test_values_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_values_cmd_parser_print_version (); test_values_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* string option with values. */ if (update_arg( (void *)&(args_info->string_values_arg), &(args_info->string_values_orig), &(args_info->string_values_given), &(local_args_info.string_values_given), optarg, test_values_cmd_parser_string_values_values, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string-values", 's', additional_error)) goto failure; break; case 'S': /* multiple string option with values. */ if (update_multiple_arg_temp(&multistring_values_list, &(local_args_info.multistring_values_given), optarg, test_values_cmd_parser_multistring_values_values, 0, ARG_STRING, "multistring-values", 'S', additional_error)) goto failure; break; case 'i': /* int option with values. */ if (update_arg( (void *)&(args_info->int_values_arg), &(args_info->int_values_orig), &(args_info->int_values_given), &(local_args_info.int_values_given), optarg, test_values_cmd_parser_int_values_values, 0, ARG_INT, check_ambiguity, override, 0, 0, "int-values", 'i', additional_error)) goto failure; break; case 'I': /* multiple int option with values. */ if (update_multiple_arg_temp(&int_values_m_list, &(local_args_info.int_values_m_given), optarg, test_values_cmd_parser_int_values_m_values, 0, ARG_INT, "int-values-m", 'I', additional_error)) goto failure; break; case 'e': /* option with values and enums 1. */ if (update_arg( (void *)&(args_info->values_first_enums_arg), &(args_info->values_first_enums_orig), &(args_info->values_first_enums_given), &(local_args_info.values_first_enums_given), optarg, test_values_cmd_parser_values_first_enums_values, 0, ARG_ENUM, check_ambiguity, override, 0, 0, "values-first-enums", 'e', additional_error)) goto failure; break; case 'E': /* option with values and enums with plus and minus 1. */ if (update_arg( (void *)&(args_info->values_first_enums_plus_arg), &(args_info->values_first_enums_plus_orig), &(args_info->values_first_enums_plus_given), &(local_args_info.values_first_enums_plus_given), optarg, test_values_cmd_parser_values_first_enums_plus_values, 0, ARG_ENUM, check_ambiguity, override, 0, 0, "values-first-enums-plus", 'E', additional_error)) goto failure; break; case 'W': /* multiple option with values and enums. */ if (update_multiple_arg_temp(&values_multiple_enums_list, &(local_args_info.values_multiple_enums_given), optarg, test_values_cmd_parser_values_multiple_enums_values, "FOURTH", ARG_ENUM, "values-multiple-enums", 'W', additional_error)) goto failure; break; case 'N': /* option with values that will not be specified on the command line. */ if (update_arg( (void *)&(args_info->values_unspecified_enums_arg), &(args_info->values_unspecified_enums_orig), &(args_info->values_unspecified_enums_given), &(local_args_info.values_unspecified_enums_given), optarg, test_values_cmd_parser_values_unspecified_enums_values, 0, ARG_ENUM, check_ambiguity, override, 0, 0, "values-unspecified-enums", 'N', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* string option with values containing + and -. */ if (strcmp (long_options[option_index].name, "string-values-plus") == 0) { if (update_arg( (void *)&(args_info->string_values_plus_arg), &(args_info->string_values_plus_orig), &(args_info->string_values_plus_given), &(local_args_info.string_values_plus_given), optarg, test_values_cmd_parser_string_values_plus_values, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string-values-plus", '-', additional_error)) goto failure; } /* string option with values and default. */ else if (strcmp (long_options[option_index].name, "string-values-def") == 0) { if (update_arg( (void *)&(args_info->string_values_def_arg), &(args_info->string_values_def_orig), &(args_info->string_values_def_given), &(local_args_info.string_values_def_given), optarg, test_values_cmd_parser_string_values_def_values, "bar", ARG_STRING, check_ambiguity, override, 0, 0, "string-values-def", '-', additional_error)) goto failure; } /* string option with values and default and optional argument. */ else if (strcmp (long_options[option_index].name, "string-values-def-argopt") == 0) { if (update_arg( (void *)&(args_info->string_values_def_argopt_arg), &(args_info->string_values_def_argopt_orig), &(args_info->string_values_def_argopt_given), &(local_args_info.string_values_def_argopt_given), optarg, test_values_cmd_parser_string_values_def_argopt_values, "foobar", ARG_STRING, check_ambiguity, override, 0, 0, "string-values-def-argopt", '-', additional_error)) goto failure; } /* string option with values no short. */ else if (strcmp (long_options[option_index].name, "string-values-no-short") == 0) { if (update_arg( (void *)&(args_info->string_values_no_short_arg), &(args_info->string_values_no_short_orig), &(args_info->string_values_no_short_given), &(local_args_info.string_values_no_short_given), optarg, test_values_cmd_parser_string_values_no_short_values, 0, ARG_STRING, check_ambiguity, override, 0, 0, "string-values-no-short", '-', additional_error)) goto failure; } /* multiple string option with values and default. */ else if (strcmp (long_options[option_index].name, "multistring-values-def") == 0) { if (update_multiple_arg_temp(&multistring_values_def_list, &(local_args_info.multistring_values_def_given), optarg, test_values_cmd_parser_multistring_values_def_values, "foo", ARG_STRING, "multistring-values-def", '-', additional_error)) goto failure; } /* multiple string option with values no-short. */ else if (strcmp (long_options[option_index].name, "multistring-values-no-short") == 0) { if (update_multiple_arg_temp(&multistring_values_no_short_list, &(local_args_info.multistring_values_no_short_given), optarg, test_values_cmd_parser_multistring_values_no_short_values, 0, ARG_STRING, "multistring-values-no-short", '-', additional_error)) goto failure; } /* group string option with values and default. */ else if (strcmp (long_options[option_index].name, "string-values-group") == 0) { if (args_info->group1_group_counter && override) reset_group_group1 (args_info); args_info->group1_group_counter += 1; if (update_arg( (void *)&(args_info->string_values_group_arg), &(args_info->string_values_group_orig), &(args_info->string_values_group_given), &(local_args_info.string_values_group_given), optarg, test_values_cmd_parser_string_values_group_values, "bar", ARG_STRING, check_ambiguity, override, 0, 0, "string-values-group", '-', additional_error)) goto failure; } /* int option with values and default. */ else if (strcmp (long_options[option_index].name, "int-values-def") == 0) { if (update_arg( (void *)&(args_info->int_values_def_arg), &(args_info->int_values_def_orig), &(args_info->int_values_def_given), &(local_args_info.int_values_def_given), optarg, test_values_cmd_parser_int_values_def_values, "180", ARG_INT, check_ambiguity, override, 0, 0, "int-values-def", '-', additional_error)) goto failure; } /* option with values and enums 2 with default. */ else if (strcmp (long_options[option_index].name, "values-second-enums") == 0) { if (update_arg( (void *)&(args_info->values_second_enums_arg), &(args_info->values_second_enums_orig), &(args_info->values_second_enums_given), &(local_args_info.values_second_enums_given), optarg, test_values_cmd_parser_values_second_enums_values, "180", ARG_ENUM, check_ambiguity, override, 0, 0, "values-second-enums", '-', additional_error)) goto failure; } /* save the passed options into a file. */ else if (strcmp (long_options[option_index].name, "file-save") == 0) { if (update_arg( (void *)&(args_info->file_save_arg), &(args_info->file_save_orig), &(args_info->file_save_given), &(local_args_info.file_save_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "file-save", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_VALUES_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (args_info->group1_group_counter > 1) { fprintf (stderr, "%s: %d options of group group1 were given. At most one is required%s.\n", argv[0], args_info->group1_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } update_multiple_arg((void *)&(args_info->multistring_values_arg), &(args_info->multistring_values_orig), args_info->multistring_values_given, local_args_info.multistring_values_given, 0, ARG_STRING, multistring_values_list); multiple_default_value.default_string_arg = "foo"; update_multiple_arg((void *)&(args_info->multistring_values_def_arg), &(args_info->multistring_values_def_orig), args_info->multistring_values_def_given, local_args_info.multistring_values_def_given, &multiple_default_value, ARG_STRING, multistring_values_def_list); update_multiple_arg((void *)&(args_info->multistring_values_no_short_arg), &(args_info->multistring_values_no_short_orig), args_info->multistring_values_no_short_given, local_args_info.multistring_values_no_short_given, 0, ARG_STRING, multistring_values_no_short_list); update_multiple_arg((void *)&(args_info->int_values_m_arg), &(args_info->int_values_m_orig), args_info->int_values_m_given, local_args_info.int_values_m_given, 0, ARG_INT, int_values_m_list); multiple_default_value.int_arg = values_multiple_enums_arg_FOURTH; update_multiple_arg((void *)&(args_info->values_multiple_enums_arg), &(args_info->values_multiple_enums_orig), args_info->values_multiple_enums_given, local_args_info.values_multiple_enums_given, &multiple_default_value, ARG_ENUM, values_multiple_enums_list); args_info->multistring_values_given += local_args_info.multistring_values_given; local_args_info.multistring_values_given = 0; args_info->multistring_values_def_given += local_args_info.multistring_values_def_given; local_args_info.multistring_values_def_given = 0; args_info->multistring_values_no_short_given += local_args_info.multistring_values_no_short_given; local_args_info.multistring_values_no_short_given = 0; args_info->int_values_m_given += local_args_info.int_values_m_given; local_args_info.int_values_m_given = 0; args_info->values_multiple_enums_given += local_args_info.values_multiple_enums_given; local_args_info.values_multiple_enums_given = 0; if (check_required) { error_occurred += test_values_cmd_parser_required2 (args_info, argv[0], additional_error); } test_values_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (multistring_values_list, 1 ); free_list (multistring_values_def_list, 1 ); free_list (multistring_values_no_short_list, 1 ); free_list (int_values_m_list, 0 ); free_list (values_multiple_enums_list, 0 ); test_values_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/output_dir/0000775000175000017500000000000012046541044014142 500000000000000gengetopt-2.22.6/tests/output_dir/Makefile.in0000664000175000017500000004404612046536525016147 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tests/output_dir DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CLEANFILES = cmdline.c cmdline.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/output_dir/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/output_dir/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/tests/output_dir/Makefile.am0000664000175000017500000000077112044745036016130 00000000000000# Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CLEANFILES = cmdline.c cmdline.h gengetopt-2.22.6/tests/valgrind_tests.sh.in0000664000175000017500000000416712044745036015672 00000000000000#! @BASH_SHELL@ # --------------------------------------------------------------------- # # # Script to run some examples through VALGRIND. # # Michael Hagemann # # modified by Lorenzo Bettini # # needs bash extensions # # --------------------------------------------------------------------- # # Hack to run valgrind with new glibcs. Problem: new TLS (thread # local storage) #VG_ENV="LD_ASSUME_KERNEL=2.2.5" VG_PRG="@VALGRIND@" VG_ARGS="--tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes --suppressions=@srcdir@/suppressions.supp" VGRIND="${VG_ENV} ${VG_PRG} ${VG_ARGS}" if test ! -x "${VG_PRG}"; then echo Valgrind not found! Check path. exit 1 fi # --------------------------------------------------------------------- # DATE=`date +"%Y-%m-%d_%H%M"` SUMMARY=valgrind_summary.log TMP_LOG=valgrind_tmp.log ERROR=0 # --------------------------------------------------------------------- # vgrind () { if test ! -x "$1" -o "$1" == `basename $0`; then # echo "Skipping $1." return fi echo -n "Running $* ..." tmp_err= if [[ $1 == *.sh ]]; then eval $1 ${VGRIND} >${TMP_LOG} 2>&1; else eval ${VGRIND} $* >${TMP_LOG} 2>&1 fi; grep -e "LEAK SUMMARY" ${TMP_LOG} >/dev/null 2>&1 if test "$?" == "0"; then echo -n " LEAKS!" echo "" >> ${SUMMARY} echo "** $*, LEAKS" >> ${SUMMARY} cat ${TMP_LOG} >> ${SUMMARY} tmp_err=1 fi grep -e "[1-9][0-9]* error" ${TMP_LOG} >/dev/null 2>&1 if test "$?" == "0"; then echo -n " ERRORS!" echo "" >> ${SUMMARY} echo "** $*, ERRORS" >> ${SUMMARY} cat ${TMP_LOG} >> ${SUMMARY} tmp_err=1 fi if test "x${tmp_err}" == "x"; then echo " OK." else ERROR=1 echo "" fi rm -f ${TMP_LOG} } # --------------------------------------------------------------------- # echo "Run at ${DATE}" >${SUMMARY} for PROG in $*; do vgrind @top_builddir@/tests/$PROG; done # --------------------------------------------------------------------- # # cat ${SUMMARY} exit ${ERROR} gengetopt-2.22.6/tests/no_optgiven.c0000664000175000017500000000065512045003074014360 00000000000000/* no_optgiven.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "no_optgiven_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ /* since it is called with no option we expect an error since the option --foo is required */ if (no_optgiven_cmd_parser (argc, argv, &args_info) == 0) exit(0) ; return 1; } gengetopt-2.22.6/tests/test_main_cmdline_cmd.c.test0000664000175000017500000006055312045003074017313 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_main_cmdline_cmd.ggo --func-name=test_main_cmdline_cmd_parser --file-name=test_main_cmdline_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_main_cmdline_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: " TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE " [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -F, --first-cmd=first command the first command line to parse (mandatory)", " -S, --second-cmd=second command\n the second command line to parse (mandatory)", 0 }; typedef enum {ARG_NO , ARG_STRING } test_main_cmdline_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_main_cmdline_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_main_cmdline_cmd_parser_params *params, const char *additional_error); static int test_main_cmdline_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->first_cmd_given = 0 ; args_info->second_cmd_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->first_cmd_arg = NULL; args_info->first_cmd_orig = NULL; args_info->second_cmd_arg = NULL; args_info->second_cmd_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->first_cmd_help = gengetopt_args_info_help[2] ; args_info->first_cmd_min = 0; args_info->first_cmd_max = 0; args_info->second_cmd_help = gengetopt_args_info_help[3] ; args_info->second_cmd_min = 0; args_info->second_cmd_max = 0; } void test_main_cmdline_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE_NAME) ? TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE_NAME : TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE), TEST_MAIN_CMDLINE_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_main_cmdline_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_main_cmdline_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_main_cmdline_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_main_cmdline_cmd_parser_params_init(struct test_main_cmdline_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_main_cmdline_cmd_parser_params * test_main_cmdline_cmd_parser_params_create(void) { struct test_main_cmdline_cmd_parser_params *params = (struct test_main_cmdline_cmd_parser_params *)malloc(sizeof(struct test_main_cmdline_cmd_parser_params)); test_main_cmdline_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_main_cmdline_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_multiple_string_field (args_info->first_cmd_given, &(args_info->first_cmd_arg), &(args_info->first_cmd_orig)); free_multiple_string_field (args_info->second_cmd_given, &(args_info->second_cmd_arg), &(args_info->second_cmd_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_main_cmdline_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); write_multiple_into_file(outfile, args_info->first_cmd_given, "first-cmd", args_info->first_cmd_orig, 0); write_multiple_into_file(outfile, args_info->second_cmd_given, "second-cmd", args_info->second_cmd_orig, 0); i = EXIT_SUCCESS; return i; } int test_main_cmdline_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_main_cmdline_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_main_cmdline_cmd_parser_free (struct gengetopt_args_info *args_info) { test_main_cmdline_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_main_cmdline_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_main_cmdline_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_main_cmdline_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_main_cmdline_cmd_parser_params *params) { int result; result = test_main_cmdline_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_main_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_main_cmdline_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_main_cmdline_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_main_cmdline_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_main_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_main_cmdline_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_main_cmdline_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_main_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_main_cmdline_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->first_cmd_given) { fprintf (stderr, "%s: '--first-cmd' ('-F') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } if (check_multiple_option_occurrences(prog_name, args_info->first_cmd_given, args_info->first_cmd_min, args_info->first_cmd_max, "'--first-cmd' ('-F')")) error_occurred = 1; if (! args_info->second_cmd_given) { fprintf (stderr, "%s: '--second-cmd' ('-S') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } if (check_multiple_option_occurrences(prog_name, args_info->second_cmd_given, args_info->second_cmd_min, args_info->second_cmd_max, "'--second-cmd' ('-S')")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_main_cmdline_cmd_parser_params.check_ambiguity * @param override @see test_main_cmdline_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_main_cmdline_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_main_cmdline_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_main_cmdline_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_main_cmdline_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_main_cmdline_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * first_cmd_list = NULL; struct generic_list * second_cmd_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_main_cmdline_cmd_parser_init (args_info); test_main_cmdline_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "first-cmd", 1, NULL, 'F' }, { "second-cmd", 1, NULL, 'S' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVF:S:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_main_cmdline_cmd_parser_print_help (); test_main_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_main_cmdline_cmd_parser_print_version (); test_main_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'F': /* the first command line to parse. */ if (update_multiple_arg_temp(&first_cmd_list, &(local_args_info.first_cmd_given), optarg, 0, 0, ARG_STRING, "first-cmd", 'F', additional_error)) goto failure; break; case 'S': /* the second command line to parse. */ if (update_multiple_arg_temp(&second_cmd_list, &(local_args_info.second_cmd_given), optarg, 0, 0, ARG_STRING, "second-cmd", 'S', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ update_multiple_arg((void *)&(args_info->first_cmd_arg), &(args_info->first_cmd_orig), args_info->first_cmd_given, local_args_info.first_cmd_given, 0, ARG_STRING, first_cmd_list); update_multiple_arg((void *)&(args_info->second_cmd_arg), &(args_info->second_cmd_orig), args_info->second_cmd_given, local_args_info.second_cmd_given, 0, ARG_STRING, second_cmd_list); args_info->first_cmd_given += local_args_info.first_cmd_given; local_args_info.first_cmd_given = 0; args_info->second_cmd_given += local_args_info.second_cmd_given; local_args_info.second_cmd_given = 0; if (check_required) { error_occurred += test_main_cmdline_cmd_parser_required2 (args_info, argv[0], additional_error); } test_main_cmdline_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (first_cmd_list, 1 ); free_list (second_cmd_list, 1 ); test_main_cmdline_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_sections.c0000664000175000017500000000063012045003074014710 00000000000000/* test_sections.c test */ /* test sections printed by --help */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_sections_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_sections_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; test_sections_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/wrong_multiple_occurrence.err0000664000175000017500000000030112044745036017654 00000000000000wrong_multiple_occurrence.ggo:6: syntax error - wrong_multiple_occurrence.ggo:6: string optional multiple(-1-30) # WRONG wrong_multiple_occurrence.ggo:6: ^ gengetopt-2.22.6/tests/test_sections_cmd.ggo0000664000175000017500000000211512044745036016077 00000000000000# test_sections_cmd.ggo # test sections package "test_sections" version "1.0" option "string" s "string option" string no option "int" i "int option" int no section "First section. This \"section\" definition has no description, since the description is in the definition itself, that is wrapped too" option "short" S "short option" short no option "long" l "long option" long no option "float" f "float option" float no option "double" d "double option" double no option "longdouble" D "longdouble option" longdouble no section "Second section" sectiondesc="The following options belong to the second section\nby the way this second section also has this neat description, and it is quite long so it should require some kind of line wrapping, but don't worry: gengetopt will wrap it for you! ;-)" option "longlong" L "longlong option" longlong no option "flag" F "flag option" flag on option "function" u "function option" no section "Last section" option "no-short" - "no short option" no option "required" r "required option" string yes gengetopt-2.22.6/tests/output_header_dir/0000775000175000017500000000000012046541044015452 500000000000000gengetopt-2.22.6/tests/output_header_dir/Makefile.in0000664000175000017500000004406112046536525017454 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tests/output_header_dir DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CLEANFILES = cmdline.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/output_header_dir/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/output_header_dir/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/tests/output_header_dir/Makefile.am0000664000175000017500000000075712044745036017444 00000000000000# Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CLEANFILES = cmdline.h gengetopt-2.22.6/tests/no_strings_cmd.h.test0000664000175000017500000001510712045003074016022 00000000000000/** @file no_strings_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef NO_STRINGS_CMD_H #define NO_STRINGS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef NO_STRINGS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define NO_STRINGS_CMD_PARSER_PACKAGE "no_strings" #endif #ifndef NO_STRINGS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define NO_STRINGS_CMD_PARSER_PACKAGE_NAME "no_strings" #endif #ifndef NO_STRINGS_CMD_PARSER_VERSION /** @brief the program version */ #define NO_STRINGS_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_arg; /**< @brief foo option. */ char * foo_orig; /**< @brief foo option original value given at command line. */ const char *foo_help; /**< @brief foo option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct no_strings_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int no_strings_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use no_strings_cmd_parser_ext() instead */ int no_strings_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int no_strings_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_strings_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int no_strings_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int no_strings_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void no_strings_cmd_parser_print_help(void); /** * Print the version */ void no_strings_cmd_parser_print_version(void); /** * Initializes all the fields a no_strings_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void no_strings_cmd_parser_params_init(struct no_strings_cmd_parser_params *params); /** * Allocates dynamically a no_strings_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized no_strings_cmd_parser_params structure */ struct no_strings_cmd_parser_params *no_strings_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void no_strings_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void no_strings_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int no_strings_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* NO_STRINGS_CMD_H */ gengetopt-2.22.6/tests/no_multi_types.c0000664000175000017500000000061212045003074015074 00000000000000/* no_multi_types.c test contains multiple options none of which has type */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "no_multi_types_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (no_multi_types_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; } gengetopt-2.22.6/tests/test_usage.c0000664000175000017500000000063412045003074014171 00000000000000/* test_usage.c test */ /* test correct formatting of usage specification */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_usage_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_usage_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; test_usage_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_values_cmd_cc.cc0000664000175000017500000000003512044745036016024 00000000000000#include "test_values_cmd.c" gengetopt-2.22.6/tests/test_all_opts.save.test0000664000175000017500000000016312044775636016414 00000000000000long="150000000" float="150.217" flag function opt-arg opt-arg-short required="foo" file-save="test_all_opts.save" gengetopt-2.22.6/tests/test_conf_parser.save.test0000664000175000017500000000056112044775636017102 00000000000000opta="FOO" string="another" int="100" float="3.14" no-short required="this is a test" conf-file="./test_conf.conf" multi-string="-1" multi-string="zero" multi-string="first" multi-string="second" multi-string="third" multi-string="fourth" multi-string="fifth" multi-string="sixth" noarg noarg noarg noarg-noshort noarg-noshort opt-arg file-save="test_conf_parser.save" gengetopt-2.22.6/tests/test_simple_multiple_cmd.ggo0000664000175000017500000000031512044745036017454 00000000000000package "test_simple_multiple" version "1.0" # test_simple_multiple_cmd.ggo # test options that can be given more than once option "string" s "string option" string default="foo" optional multiple gengetopt-2.22.6/tests/test_multiple_cmd.c.test0000664000175000017500000014224412045003074016525 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_multiple_cmd.ggo --func-name=test_multiple_cmd_parser --file-name=test_multiple_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_multiple_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_multiple [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -s, --string=STRING string option (default=`foo')", " -i, --int=INT int option (mandatory)", " -S, --short=SHORT short option", " -l, --long=LONG long option", " --longlong=LONGLONG long long option", " -L, --limited=STRING limited multiple option", " --limited-interval=STRING limited multiple option (with interval)", " --big-limited-interval=STRING\n limited multiple option (with interval)", " --limited-open-right=STRING\n limited multiple option (with interval right\n open)", " --limited-open-left=STRING\n limited multiple option (with interval left\n open)", " -f, --float=FLOAT float option (default=`15000')", " --no-short-opt=STRING string option with no short", " -n, --noarg multiple option with no arg", " --noarg-noshort multiple option with no arg and no short", " -M, --optarg[=ID] multi with optional args", " --optarg-noshort[=ID] multi with optional args and no short", " --file-save=STRING save the passed options into a file", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT , ARG_SHORT , ARG_LONG , ARG_FLOAT , ARG_LONGLONG } test_multiple_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_multiple_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_multiple_cmd_parser_params *params, const char *additional_error); static int test_multiple_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->string_given = 0 ; args_info->int_given = 0 ; args_info->short_given = 0 ; args_info->long_given = 0 ; args_info->longlong_given = 0 ; args_info->limited_given = 0 ; args_info->limited_interval_given = 0 ; args_info->big_limited_interval_given = 0 ; args_info->limited_open_right_given = 0 ; args_info->limited_open_left_given = 0 ; args_info->float_given = 0 ; args_info->no_short_opt_given = 0 ; args_info->noarg_given = 0 ; args_info->noarg_noshort_given = 0 ; args_info->optarg_given = 0 ; args_info->optarg_noshort_given = 0 ; args_info->file_save_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->string_arg = NULL; args_info->string_orig = NULL; args_info->int_arg = NULL; args_info->int_orig = NULL; args_info->short_arg = NULL; args_info->short_orig = NULL; args_info->long_arg = NULL; args_info->long_orig = NULL; args_info->longlong_arg = NULL; args_info->longlong_orig = NULL; args_info->limited_arg = NULL; args_info->limited_orig = NULL; args_info->limited_interval_arg = NULL; args_info->limited_interval_orig = NULL; args_info->big_limited_interval_arg = NULL; args_info->big_limited_interval_orig = NULL; args_info->limited_open_right_arg = NULL; args_info->limited_open_right_orig = NULL; args_info->limited_open_left_arg = NULL; args_info->limited_open_left_orig = NULL; args_info->float_arg = NULL; args_info->float_orig = NULL; args_info->no_short_opt_arg = NULL; args_info->no_short_opt_orig = NULL; args_info->optarg_arg = NULL; args_info->optarg_orig = NULL; args_info->optarg_noshort_arg = NULL; args_info->optarg_noshort_orig = NULL; args_info->file_save_arg = NULL; args_info->file_save_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->string_help = gengetopt_args_info_help[2] ; args_info->string_min = 0; args_info->string_max = 0; args_info->int_help = gengetopt_args_info_help[3] ; args_info->int_min = 0; args_info->int_max = 0; args_info->short_help = gengetopt_args_info_help[4] ; args_info->short_min = 0; args_info->short_max = 0; args_info->long_help = gengetopt_args_info_help[5] ; args_info->long_min = 0; args_info->long_max = 0; args_info->longlong_help = gengetopt_args_info_help[6] ; args_info->longlong_min = 0; args_info->longlong_max = 0; args_info->limited_help = gengetopt_args_info_help[7] ; args_info->limited_min = 3; args_info->limited_max = 3; args_info->limited_interval_help = gengetopt_args_info_help[8] ; args_info->limited_interval_min = 1; args_info->limited_interval_max = 3; args_info->big_limited_interval_help = gengetopt_args_info_help[9] ; args_info->big_limited_interval_min = 1; args_info->big_limited_interval_max = 30; args_info->limited_open_right_help = gengetopt_args_info_help[10] ; args_info->limited_open_right_min = 3; args_info->limited_open_right_max = 0; args_info->limited_open_left_help = gengetopt_args_info_help[11] ; args_info->limited_open_left_min = 0; args_info->limited_open_left_max = 3; args_info->float_help = gengetopt_args_info_help[12] ; args_info->float_min = 0; args_info->float_max = 0; args_info->no_short_opt_help = gengetopt_args_info_help[13] ; args_info->no_short_opt_min = 0; args_info->no_short_opt_max = 0; args_info->noarg_help = gengetopt_args_info_help[14] ; args_info->noarg_min = 0; args_info->noarg_max = 0; args_info->noarg_noshort_help = gengetopt_args_info_help[15] ; args_info->noarg_noshort_min = 0; args_info->noarg_noshort_max = 0; args_info->optarg_help = gengetopt_args_info_help[16] ; args_info->optarg_min = 0; args_info->optarg_max = 0; args_info->optarg_noshort_help = gengetopt_args_info_help[17] ; args_info->optarg_noshort_min = 0; args_info->optarg_noshort_max = 0; args_info->file_save_help = gengetopt_args_info_help[18] ; } void test_multiple_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_MULTIPLE_CMD_PARSER_PACKAGE_NAME) ? TEST_MULTIPLE_CMD_PARSER_PACKAGE_NAME : TEST_MULTIPLE_CMD_PARSER_PACKAGE), TEST_MULTIPLE_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_multiple_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_multiple_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_multiple_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_multiple_cmd_parser_params_init(struct test_multiple_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_multiple_cmd_parser_params * test_multiple_cmd_parser_params_create(void) { struct test_multiple_cmd_parser_params *params = (struct test_multiple_cmd_parser_params *)malloc(sizeof(struct test_multiple_cmd_parser_params)); test_multiple_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; short short_arg; long long_arg; float float_arg; #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; #else long longlong_arg; #endif char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } /** * The passed arg parameter is NOT set to 0 from this function */ static void free_multiple_field(unsigned int len, void *arg, char ***orig) { unsigned int i; if (arg) { for (i = 0; i < len; ++i) { free_string_field(&((*orig)[i])); } free (arg); free (*orig); *orig = 0; } } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_multiple_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_multiple_string_field (args_info->string_given, &(args_info->string_arg), &(args_info->string_orig)); free_multiple_field (args_info->int_given, (void *)(args_info->int_arg), &(args_info->int_orig)); args_info->int_arg = 0; free_multiple_field (args_info->short_given, (void *)(args_info->short_arg), &(args_info->short_orig)); args_info->short_arg = 0; free_multiple_field (args_info->long_given, (void *)(args_info->long_arg), &(args_info->long_orig)); args_info->long_arg = 0; free_multiple_field (args_info->longlong_given, (void *)(args_info->longlong_arg), &(args_info->longlong_orig)); args_info->longlong_arg = 0; free_multiple_string_field (args_info->limited_given, &(args_info->limited_arg), &(args_info->limited_orig)); free_multiple_string_field (args_info->limited_interval_given, &(args_info->limited_interval_arg), &(args_info->limited_interval_orig)); free_multiple_string_field (args_info->big_limited_interval_given, &(args_info->big_limited_interval_arg), &(args_info->big_limited_interval_orig)); free_multiple_string_field (args_info->limited_open_right_given, &(args_info->limited_open_right_arg), &(args_info->limited_open_right_orig)); free_multiple_string_field (args_info->limited_open_left_given, &(args_info->limited_open_left_arg), &(args_info->limited_open_left_orig)); free_multiple_field (args_info->float_given, (void *)(args_info->float_arg), &(args_info->float_orig)); args_info->float_arg = 0; free_multiple_string_field (args_info->no_short_opt_given, &(args_info->no_short_opt_arg), &(args_info->no_short_opt_orig)); free_multiple_string_field (args_info->optarg_given, &(args_info->optarg_arg), &(args_info->optarg_orig)); free_multiple_string_field (args_info->optarg_noshort_given, &(args_info->optarg_noshort_arg), &(args_info->optarg_noshort_orig)); free_string_field (&(args_info->file_save_arg)); free_string_field (&(args_info->file_save_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_multiple_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_MULTIPLE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); write_multiple_into_file(outfile, args_info->string_given, "string", args_info->string_orig, 0); write_multiple_into_file(outfile, args_info->int_given, "int", args_info->int_orig, 0); write_multiple_into_file(outfile, args_info->short_given, "short", args_info->short_orig, 0); write_multiple_into_file(outfile, args_info->long_given, "long", args_info->long_orig, 0); write_multiple_into_file(outfile, args_info->longlong_given, "longlong", args_info->longlong_orig, 0); write_multiple_into_file(outfile, args_info->limited_given, "limited", args_info->limited_orig, 0); write_multiple_into_file(outfile, args_info->limited_interval_given, "limited-interval", args_info->limited_interval_orig, 0); write_multiple_into_file(outfile, args_info->big_limited_interval_given, "big-limited-interval", args_info->big_limited_interval_orig, 0); write_multiple_into_file(outfile, args_info->limited_open_right_given, "limited-open-right", args_info->limited_open_right_orig, 0); write_multiple_into_file(outfile, args_info->limited_open_left_given, "limited-open-left", args_info->limited_open_left_orig, 0); write_multiple_into_file(outfile, args_info->float_given, "float", args_info->float_orig, 0); write_multiple_into_file(outfile, args_info->no_short_opt_given, "no-short-opt", args_info->no_short_opt_orig, 0); write_multiple_into_file(outfile, args_info->noarg_given, "noarg", 0, 0); write_multiple_into_file(outfile, args_info->noarg_noshort_given, "noarg-noshort", 0, 0); write_multiple_into_file(outfile, args_info->optarg_given, "optarg", args_info->optarg_orig, 0); write_multiple_into_file(outfile, args_info->optarg_noshort_given, "optarg-noshort", args_info->optarg_noshort_orig, 0); if (args_info->file_save_given) write_into_file(outfile, "file-save", args_info->file_save_orig, 0); i = EXIT_SUCCESS; return i; } int test_multiple_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_MULTIPLE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_multiple_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_multiple_cmd_parser_free (struct gengetopt_args_info *args_info) { test_multiple_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_multiple_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_multiple_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_multiple_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_multiple_cmd_parser_params *params) { int result; result = test_multiple_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_multiple_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_multiple_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_multiple_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_multiple_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_multiple_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_multiple_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->string_given, args_info->string_min, args_info->string_max, "'--string' ('-s')")) error_occurred = 1; if (! args_info->int_given) { fprintf (stderr, "%s: '--int' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } if (check_multiple_option_occurrences(prog_name, args_info->int_given, args_info->int_min, args_info->int_max, "'--int' ('-i')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->short_given, args_info->short_min, args_info->short_max, "'--short' ('-S')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->long_given, args_info->long_min, args_info->long_max, "'--long' ('-l')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->longlong_given, args_info->longlong_min, args_info->longlong_max, "'--longlong'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->limited_given, args_info->limited_min, args_info->limited_max, "'--limited' ('-L')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->limited_interval_given, args_info->limited_interval_min, args_info->limited_interval_max, "'--limited-interval'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->big_limited_interval_given, args_info->big_limited_interval_min, args_info->big_limited_interval_max, "'--big-limited-interval'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->limited_open_right_given, args_info->limited_open_right_min, args_info->limited_open_right_max, "'--limited-open-right'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->limited_open_left_given, args_info->limited_open_left_min, args_info->limited_open_left_max, "'--limited-open-left'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->float_given, args_info->float_min, args_info->float_max, "'--float' ('-f')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->no_short_opt_given, args_info->no_short_opt_min, args_info->no_short_opt_max, "'--no-short-opt'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->noarg_given, args_info->noarg_min, args_info->noarg_max, "'--noarg' ('-n')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->noarg_noshort_given, args_info->noarg_noshort_min, args_info->noarg_noshort_max, "'--noarg-noshort'")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->optarg_given, args_info->optarg_min, args_info->optarg_max, "'--optarg' ('-M')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->optarg_noshort_given, args_info->optarg_noshort_min, args_info->optarg_noshort_max, "'--optarg-noshort'")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_multiple_cmd_parser_params.check_ambiguity * @param override @see test_multiple_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_multiple_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_SHORT: if (val) *((short *)field) = (short)strtol (val, &stop_char, 0); break; case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0); #else if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); #endif break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_LONGLONG: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_multiple_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_multiple_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; case ARG_SHORT: *((short **)field) = (short *)realloc (*((short **)field), (field_given + prev_given) * sizeof (short)); break; case ARG_LONG: *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; case ARG_FLOAT: *((float **)field) = (float *)realloc (*((float **)field), (field_given + prev_given) * sizeof (float)); break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) *((long long int **)field) = (long long int *)realloc (*((long long int **)field), (field_given + prev_given) * sizeof (long long int)); break; #else *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; #endif case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_SHORT: (*((short **)field))[i + field_given] = tmp->arg.short_arg; break; case ARG_LONG: (*((long **)field))[i + field_given] = tmp->arg.long_arg; break; case ARG_FLOAT: (*((float **)field))[i + field_given] = tmp->arg.float_arg; break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) (*((long long int **)field))[i + field_given] = tmp->arg.longlong_arg; break; #else (*((long **)field))[i + field_given] = tmp->arg.longlong_arg; break; #endif case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; case ARG_SHORT: if (! *((short **)field)) { *((short **)field) = (short *)malloc (sizeof (short)); (*((short **)field))[0] = default_value->short_arg; } break; case ARG_LONG: if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->long_arg; } break; case ARG_FLOAT: if (! *((float **)field)) { *((float **)field) = (float *)malloc (sizeof (float)); (*((float **)field))[0] = default_value->float_arg; } break; case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (! *((long long int **)field)) { *((long long int **)field) = (long long int *)malloc (sizeof (long long int)); (*((long long int **)field))[0] = default_value->longlong_arg; } #else if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->longlong_arg; } #endif break; case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_multiple_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_multiple_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ union generic_value multiple_default_value; struct generic_list * string_list = NULL; struct generic_list * int_list = NULL; struct generic_list * short_list = NULL; struct generic_list * long_list = NULL; struct generic_list * longlong_list = NULL; struct generic_list * limited_list = NULL; struct generic_list * limited_interval_list = NULL; struct generic_list * big_limited_interval_list = NULL; struct generic_list * limited_open_right_list = NULL; struct generic_list * limited_open_left_list = NULL; struct generic_list * float_list = NULL; struct generic_list * no_short_opt_list = NULL; struct generic_list * optarg_list = NULL; struct generic_list * optarg_noshort_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_multiple_cmd_parser_init (args_info); test_multiple_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "string", 1, NULL, 's' }, { "int", 1, NULL, 'i' }, { "short", 1, NULL, 'S' }, { "long", 1, NULL, 'l' }, { "longlong", 1, NULL, 0 }, { "limited", 1, NULL, 'L' }, { "limited-interval", 1, NULL, 0 }, { "big-limited-interval", 1, NULL, 0 }, { "limited-open-right", 1, NULL, 0 }, { "limited-open-left", 1, NULL, 0 }, { "float", 1, NULL, 'f' }, { "no-short-opt", 1, NULL, 0 }, { "noarg", 0, NULL, 'n' }, { "noarg-noshort", 0, NULL, 0 }, { "optarg", 2, NULL, 'M' }, { "optarg-noshort", 2, NULL, 0 }, { "file-save", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:i:S:l:L:f:nM::", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_multiple_cmd_parser_print_help (); test_multiple_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_multiple_cmd_parser_print_version (); test_multiple_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* string option. */ if (update_multiple_arg_temp(&string_list, &(local_args_info.string_given), optarg, 0, "foo", ARG_STRING, "string", 's', additional_error)) goto failure; break; case 'i': /* int option. */ if (update_multiple_arg_temp(&int_list, &(local_args_info.int_given), optarg, 0, 0, ARG_INT, "int", 'i', additional_error)) goto failure; break; case 'S': /* short option. */ if (update_multiple_arg_temp(&short_list, &(local_args_info.short_given), optarg, 0, 0, ARG_SHORT, "short", 'S', additional_error)) goto failure; break; case 'l': /* long option. */ if (update_multiple_arg_temp(&long_list, &(local_args_info.long_given), optarg, 0, 0, ARG_LONG, "long", 'l', additional_error)) goto failure; break; case 'L': /* limited multiple option. */ if (update_multiple_arg_temp(&limited_list, &(local_args_info.limited_given), optarg, 0, 0, ARG_STRING, "limited", 'L', additional_error)) goto failure; break; case 'f': /* float option. */ if (update_multiple_arg_temp(&float_list, &(local_args_info.float_given), optarg, 0, "15000", ARG_FLOAT, "float", 'f', additional_error)) goto failure; break; case 'n': /* multiple option with no arg. */ local_args_info.noarg_given++; break; case 'M': /* multi with optional args. */ if (update_multiple_arg_temp(&optarg_list, &(local_args_info.optarg_given), optarg, 0, 0, ARG_STRING, "optarg", 'M', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* long long option. */ if (strcmp (long_options[option_index].name, "longlong") == 0) { if (update_multiple_arg_temp(&longlong_list, &(local_args_info.longlong_given), optarg, 0, 0, ARG_LONGLONG, "longlong", '-', additional_error)) goto failure; } /* limited multiple option (with interval). */ else if (strcmp (long_options[option_index].name, "limited-interval") == 0) { if (update_multiple_arg_temp(&limited_interval_list, &(local_args_info.limited_interval_given), optarg, 0, 0, ARG_STRING, "limited-interval", '-', additional_error)) goto failure; } /* limited multiple option (with interval). */ else if (strcmp (long_options[option_index].name, "big-limited-interval") == 0) { if (update_multiple_arg_temp(&big_limited_interval_list, &(local_args_info.big_limited_interval_given), optarg, 0, 0, ARG_STRING, "big-limited-interval", '-', additional_error)) goto failure; } /* limited multiple option (with interval right open). */ else if (strcmp (long_options[option_index].name, "limited-open-right") == 0) { if (update_multiple_arg_temp(&limited_open_right_list, &(local_args_info.limited_open_right_given), optarg, 0, 0, ARG_STRING, "limited-open-right", '-', additional_error)) goto failure; } /* limited multiple option (with interval left open). */ else if (strcmp (long_options[option_index].name, "limited-open-left") == 0) { if (update_multiple_arg_temp(&limited_open_left_list, &(local_args_info.limited_open_left_given), optarg, 0, 0, ARG_STRING, "limited-open-left", '-', additional_error)) goto failure; } /* string option with no short. */ else if (strcmp (long_options[option_index].name, "no-short-opt") == 0) { if (update_multiple_arg_temp(&no_short_opt_list, &(local_args_info.no_short_opt_given), optarg, 0, 0, ARG_STRING, "no-short-opt", '-', additional_error)) goto failure; } /* multiple option with no arg and no short. */ else if (strcmp (long_options[option_index].name, "noarg-noshort") == 0) { local_args_info.noarg_noshort_given++; } /* multi with optional args and no short. */ else if (strcmp (long_options[option_index].name, "optarg-noshort") == 0) { if (update_multiple_arg_temp(&optarg_noshort_list, &(local_args_info.optarg_noshort_given), optarg, 0, 0, ARG_STRING, "optarg-noshort", '-', additional_error)) goto failure; } /* save the passed options into a file. */ else if (strcmp (long_options[option_index].name, "file-save") == 0) { if (update_arg( (void *)&(args_info->file_save_arg), &(args_info->file_save_orig), &(args_info->file_save_given), &(local_args_info.file_save_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "file-save", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_MULTIPLE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ multiple_default_value.default_string_arg = "foo"; update_multiple_arg((void *)&(args_info->string_arg), &(args_info->string_orig), args_info->string_given, local_args_info.string_given, &multiple_default_value, ARG_STRING, string_list); update_multiple_arg((void *)&(args_info->int_arg), &(args_info->int_orig), args_info->int_given, local_args_info.int_given, 0, ARG_INT, int_list); update_multiple_arg((void *)&(args_info->short_arg), &(args_info->short_orig), args_info->short_given, local_args_info.short_given, 0, ARG_SHORT, short_list); update_multiple_arg((void *)&(args_info->long_arg), &(args_info->long_orig), args_info->long_given, local_args_info.long_given, 0, ARG_LONG, long_list); update_multiple_arg((void *)&(args_info->longlong_arg), &(args_info->longlong_orig), args_info->longlong_given, local_args_info.longlong_given, 0, ARG_LONGLONG, longlong_list); update_multiple_arg((void *)&(args_info->limited_arg), &(args_info->limited_orig), args_info->limited_given, local_args_info.limited_given, 0, ARG_STRING, limited_list); update_multiple_arg((void *)&(args_info->limited_interval_arg), &(args_info->limited_interval_orig), args_info->limited_interval_given, local_args_info.limited_interval_given, 0, ARG_STRING, limited_interval_list); update_multiple_arg((void *)&(args_info->big_limited_interval_arg), &(args_info->big_limited_interval_orig), args_info->big_limited_interval_given, local_args_info.big_limited_interval_given, 0, ARG_STRING, big_limited_interval_list); update_multiple_arg((void *)&(args_info->limited_open_right_arg), &(args_info->limited_open_right_orig), args_info->limited_open_right_given, local_args_info.limited_open_right_given, 0, ARG_STRING, limited_open_right_list); update_multiple_arg((void *)&(args_info->limited_open_left_arg), &(args_info->limited_open_left_orig), args_info->limited_open_left_given, local_args_info.limited_open_left_given, 0, ARG_STRING, limited_open_left_list); multiple_default_value.float_arg = 15000; update_multiple_arg((void *)&(args_info->float_arg), &(args_info->float_orig), args_info->float_given, local_args_info.float_given, &multiple_default_value, ARG_FLOAT, float_list); update_multiple_arg((void *)&(args_info->no_short_opt_arg), &(args_info->no_short_opt_orig), args_info->no_short_opt_given, local_args_info.no_short_opt_given, 0, ARG_STRING, no_short_opt_list); update_multiple_arg((void *)&(args_info->optarg_arg), &(args_info->optarg_orig), args_info->optarg_given, local_args_info.optarg_given, 0, ARG_STRING, optarg_list); update_multiple_arg((void *)&(args_info->optarg_noshort_arg), &(args_info->optarg_noshort_orig), args_info->optarg_noshort_given, local_args_info.optarg_noshort_given, 0, ARG_STRING, optarg_noshort_list); args_info->string_given += local_args_info.string_given; local_args_info.string_given = 0; args_info->int_given += local_args_info.int_given; local_args_info.int_given = 0; args_info->short_given += local_args_info.short_given; local_args_info.short_given = 0; args_info->long_given += local_args_info.long_given; local_args_info.long_given = 0; args_info->longlong_given += local_args_info.longlong_given; local_args_info.longlong_given = 0; args_info->limited_given += local_args_info.limited_given; local_args_info.limited_given = 0; args_info->limited_interval_given += local_args_info.limited_interval_given; local_args_info.limited_interval_given = 0; args_info->big_limited_interval_given += local_args_info.big_limited_interval_given; local_args_info.big_limited_interval_given = 0; args_info->limited_open_right_given += local_args_info.limited_open_right_given; local_args_info.limited_open_right_given = 0; args_info->limited_open_left_given += local_args_info.limited_open_left_given; local_args_info.limited_open_left_given = 0; args_info->float_given += local_args_info.float_given; local_args_info.float_given = 0; args_info->no_short_opt_given += local_args_info.no_short_opt_given; local_args_info.no_short_opt_given = 0; args_info->noarg_given += local_args_info.noarg_given; local_args_info.noarg_given = 0; args_info->noarg_noshort_given += local_args_info.noarg_noshort_given; local_args_info.noarg_noshort_given = 0; args_info->optarg_given += local_args_info.optarg_given; local_args_info.optarg_given = 0; args_info->optarg_noshort_given += local_args_info.optarg_noshort_given; local_args_info.optarg_noshort_given = 0; if (check_required) { error_occurred += test_multiple_cmd_parser_required2 (args_info, argv[0], additional_error); } test_multiple_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (string_list, 1 ); free_list (int_list, 0 ); free_list (short_list, 0 ); free_list (long_list, 0 ); free_list (longlong_list, 0 ); free_list (limited_list, 1 ); free_list (limited_interval_list, 1 ); free_list (big_limited_interval_list, 1 ); free_list (limited_open_right_list, 1 ); free_list (limited_open_left_list, 1 ); free_list (float_list, 0 ); free_list (no_short_opt_list, 1 ); free_list (optarg_list, 1 ); free_list (optarg_noshort_list, 1 ); test_multiple_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_conf_parser_err.sh.in0000664000175000017500000000024512044745036017043 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_conf_parser -r "bar" -i 100 -c @srcdir@/test_conf_err.conf --opta "FOO"; then false; else true; fi gengetopt-2.22.6/tests/no_strings.c0000664000175000017500000000050512045003074014210 00000000000000/* no_strings.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "no_strings_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (no_strings_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; } gengetopt-2.22.6/tests/test_conf_inc2.conf0000664000175000017500000000004512044745036015436 00000000000000n multi-string "fourth,fifth,sixth" gengetopt-2.22.6/tests/test_groups_cmd.ggo0000664000175000017500000000120012044745036015561 00000000000000package "test_groups" version "1.0" section "some groups just for testing" defgroup "my grp2" defgroup "grp1" groupdesc="an option of this group is required\nNotice that this description is quite long so it may spawn many lines... fortunately gengetopt will wrap it for you :-)" required groupoption "opta" a "string a" multiple group="grp1" groupoption "optA" A "string A" string argoptional group="grp1" groupoption "optAmul" M "string M" argoptional string group="grp1" multiple groupoption "optb" b "string b" group="grp1" groupoption "optc" - "string c" group="my grp2" groupoption "optd" d "string d" group="my grp2" gengetopt-2.22.6/tests/suppressions.supp0000664000175000017500000000054312044745036015361 00000000000000{ Memcheck:Cond obj:/lib/ld-2.3.5.so obj:/lib/ld-2.3.5.so obj:/lib/ld-2.3.5.so obj:/lib/ld-2.3.5.so obj:/lib/ld-2.3.5.so } { Memcheck:Cond obj:/lib/ld-2.3.6.so obj:/lib/ld-2.3.6.so obj:/lib/ld-2.3.6.so obj:/lib/ld-2.3.6.so obj:/lib/ld-2.3.6.so } gengetopt-2.22.6/tests/test_all_opts_cmd.h.test0000664000175000017500000003203412045003074016507 00000000000000/** @file test_all_opts_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_ALL_OPTS_CMD_H #define TEST_ALL_OPTS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_ALL_OPTS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_ALL_OPTS_CMD_PARSER_PACKAGE "test_all_opts" #endif #ifndef TEST_ALL_OPTS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_ALL_OPTS_CMD_PARSER_PACKAGE_NAME "test_all_opts" #endif #ifndef TEST_ALL_OPTS_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_ALL_OPTS_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *detailed_help_help; /**< @brief Print help, including all details and hidden options, and exit help description. */ const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * string_arg; /**< @brief string option. */ char * string_orig; /**< @brief string option original value given at command line. */ const char *string_help; /**< @brief string option help description. */ int int_arg; /**< @brief int option. */ char * int_orig; /**< @brief int option original value given at command line. */ const char *int_help; /**< @brief int option help description. */ short short_arg; /**< @brief short option. */ char * short_orig; /**< @brief short option original value given at command line. */ const char *short_help; /**< @brief short option help description. */ long long_arg; /**< @brief long option. */ char * long_orig; /**< @brief long option original value given at command line. */ const char *long_help; /**< @brief long option help description. */ float float_arg; /**< @brief float option. */ char * float_orig; /**< @brief float option original value given at command line. */ const char *float_help; /**< @brief float option help description. */ double double_arg; /**< @brief double option. */ char * double_orig; /**< @brief double option original value given at command line. */ const char *double_help; /**< @brief double option help description. */ long double longdouble_arg; /**< @brief longdouble option. */ char * longdouble_orig; /**< @brief longdouble option original value given at command line. */ const char *longdouble_help; /**< @brief longdouble option help description. */ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; /**< @brief longlong option. */ #else long longlong_arg; /**< @brief longlong option. */ #endif char * longlong_orig; /**< @brief longlong option original value given at command line. */ const char *longlong_help; /**< @brief longlong option help description. */ int flag_flag; /**< @brief flag option (default=on). */ const char *flag_help; /**< @brief flag option help description. */ const char *function_help; /**< @brief function option help description. */ const char *no_short_help; /**< @brief no short option help description. */ char * opt_arg_arg; /**< @brief option with optional arg. */ char * opt_arg_orig; /**< @brief option with optional arg original value given at command line. */ const char *opt_arg_help; /**< @brief option with optional arg help description. */ char * opt_arg_short_arg; /**< @brief option with optional arg (short). */ char * opt_arg_short_orig; /**< @brief option with optional arg (short) original value given at command line. */ const char *opt_arg_short_help; /**< @brief option with optional arg (short) help description. */ char * required_arg; /**< @brief required option. */ char * required_orig; /**< @brief required option original value given at command line. */ const char *required_help; /**< @brief required option help description. */ int hidden_arg; /**< @brief hidden option. */ char * hidden_orig; /**< @brief hidden option original value given at command line. */ const char *hidden_help; /**< @brief hidden option help description. */ char * dependant_arg; /**< @brief option that depends on opt-arg. */ char * dependant_orig; /**< @brief option that depends on opt-arg original value given at command line. */ const char *dependant_help; /**< @brief option that depends on opt-arg help description. */ char * very_very_long_option_arg; /**< @brief the name of this option is long enough to make this description begin on a new line. */ char * very_very_long_option_orig; /**< @brief the name of this option is long enough to make this description begin on a new line original value given at command line. */ const char *very_very_long_option_help; /**< @brief the name of this option is long enough to make this description begin on a new line help description. */ const char *assume_multimeth_virtual_help; /**< @brief the name of this option is just as long as the maximum allowed, so this description begin on a new line help description. */ char * file_save_arg; /**< @brief save the passed options into a file. */ char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */ const char *file_save_help; /**< @brief save the passed options into a file help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int detailed_help_given ; /**< @brief Whether detailed-help was given. */ unsigned int full_help_given ; /**< @brief Whether full-help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int string_given ; /**< @brief Whether string was given. */ unsigned int int_given ; /**< @brief Whether int was given. */ unsigned int short_given ; /**< @brief Whether short was given. */ unsigned int long_given ; /**< @brief Whether long was given. */ unsigned int float_given ; /**< @brief Whether float was given. */ unsigned int double_given ; /**< @brief Whether double was given. */ unsigned int longdouble_given ; /**< @brief Whether longdouble was given. */ unsigned int longlong_given ; /**< @brief Whether longlong was given. */ unsigned int flag_given ; /**< @brief Whether flag was given. */ unsigned int function_given ; /**< @brief Whether function was given. */ unsigned int no_short_given ; /**< @brief Whether no-short was given. */ unsigned int opt_arg_given ; /**< @brief Whether opt-arg was given. */ unsigned int opt_arg_short_given ; /**< @brief Whether opt-arg-short was given. */ unsigned int required_given ; /**< @brief Whether required was given. */ unsigned int hidden_given ; /**< @brief Whether hidden was given. */ unsigned int dependant_given ; /**< @brief Whether dependant was given. */ unsigned int very_very_long_option_given ; /**< @brief Whether very-very-long-option was given. */ unsigned int assume_multimeth_virtual_given ; /**< @brief Whether assume-multimeth-virtual was given. */ unsigned int file_save_given ; /**< @brief Whether file-save was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_all_opts_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** @brief all the lines making the full help output (including hidden options) */ extern const char *gengetopt_args_info_full_help[]; /** @brief all the lines making the detailed help output (including hidden options and details) */ extern const char *gengetopt_args_info_detailed_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_all_opts_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_all_opts_cmd_parser_ext() instead */ int test_all_opts_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_all_opts_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_all_opts_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_all_opts_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_all_opts_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_all_opts_cmd_parser_print_help(void); /** * Print the full help (including hidden options) */ void test_all_opts_cmd_parser_print_full_help(void); /** * Print the detailed help (including hidden options and details) */ void test_all_opts_cmd_parser_print_detailed_help(void); /** * Print the version */ void test_all_opts_cmd_parser_print_version(void); /** * Initializes all the fields a test_all_opts_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_all_opts_cmd_parser_params_init(struct test_all_opts_cmd_parser_params *params); /** * Allocates dynamically a test_all_opts_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_all_opts_cmd_parser_params structure */ struct test_all_opts_cmd_parser_params *test_all_opts_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_all_opts_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_all_opts_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_all_opts_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_ALL_OPTS_CMD_H */ gengetopt-2.22.6/tests/test_multiple.sh.in0000664000175000017500000000114312044745036015523 00000000000000#! @SHELL@ # the next program must exit with success if $* ./test_multiple -s \\\"foo\\\" -s "bar" -s "hello" --noarg-noshort -i 100 -n -i 200 -s "world" --no-short-opt "check" --no-short-opt "this out" --noarg --no-short-opt=first,second, --noarg-noshort --no-short-opt=third,fourth,fifth -n -M --optarg-noshort="second arg for optarg" -M"first arg for optarg" --optarg="second arg for optarg" --longlong=1234567890 --optarg-noshort --file-save="test_multiple.save" --longlong=234567890 -L"1" --limited-interval="1" -L"2" -L"3" --longlong=34567890 --limited-open-right="1","2","3"; then true; else false; fi gengetopt-2.22.6/tests/no_multi_strings_cmd.ggo0000664000175000017500000000044112044745036016610 00000000000000package "no multi strings" version "0.1" purpose "Has multiple options none of which are strings" # inspired by Dave Swegen option "test" t "This is a test option" int typestr="A test value" default="5" no option "multi" - "This is a multi option" int typestr="Multivalue" multiple no gengetopt-2.22.6/tests/test_values_cc.cc0000664000175000017500000001041212045003074015167 00000000000000/* test_values_cc.cc test */ /* test values options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_values_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { unsigned int i; int result = 0; if (test_values_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } if (args_info.string_values_given) { printf ("specified --string-values with argument %s\n", args_info.string_values_arg); printf ("specified --string-values with (original) argument %s\n", args_info.string_values_orig); } if (!args_info.string_values_def_given) printf ("(un)"); printf ("specified --string-values-def with argument %s\n", args_info.string_values_def_arg); if (!args_info.string_values_def_argopt_given) printf ("(un)"); printf ("specified --string-values-def-argopt with argument %s\n", args_info.string_values_def_argopt_arg); if (args_info.string_values_no_short_given) { printf ("specified --string-values-no-short with argument %s\n", args_info.string_values_no_short_arg); } for (i = 0; i < args_info.multistring_values_given; ++i) { printf ("specified --multistring-values with argument %s\n", args_info.multistring_values_arg[i]); printf ("specified --multistring-values with (original) argument %s\n", args_info.multistring_values_orig[i]); } for (i = 0; i < args_info.multistring_values_def_given; ++i) { printf ("specified --multistring-values-def with argument %s\n", args_info.multistring_values_def_arg[i]); printf ("specified --multistring-values-def with (original) argument %s\n", (args_info.multistring_values_def_orig[i] ? args_info.multistring_values_def_orig[i] : "(null)")); } for (i = 0; i < args_info.multistring_values_no_short_given; ++i) printf ("specified --multistring-values-no-short with argument %s\n", args_info.multistring_values_no_short_arg[i]); if (args_info.int_values_given) { printf ("specified --int-values with argument %d\n", args_info.int_values_arg); printf ("specified --int-values with (original) argument %s\n", args_info.int_values_orig); } for (i = 0; i < args_info.int_values_m_given; ++i) { printf("specified --int-values-m with argument %d\n", args_info.int_values_m_arg[i]); printf ("specified --int-values-m with (original) argument %s\n", args_info.int_values_m_orig[i]); } if (!args_info.int_values_def_given) printf ("(un)"); printf ("specified --int-values-def with argument %d\n", args_info.int_values_def_arg); if (args_info.values_first_enums_given) printf("specified --values-first-enums with argument %d (%s)\n", args_info.values_first_enums_arg, test_values_cmd_parser_values_first_enums_values [args_info.values_first_enums_arg]); if (args_info.values_first_enums_plus_given) printf("specified --values-first-enums-plus with argument %d (%s)\n", args_info.values_first_enums_plus_arg, test_values_cmd_parser_values_first_enums_plus_values [args_info.values_first_enums_plus_arg]); if (!args_info.values_second_enums_given) printf ("(un)"); printf("specified --values-second-enums with argument %d (%s)\n", args_info.values_second_enums_arg, test_values_cmd_parser_values_second_enums_values [args_info.values_second_enums_arg]); for (i = 0; i < args_info.values_multiple_enums_given; ++i) { printf ("specified --values-multiple-enums with argument %d\n", args_info.values_multiple_enums_arg[i]); printf ("specified --values-multiple-enums with (original) argument %s\n", (args_info.values_multiple_enums_orig[i] ? args_info.values_multiple_enums_orig[i] : "(null)")); } if (args_info.file_save_given) { if (test_values_cmd_parser_file_save (args_info.file_save_arg, &args_info) == EXIT_FAILURE) result = 1; else printf ("saved configuration file %s\n", args_info.file_save_arg); } end: test_values_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/test_align_cmd.ggo0000664000175000017500000000107212044745036015343 00000000000000package "test align" version "1.0" purpose "this is just a test to check that the output of --help and --full-help are aligned just the same" option "hidden-option" m "This is the hidden option that is printed only with --full-help; thanks to its long description we force a possible different alignment for --full-help" optional hidden section "Operation modes and settings" sectiondesc="\nNon-absolute pathnames are relative to the executable's directory.\n" defmode "standalone" modeoption "non-hidden" y "non-hidden option" optional mode="standalone" gengetopt-2.22.6/tests/test_sections.sh.in0000664000175000017500000000016412044745036015521 00000000000000#! @SHELL@ # the next program must simply print the help if $* ./test_sections --help ; then true; else false; fi gengetopt-2.22.6/tests/test_align_cmd.c.test0000664000175000017500000003762512045003074015772 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_align_cmd.ggo --func-name=test_align_cmd_parser --file-name=test_align_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_align_cmd.h" const char *gengetopt_args_info_purpose = "this is just a test to check that the output of --help and --full-help are\naligned just the same"; const char *gengetopt_args_info_usage = "Usage: test align [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_full_help[] = { " -h, --help Print help and exit", " --full-help Print help, including hidden options, and exit", " -V, --version Print version and exit", " -m, --hidden-option This is the hidden option that is printed only with\n --full-help; thanks to its long description we force a\n possible different alignment for --full-help", "\nOperation modes and settings:", " \n Non-absolute pathnames are relative to the executable's directory.\n", "\n Mode: standalone", " -y, --non-hidden non-hidden option", 0 }; static void init_help_array(void) { gengetopt_args_info_help[0] = gengetopt_args_info_full_help[0]; gengetopt_args_info_help[1] = gengetopt_args_info_full_help[1]; gengetopt_args_info_help[2] = gengetopt_args_info_full_help[2]; gengetopt_args_info_help[3] = gengetopt_args_info_full_help[4]; gengetopt_args_info_help[4] = gengetopt_args_info_full_help[5]; gengetopt_args_info_help[5] = gengetopt_args_info_full_help[6]; gengetopt_args_info_help[6] = gengetopt_args_info_full_help[7]; gengetopt_args_info_help[7] = 0; } const char *gengetopt_args_info_help[8]; typedef enum {ARG_NO } test_align_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_align_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_align_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->full_help_given = 0 ; args_info->version_given = 0 ; args_info->hidden_option_given = 0 ; args_info->non_hidden_given = 0 ; args_info->standalone_mode_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); } static void init_args_info(struct gengetopt_args_info *args_info) { init_help_array(); args_info->help_help = gengetopt_args_info_full_help[0] ; args_info->full_help_help = gengetopt_args_info_full_help[1] ; args_info->version_help = gengetopt_args_info_full_help[2] ; args_info->hidden_option_help = gengetopt_args_info_full_help[3] ; args_info->non_hidden_help = gengetopt_args_info_full_help[7] ; } void test_align_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_ALIGN_CMD_PARSER_PACKAGE_NAME) ? TEST_ALIGN_CMD_PARSER_PACKAGE_NAME : TEST_ALIGN_CMD_PARSER_PACKAGE), TEST_ALIGN_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_align_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_align_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_align_cmd_parser_print_full_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_full_help[i]) printf("%s\n", gengetopt_args_info_full_help[i++]); } void test_align_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_align_cmd_parser_params_init(struct test_align_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_align_cmd_parser_params * test_align_cmd_parser_params_create(void) { struct test_align_cmd_parser_params *params = (struct test_align_cmd_parser_params *)malloc(sizeof(struct test_align_cmd_parser_params)); test_align_cmd_parser_params_init(params); return params; } static void test_align_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_align_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_ALIGN_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->full_help_given) write_into_file(outfile, "full-help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->hidden_option_given) write_into_file(outfile, "hidden-option", 0, 0 ); if (args_info->non_hidden_given) write_into_file(outfile, "non-hidden", 0, 0 ); i = EXIT_SUCCESS; return i; } int test_align_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_ALIGN_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_align_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_align_cmd_parser_free (struct gengetopt_args_info *args_info) { test_align_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_align_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_align_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_align_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_align_cmd_parser_params *params) { int result; result = test_align_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_align_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_align_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_align_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_align_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_align_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_align_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_align_cmd_parser_params.check_ambiguity * @param override @see test_align_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_align_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } static int check_modes( int given1[], const char *options1[], int given2[], const char *options2[]) { int i = 0, j = 0, errors = 0; while (given1[i] >= 0) { if (given1[i]) { while (given2[j] >= 0) { if (given2[j]) { ++errors; fprintf(stderr, "%s: option %s conflicts with option %s\n", package_name, options1[i], options2[j]); } ++j; } } ++i; } return errors; } int test_align_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_align_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_align_cmd_parser_init (args_info); test_align_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "full-help", 0, NULL, 0 }, { "version", 0, NULL, 'V' }, { "hidden-option", 0, NULL, 'm' }, { "non-hidden", 0, NULL, 'y' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVmy", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_align_cmd_parser_print_help (); test_align_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_align_cmd_parser_print_version (); test_align_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'm': /* This is the hidden option that is printed only with --full-help; thanks to its long description we force a possible different alignment for --full-help. */ if (update_arg( 0 , 0 , &(args_info->hidden_option_given), &(local_args_info.hidden_option_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "hidden-option", 'm', additional_error)) goto failure; break; case 'y': /* non-hidden option. */ args_info->standalone_mode_counter += 1; if (update_arg( 0 , 0 , &(args_info->non_hidden_given), &(local_args_info.non_hidden_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "non-hidden", 'y', additional_error)) goto failure; break; case 0: /* Long option with no short option */ if (strcmp (long_options[option_index].name, "full-help") == 0) { test_align_cmd_parser_print_full_help (); test_align_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); } case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_ALIGN_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_align_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_align_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/no_multi_strings_cmd.c.test0000664000175000017500000005626612045003074017242 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/no_multi_strings_cmd.ggo --func-name=no_multi_strings_cmd_parser --file-name=no_multi_strings_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "no_multi_strings_cmd.h" const char *gengetopt_args_info_purpose = "Has multiple options none of which are strings"; const char *gengetopt_args_info_usage = "Usage: no multi strings [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -t, --test=A test value This is a test option (default=`5')", " --multi=Multivalue This is a multi option", 0 }; typedef enum {ARG_NO , ARG_INT } no_multi_strings_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int no_multi_strings_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_multi_strings_cmd_parser_params *params, const char *additional_error); static int no_multi_strings_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->test_given = 0 ; args_info->multi_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->test_arg = 5; args_info->test_orig = NULL; args_info->multi_arg = NULL; args_info->multi_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->test_help = gengetopt_args_info_help[2] ; args_info->multi_help = gengetopt_args_info_help[3] ; args_info->multi_min = 0; args_info->multi_max = 0; } void no_multi_strings_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(NO_MULTI_STRINGS_CMD_PARSER_PACKAGE_NAME) ? NO_MULTI_STRINGS_CMD_PARSER_PACKAGE_NAME : NO_MULTI_STRINGS_CMD_PARSER_PACKAGE), NO_MULTI_STRINGS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { no_multi_strings_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void no_multi_strings_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void no_multi_strings_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void no_multi_strings_cmd_parser_params_init(struct no_multi_strings_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct no_multi_strings_cmd_parser_params * no_multi_strings_cmd_parser_params_create(void) { struct no_multi_strings_cmd_parser_params *params = (struct no_multi_strings_cmd_parser_params *)malloc(sizeof(struct no_multi_strings_cmd_parser_params)); no_multi_strings_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } /** * The passed arg parameter is NOT set to 0 from this function */ static void free_multiple_field(unsigned int len, void *arg, char ***orig) { unsigned int i; if (arg) { for (i = 0; i < len; ++i) { free_string_field(&((*orig)[i])); } free (arg); free (*orig); *orig = 0; } } static void no_multi_strings_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->test_orig)); free_multiple_field (args_info->multi_given, (void *)(args_info->multi_arg), &(args_info->multi_orig)); args_info->multi_arg = 0; for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int no_multi_strings_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", NO_MULTI_STRINGS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->test_given) write_into_file(outfile, "test", args_info->test_orig, 0); write_multiple_into_file(outfile, args_info->multi_given, "multi", args_info->multi_orig, 0); i = EXIT_SUCCESS; return i; } int no_multi_strings_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", NO_MULTI_STRINGS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = no_multi_strings_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void no_multi_strings_cmd_parser_free (struct gengetopt_args_info *args_info) { no_multi_strings_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int no_multi_strings_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return no_multi_strings_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int no_multi_strings_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_multi_strings_cmd_parser_params *params) { int result; result = no_multi_strings_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { no_multi_strings_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_multi_strings_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct no_multi_strings_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = no_multi_strings_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { no_multi_strings_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_multi_strings_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (no_multi_strings_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { no_multi_strings_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_multi_strings_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->multi_given, args_info->multi_min, args_info->multi_max, "'--multi'")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see no_multi_strings_cmd_parser_params.check_ambiguity * @param override @see no_multi_strings_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, no_multi_strings_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, no_multi_strings_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, no_multi_strings_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int no_multi_strings_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct no_multi_strings_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * multi_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) no_multi_strings_cmd_parser_init (args_info); no_multi_strings_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "test", 1, NULL, 't' }, { "multi", 1, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVt:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ no_multi_strings_cmd_parser_print_help (); no_multi_strings_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ no_multi_strings_cmd_parser_print_version (); no_multi_strings_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 't': /* This is a test option. */ if (update_arg( (void *)&(args_info->test_arg), &(args_info->test_orig), &(args_info->test_given), &(local_args_info.test_given), optarg, 0, "5", ARG_INT, check_ambiguity, override, 0, 0, "test", 't', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* This is a multi option. */ if (strcmp (long_options[option_index].name, "multi") == 0) { if (update_multiple_arg_temp(&multi_list, &(local_args_info.multi_given), optarg, 0, 0, ARG_INT, "multi", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", NO_MULTI_STRINGS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ update_multiple_arg((void *)&(args_info->multi_arg), &(args_info->multi_orig), args_info->multi_given, local_args_info.multi_given, 0, ARG_INT, multi_list); args_info->multi_given += local_args_info.multi_given; local_args_info.multi_given = 0; if (check_required) { error_occurred += no_multi_strings_cmd_parser_required2 (args_info, argv[0], additional_error); } no_multi_strings_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (multi_list, 0 ); no_multi_strings_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_modes.sh.in0000664000175000017500000000047612044745036015007 00000000000000#! @SHELL@ if $* ./test_modes -a -A; then if $* ./test_modes -a -b -A; then if $* ./test_modes -a foo -m10 -d bar; then false; else if $* ./test_modes -m10 -d bar; then false; else true; fi; fi; else false; fi else false; fi gengetopt-2.22.6/tests/test_section_with_all_hidden.ggo0000664000175000017500000000057212044745036020274 00000000000000# this contains only hidden options in a section package "only_hidden" version "0.1" section "First section. This contains non hidden options" option "nonhidden" - "non hidden" string option "nonhidden2" - "non hidden2" string section "Hidden section. This contains only hidden options" option "hidden" - "hidden" string hidden option "hidden2" - "hidden2" string hidden gengetopt-2.22.6/tests/test.output0000664000175000017500000023305412045003074014127 00000000000000*** no_strings *** no_multi_strings *** no_multi_types *** no_unamed *** no_optgiven.sh ./no_optgiven: '--foo' ('-i') option required the no_optgiven_cmd_parser2 returned successfully ./no_optgiven2: '--foo' ('-i') option required *** more_than_once.sh foo option: 10 bar option: hey arg: test1 arg: test2 arg: test3 foo option: 10 bar option: hey arg: test1 arg: test2 arg: test3 *** canonize-names *** no_prog_name specified --required: foo additional: unamed *** default_values foo-opt is given: 0 bar-opt is given: 0 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15000 Value of bar-opt: this is a default Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 *** default_cmdline Value of foo: 15000 Value of bar: this is a default *** test_all_opts.sh specified --opt-arg specified --opt-arg-short specified --opt-arg with argument bar specified --opt-arg-short with argument foobar specified --hidden: 10 *** test_all_opts_file_save.sh specified --opt-arg specified --opt-arg-short *** test_groups.sh ./test_groups: 0 options of group grp1 were given. One is required. ./test_groups: 2 options of group grp1 were given. One is required. ./test_groups: 2 options of group my grp2 were given. At most one is required. ./test_groups: 0 options of group grp1 were given. One is required. optA given optA given optA arg: foo optAmul given 4 time(s) optAmul arg: foo optAmul arg: bar optAmul arg: (null) optAmul arg: aaa *** test_modes.sh optA given optA given ./test_modes: option --optd conflicts with option --opta ./test_modes: option --optd conflicts with option --mopt ./test_modes: option --opta conflicts with option --mopt ./test_modes: '--optA' ('-A') option required ./test_modes: option --optd conflicts with option --mopt *** test_conf_parser.sh value of required: this is a test value of string: another value of no-short_given: 1 value of int: 100 value of float: 3.140000 value of multi-string_given: 8 value of multi-string: -1 value of multi-string: zero value of multi-string: first value of multi-string: second value of multi-string: third value of multi-string: fourth value of multi-string: fifth value of multi-string: sixth value of multi-string-def_given: 0 default value of multi-string-def: this default value of opta: FOO noarg given 3 times noarg_noshort given 2 times opt-arg given: 1 opt-arg value: not given saved configuration file test_conf_parser.save *** test_conf_parser_ov.sh value of required: bar value of string: another value of no-short_given: 1 value of int: 100 value of float: 2.140000 value of multi-string_given: 6 value of multi-string: first value of multi-string: second value of multi-string: third value of multi-string: fourth value of multi-string: fifth value of multi-string: sixth value of multi-string-def_given: 0 default value of multi-string-def: this default *** test_conf_parser_ov2.sh value of required: bar value of string: another value of no-short_given: 1 value of int: 100 value of float: 2.140000 *** test_conf_parser_ov3.sh value of required: bar value of string: another value of no-short_given: 1 value of int: 100 value of float: 2.140000 value of multi-string_given: 7 value of multi-string: first value of multi-string: second value of multi-string: value of multi-string: third value of multi-string: from another file value of multi-string: value of multi-string: last? value of multi-string-def_given: 0 default value of multi-string-def: this default *** test_conf_parser_ov4.sh value of required: this is a test value of string: another value of no-short_given: 1 value of int: 100 value of float: 3.140000 ./test_conf_parser_ov4: `--required' (`-r') option given more than once *** test_conf_parser_err.sh test_conf_parser: option '--string' requires an argument *** test_conf_parser_err_string.sh test_conf_parser:../../tests/test_conf_err_string.conf:3: malformed string in configuration file test_conf_parser:../../tests/test_conf_err_string2.conf:3: unterminated string in configuration file *** test_conf_parser_grp.sh value of required: this is a test value of string: another value of no-short_given: 1 value of int: 100 value of float: 3.140000 value of multi-string_given: 4 value of multi-string: first value of multi-string: second value of multi-string: value of multi-string: third value of multi-string-def_given: 0 default value of multi-string-def: this default value of opta: BAR noarg given 0 times noarg_noshort given 0 times opt-arg given: 0 opt-arg value: not given *** test_conf_parser_save.sh read configuration file: test_conf_parser.save value of required: this is a test value of string: another value of no-short_given: 1 value of int: 100 value of float: 3.140000 value of multi-string_given: 8 value of multi-string: -1 value of multi-string: zero value of multi-string: first value of multi-string: second value of multi-string: third value of multi-string: fourth value of multi-string: fifth value of multi-string: sixth value of multi-string-def_given: 0 default value of multi-string-def: this default value of opta: FOO noarg given 3 times noarg_noshort given 2 times opt-arg given: 1 opt-arg value: not given *** test_multiple.sh passed string: \"foo\" passed string: bar passed string: hello passed string: world passed int: 100 passed int: 200 default float: 15000.000000 passed no-short-opt: check passed no-short-opt: this out passed no-short-opt: first passed no-short-opt: second passed no-short-opt: third passed no-short-opt: fourth passed no-short-opt: fifth noarg given 3 times noarg_noshort given 2 times optarg_given 3 times optarg argument: no arg given optarg argument: first arg for optarg optarg argument: second arg for optarg longlong_given 3 times longlong argument: 1234567890 longlong argument: 234567890 longlong argument: 34567890 optarg_noshort_given 2 times optarg_noshort argument: second arg for optarg optarg_noshort argument: no arg given *** test_simple_multiple_default.sh default value: foo *** test_simple_multiple.sh passed string: first passed string: second passed string: third *** test_multiple_err.sh ./test_multiple: option requires an argument -- 's' ./test_multiple: '--int' ('-i') option required ./test_multiple: '--limited' ('-L') option occurrences must be 3 ./test_multiple: '--limited-interval' option occurrences must be between 1 and 3 ./test_multiple: '--limited-open-right' option occurrences must be at least 3 ./test_multiple: '--int' ('-i') option required ./test_multiple: '--limited-open-left' option occurrences must be at most 3 *** test_sections.sh test_sections 1.0 Usage: test_sections [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option First section. This "section" definition has no description, since the description is in the definition itself, that is wrapped too: -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option Second section: The following options belong to the second section by the way this second section also has this neat description, and it is quite long so it should require some kind of line wrapping, but don't worry: gengetopt will wrap it for you! ;-) -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option Last section: --no-short no short option -r, --required=STRING required option (mandatory) *** test_default_values.sh foo-opt is given: 0 bar-opt is given: 0 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15000 Value of bar-opt: this is a default Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 foo-opt is given: 1 bar-opt is given: 1 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15000 Value of bar-opt: this is a default Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 foo-opt is given: 1 bar-opt is given: 1 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15 Value of bar-opt: hi Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 foo-opt is given: 1 bar-opt is given: 1 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15000 Value of bar-opt: this is a default Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 foo-opt is given: 1 bar-opt is given: 1 Value of foo: 15000 Value of bar: this is a default Value of foo-opt: 15 Value of bar-opt: hi Value of foofloat: 15000.000000 Value of foodouble: 15000.000000 Value of PI: 3.1415926536 ./default_values: invalid numeric value: a5 *** test_values.sh specified --string-values with argument foobar specified --string-values with (original) argument foob (un)specified --string-values-def with argument bar specified --string-values-def-argopt with argument foobar specified --string-values-no-short with argument bar specified --multistring-values with argument foo specified --multistring-values with (original) argument foo specified --multistring-values with argument bar specified --multistring-values with (original) argument b specified --multistring-values with argument bar specified --multistring-values with (original) argument bar specified --multistring-values with argument foo specified --multistring-values with (original) argument foo specified --multistring-values-def with argument bar specified --multistring-values-def with (original) argument bar specified --multistring-values-def with argument foo specified --multistring-values-def with (original) argument (null) specified --multistring-values-no-short with argument foo specified --multistring-values-no-short with argument foo specified --multistring-values-no-short with argument bar specified --multistring-values-no-short with argument bar specified --multistring-values-no-short with argument bar specified --multistring-values-no-short with argument foo specified --int-values with argument 180 specified --int-values with (original) argument 1 specified --int-values-m with argument 1800 specified --int-values-m with (original) argument 1 specified --int-values-m with argument 2700 specified --int-values-m with (original) argument 27 (un)specified --int-values-def with argument 180 specified --values-first-enums-plus with argument 2 (-foo) (un)specified --values-second-enums with argument 1 (180) specified --values-multiple-enums with argument 0 specified --values-multiple-enums with (original) argument FI specified --values-multiple-enums with argument 1 specified --values-multiple-enums with (original) argument S specified --values-multiple-enums with argument 2 specified --values-multiple-enums with (original) argument T specified --values-multiple-enums with argument 3 specified --values-multiple-enums with (original) argument FOURTH --values-unspecified-enums: -1 saved configuration file test_values.save *** test_values_err.sh ./test_values: ambiguous argument, "fo", for option `--string-values' (`-s') ./test_values: invalid argument, "fooa", for option `--multistring-values' (`-S') ./test_values: invalid argument, "fooa", for option `--string-values-no-short' ./test_values: invalid argument, "fooa", for option `--multistring-values-no-short' *** test_dep.sh ./test_all_opts: '--dependant' ('-A') option depends on option 'opt-arg' specified --opt-arg with argument bar *** test_manual_help.sh specified --height 100 --height=INT this is the description of height test_manual_help 1.0 Usage: test_manual_help [OPTIONS]... [FILES]... -h, --help show help (possibly of other options) -?, --detailed-help show detailed help -V, --version show version of the program --height=INT this is the description of height These are the details of option height --vavoom=STRING this is the description of vavoom specified --height 100 specified --height 100 --height=INT this is the description of height specified --vavoom foo --vavoom=STRING this is the description of vavoom test_manual_help 1.0 specified --height 100 *** test_multiple_parsers.sh second cmdline: -a20 -b10 --my-multi=a,b,c,d,e,f --option-a: 20 --option-b: 10 --my-multi: a --my-multi: b --my-multi: c --my-multi: d --my-multi: e --my-multi: f second cmdline: --my-multi g --my-multi: g first cmdline: -M400 -a10 --multi 100,200,300 --option-a: 10 --multi: 400 --multi: 100 --multi: 200 --multi: 300 first cmdline: -M500 -M600 --multi: 500 --multi: 600 *** test_sections_option_help help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit string_help: -s, --string=STRING string option int_help: -i, --int=INT int option short_help: -S, --short=SHORT short option long_help: -l, --long=LONG long option float_help: -f, --float=FLOAT float option double_help: -d, --double=DOUBLE double option longdouble_help: -D, --longdouble=LONGDOUBLE longdouble option longlong_help: -L, --longlong=LONGLONG longlong option flag_help: -F, --flag flag option (default=on) function_help: -u, --function function option no_short_help: --no-short no short option required_help: -r, --required=STRING required option (mandatory) *** test_all_opts_option_help help_help: -h, --help Print help and exit full_help_help: --full-help Print help, including hidden options, and exit version_help: -V, --version Print version and exit string_help: -s, --string=STRING string option int_help: -i, --int=INT int option short_help: -S, --short=SHORT short option long_help: -l, --long=LONG long option float_help: -f, --float=FLOAT float option double_help: -d, --double=DOUBLE double option longdouble_help: -D, --longdouble=LONGDOUBLE longdouble option longlong_help: -L, --longlong=LONGLONG longlong option flag_help: -F, --flag flag option (default=on) function_help: -u, --function function option no_short_help: --no-short no short option opt_arg_help: --opt-arg[=STRING] option with optional arg opt_arg_short_help: -o, --opt-arg-short[=STRING] option with optional arg (short) required_help: -r, --required=STRING required option (mandatory) hidden_help: -H, --hidden=INT hidden option dependant_help: -A, --dependant=STRING option that depends on opt-arg very_very_long_option_help: --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line assume_multimeth_virtual_help: -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line file_save_help: --file-save=STRING save the passed options into a file *** test_groups_option_help help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit opta_help: -a, --opta string a optA_help: -A, --optA[=STRING] string A optAmul_help: -M, --optAmul[=STRING] string M optb_help: -b, --optb string b optc_help: --optc string c optd_help: -d, --optd string d *** test_modes_option_help help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit opta_help: -a, --opta string a optA_help: -A, --optA[=STRING] string A (mandatory) optAmul_help: -M, --optAmul[=STRING] string M optb_help: -b, --optb string b optc_help: --optc string c optd_help: -d, --optd string d (mandatory) mopt_help: -m, --mopt=INT option of my mode *** test_no_options *** test_newlines *** test_text *** test_only_flags *** test_usage *** test_show_help.sh test_all_opts 1.0 This is just a gengetopt's test file Usage: test_all_opts [OPTIONS]... This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. test_all_opts 1.0 test_values 1.0 This is just a test file to test options with the list of acceptable values Usage: test_values [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -s, --string-values=STRING string option with values (possible values="foo", "foa", "bar", "foobar", "barfoo") --string-values-plus=STRING string option with values containing + and - (possible values="+foo", "-foo", "bar", "foobar", "barfoo", "+foobar", "-barfoo") --string-values-def=STRING string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') --string-values-def-argopt[=STRING] string option with values and default and optional argument (possible values="foo", "bar", "foobar", "barfoo" default=`foobar') --string-values-no-short=STRING string option with values no short (possible values="foo", "bar", "foobar", "barfoo") -S, --multistring-values=STRING multiple string option with values (possible values="foo", "bar") --multistring-values-def[=STRING] multiple string option with values and default (possible values="foo", "bar" default=`foo') --multistring-values-no-short=BAR multiple string option with values no-short (possible values="foo", "bar") Group: group1 --string-values-group=FOO group string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') -i, --int-values=INT int option with values (possible values="90", "180", "270", "360") -I, --int-values-m=INT multiple int option with values (possible values="900", "1800", "2700", "3600") --int-values-def=INT int option with values and default (possible values="90", "180", "270", "360" default=`180') -e, --values-first-enums=ENUM option with values and enums 1 (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") -E, --values-first-enums-plus=ENUM option with values and enums with plus and minus 1 (possible values="+foo", "+bar", "-foo", "-bar", "all") --values-second-enums=ENUM option with values and enums 2 with default (possible values="90", "180", "270", "360" default=`180') -W, --values-multiple-enums=ENUM multiple option with values and enums (possible values="FIRST", "SECOND", "THIRD", "FOURTH" default=`FOURTH') -N, --values-unspecified-enums=ENUM option with values that will not be specified on the command line (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") --file-save=STRING save the passed options into a file *** test_err.sh diff wrong_default.err.out ../../tests/wrong_default.err diff wrong_dep.err.out ../../tests/wrong_dep.err diff wrong_enum_use.err.out ../../tests/wrong_enum_use.err diff wrong_flag2.err.out ../../tests/wrong_flag2.err diff wrong_flag.err.out ../../tests/wrong_flag.err diff wrong_group2.err.out ../../tests/wrong_group2.err diff wrong_group.err.out ../../tests/wrong_group.err diff wrong_help_redef.err.out ../../tests/wrong_help_redef.err diff wrong_multiple_occurrence.err.out ../../tests/wrong_multiple_occurrence.err diff wrong_numeric_value.err.out ../../tests/wrong_numeric_value.err diff wrong_version_redef.err.out ../../tests/wrong_version_redef.err *** no_strings -h no_strings 1.0 Usage: no_strings [--foo|-i] -h, --help Print help and exit -V, --version Print version and exit -i, --foo=INT foo option *** no_multi_strings -h no multi strings 0.1 Has multiple options none of which are strings Usage: no multi strings [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -t, --test=A test value This is a test option (default=`5') --multi=Multivalue This is a multi option *** no_multi_types -h no multi types 0.1 Has multiple options none of which has type Usage: no multi types [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -t, --test=A test value This is a test option (default=`5') --multi This is a multi option with no type *** no_unamed -h no_unamed 1.0 Usage: no_unamed [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -i, --foo=STRING foo string option *** no_optgiven -h no_optgiven 1.0 Usage: no_optgiven [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -i, --foo=INT foo option *** no_optgiven2 -h no_optgiven 1.0 Usage: no_optgiven [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -i, --foo=INT foo option *** more_than_once -h more_than_once 1.0 Usage: more_than_once [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -f, --foo=INT foo option -b, --bar=STRING bar option *** no_prog_name -h specified --required: foo additional: unamed *** canonize-names -h canonize_names 1.0 Usage: canonize_names [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -i, --foo-bar=INT foo-bar option -j, --foo.foo=INT foo.foo option *** default_values -h default_values 1.0 Usage: default_values [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -f, --foo=INT foo option (default=`15000') -b, --bar=STRING bar option (default=`this is a default') -F, --foo-opt[=INT] foo option with optional arg (default=`15000') -B, --bar-opt[=STRING] bar option with optional arg (default=`this is a default') --foofloat=FLOAT foo float option (default=`15000') --foodouble=DOUBLE foo double option (default=`15000') -p, --pi=DOUBLE PI option (default=`3.1415926536') -s, --timeout=123456789012 number of seconds after the scanning is cancelled if no progress is shown at all. (default=`120') *** default_cmdline -h GNU gengetopt 1.0 Usage: gengetopt [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -f, --foo=INT foo option (default=`15000') -b, --bar=STRING bar option (default=`this is a default') *** test_all_opts -h test_all_opts 1.0 This text is printed after the version during --version this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test! This is just a gengetopt's test file Usage: test_all_opts [OPTIONS]... [FILES]... This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option (mandatory) Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. *** test_groups -h test_groups 1.0 Usage: test_groups [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit some groups just for testing: Group: grp1 an option of this group is required Notice that this description is quite long so it may spawn many lines... fortunately gengetopt will wrap it for you :-) -a, --opta string a -A, --optA[=STRING] string A -M, --optAmul[=STRING] string M -b, --optb string b Group: my grp2 --optc string c -d, --optd string d *** test_modes -h test_modes 1.0 Usage: test_modes [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit some non mode options: -N, --no-mode a generic option not beloging to any mode --no-mode2=STRING another generic option not beloging to any mode some modes just for testing: Mode: mode1 any option of this mode is in contrast with any option of the other mode Notice that this description is quite long so it may spawn many lines... fortunately gengetopt will wrap it for you :-) -a, --opta string a -A, --optA[=STRING] string A (mandatory) -M, --optAmul[=STRING] string M -b, --optb string b Mode: mode 2 --optc string c -d, --optd string d (mandatory) Mode: my mode -m, --mopt=INT option of my mode *** test_conf_parser -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_conf_parser_ov -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_conf_parser_ov2 -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_conf_parser_ov3 -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_conf_parser_ov4 -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_conf_parser_file_save -h test_conf_parser 1.0 Usage: test_conf_parser [OPTIONS]... [OTHER NAMES]... -h, --help Print help and exit -V, --version Print version and exit Group: grp1 an option of this group is required -a, --opta=STRING string a -b, --optb=STRING string b Group: my grp2 --optc string c -C, --optd string d -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option -r, --required=STRING required option -c, --conf-file=STRING config file (default=`test_conf.conf') -M, --multi-string=STRING multiple string option --multi-string-def=STRING multiple string option with default (default=`this default') -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short --opt-arg[=STRING] option with optional arg --file-save=STRING save the passed options into a file *** test_multiple -h test_multiple 1.0 Usage: test_multiple [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string=STRING string option (default=`foo') -i, --int=INT int option (mandatory) -S, --short=SHORT short option -l, --long=LONG long option --longlong=LONGLONG long long option -L, --limited=STRING limited multiple option --limited-interval=STRING limited multiple option (with interval) --big-limited-interval=STRING limited multiple option (with interval) --limited-open-right=STRING limited multiple option (with interval right open) --limited-open-left=STRING limited multiple option (with interval left open) -f, --float=FLOAT float option (default=`15000') --no-short-opt=STRING string option with no short -n, --noarg multiple option with no arg --noarg-noshort multiple option with no arg and no short -M, --optarg[=ID] multi with optional args --optarg-noshort[=ID] multi with optional args and no short --file-save=STRING save the passed options into a file *** test_simple_multiple -h test_simple_multiple 1.0 Usage: test_simple_multiple [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string=STRING string option (default=`foo') *** test_sections -h test_sections 1.0 Usage: test_sections [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option First section. This "section" definition has no description, since the description is in the definition itself, that is wrapped too: -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option Second section: The following options belong to the second section by the way this second section also has this neat description, and it is quite long so it should require some kind of line wrapping, but don't worry: gengetopt will wrap it for you! ;-) -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option Last section: --no-short no short option -r, --required=STRING required option (mandatory) *** test_values -h test_values 1.0 This is just a test file to test options with the list of acceptable values Usage: test_values [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string-values=STRING string option with values (possible values="foo", "foa", "bar", "foobar", "barfoo") --string-values-plus=STRING string option with values containing + and - (possible values="+foo", "-foo", "bar", "foobar", "barfoo", "+foobar", "-barfoo") --string-values-def=STRING string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') --string-values-def-argopt[=STRING] string option with values and default and optional argument (possible values="foo", "bar", "foobar", "barfoo" default=`foobar') --string-values-no-short=STRING string option with values no short (possible values="foo", "bar", "foobar", "barfoo") -S, --multistring-values=STRING multiple string option with values (possible values="foo", "bar") --multistring-values-def[=STRING] multiple string option with values and default (possible values="foo", "bar" default=`foo') --multistring-values-no-short=BAR multiple string option with values no-short (possible values="foo", "bar") Group: group1 --string-values-group=FOO group string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') -i, --int-values=INT int option with values (possible values="90", "180", "270", "360") -I, --int-values-m=INT multiple int option with values (possible values="900", "1800", "2700", "3600") --int-values-def=INT int option with values and default (possible values="90", "180", "270", "360" default=`180') -e, --values-first-enums=ENUM option with values and enums 1 (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") -E, --values-first-enums-plus=ENUM option with values and enums with plus and minus 1 (possible values="+foo", "+bar", "-foo", "-bar", "all") --values-second-enums=ENUM option with values and enums 2 with default (possible values="90", "180", "270", "360" default=`180') -W, --values-multiple-enums=ENUM multiple option with values and enums (possible values="FIRST", "SECOND", "THIRD", "FOURTH" default=`FOURTH') -N, --values-unspecified-enums=ENUM option with values that will not be specified on the command line (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") --file-save=STRING save the passed options into a file *** test_values_cc -h test_values 1.0 This is just a test file to test options with the list of acceptable values Usage: test_values [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -s, --string-values=STRING string option with values (possible values="foo", "foa", "bar", "foobar", "barfoo") --string-values-plus=STRING string option with values containing + and - (possible values="+foo", "-foo", "bar", "foobar", "barfoo", "+foobar", "-barfoo") --string-values-def=STRING string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') --string-values-def-argopt[=STRING] string option with values and default and optional argument (possible values="foo", "bar", "foobar", "barfoo" default=`foobar') --string-values-no-short=STRING string option with values no short (possible values="foo", "bar", "foobar", "barfoo") -S, --multistring-values=STRING multiple string option with values (possible values="foo", "bar") --multistring-values-def[=STRING] multiple string option with values and default (possible values="foo", "bar" default=`foo') --multistring-values-no-short=BAR multiple string option with values no-short (possible values="foo", "bar") Group: group1 --string-values-group=FOO group string option with values and default (possible values="foo", "bar", "foobar", "barfoo" default=`bar') -i, --int-values=INT int option with values (possible values="90", "180", "270", "360") -I, --int-values-m=INT multiple int option with values (possible values="900", "1800", "2700", "3600") --int-values-def=INT int option with values and default (possible values="90", "180", "270", "360" default=`180') -e, --values-first-enums=ENUM option with values and enums 1 (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") -E, --values-first-enums-plus=ENUM option with values and enums with plus and minus 1 (possible values="+foo", "+bar", "-foo", "-bar", "all") --values-second-enums=ENUM option with values and enums 2 with default (possible values="90", "180", "270", "360" default=`180') -W, --values-multiple-enums=ENUM multiple option with values and enums (possible values="FIRST", "SECOND", "THIRD", "FOURTH" default=`FOURTH') -N, --values-unspecified-enums=ENUM option with values that will not be specified on the command line (possible values="FOO", "BAR", "ANOTHER", "SOMETHING") --file-save=STRING save the passed options into a file *** test_redef_help -h specified --height *** test_manual_help -h test_manual_help 1.0 Usage: test_manual_help [OPTIONS]... [FILES]... -h, --help show help (possibly of other options) -?, --detailed-help show detailed help -V, --version show version of the program --height=INT this is the description of height --vavoom=STRING this is the description of vavoom *** test_no_handle_help -h #################### # HEADER #################### test_no_handle_help 1.0 Usage: test_no_handle_help [OPTIONS]... [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit --height=INT this is the description of height --vavoom=STRING this is the description of vavoom #################### # FOOTER #################### *** test_multiple_parsers -h GNU gengetopt 1.0 Usage: gengetopt [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -F, --first-cmd=first command the first command line to parse (mandatory) -S, --second-cmd=second command the second command line to parse (mandatory) *** test_sections_option_help -h help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit string_help: -s, --string=STRING string option int_help: -i, --int=INT int option short_help: -S, --short=SHORT short option long_help: -l, --long=LONG long option float_help: -f, --float=FLOAT float option double_help: -d, --double=DOUBLE double option longdouble_help: -D, --longdouble=LONGDOUBLE longdouble option longlong_help: -L, --longlong=LONGLONG longlong option flag_help: -F, --flag flag option (default=on) function_help: -u, --function function option no_short_help: --no-short no short option required_help: -r, --required=STRING required option (mandatory) *** test_all_opts_option_help -h help_help: -h, --help Print help and exit full_help_help: --full-help Print help, including hidden options, and exit version_help: -V, --version Print version and exit string_help: -s, --string=STRING string option int_help: -i, --int=INT int option short_help: -S, --short=SHORT short option long_help: -l, --long=LONG long option float_help: -f, --float=FLOAT float option double_help: -d, --double=DOUBLE double option longdouble_help: -D, --longdouble=LONGDOUBLE longdouble option longlong_help: -L, --longlong=LONGLONG longlong option flag_help: -F, --flag flag option (default=on) function_help: -u, --function function option no_short_help: --no-short no short option opt_arg_help: --opt-arg[=STRING] option with optional arg opt_arg_short_help: -o, --opt-arg-short[=STRING] option with optional arg (short) required_help: -r, --required=STRING required option (mandatory) hidden_help: -H, --hidden=INT hidden option dependant_help: -A, --dependant=STRING option that depends on opt-arg very_very_long_option_help: --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line assume_multimeth_virtual_help: -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line file_save_help: --file-save=STRING save the passed options into a file *** test_groups_option_help -h help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit opta_help: -a, --opta string a optA_help: -A, --optA[=STRING] string A optAmul_help: -M, --optAmul[=STRING] string M optb_help: -b, --optb string b optc_help: --optc string c optd_help: -d, --optd string d *** test_modes_option_help -h help_help: -h, --help Print help and exit version_help: -V, --version Print version and exit opta_help: -a, --opta string a optA_help: -A, --optA[=STRING] string A (mandatory) optAmul_help: -M, --optAmul[=STRING] string M optb_help: -b, --optb string b optc_help: --optc string c optd_help: -d, --optd string d (mandatory) mopt_help: -m, --mopt=INT option of my mode *** test_no_options -h test_no_options 1.0 This is a program with no option but the default ones Usage: test_no_options [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit *** test_newlines -h GNU gengetopt 2.22.6 Usage: gengetopt [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -F, --format=fmt this is the \nformat used for find -printf (default=`%p\t%s\n') *** test_text -h GNU gengetopt 2.22.6 Usage: gengetopt [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit Section 1: -s, --str-opt=filename A string option, for a filename explain more about the string option some text after section 2 Section 2: -i, --int-opt=INT A int option some final text *** test_only_flags -h test_only_flags 1.0 Usage: test_only_flags [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -f, --foo foo option (default=on) *** test_usage -h foo 1.0 Highlight the syntax of a source file (e.g. Java) into a specific format (e.g. HTML) Usage: 1. source-highlight [OPTIONS]... < input_file > output_file 2. source-highlight [OPTIONS]... -i input_file -o output_file 3. source-highlight [OPTIONS]... [FILES]... -h, --help Print help and exit -V, --version Print version and exit -i, --input=filename input file. default std input -o, --output=filename output file. default std output (when the third invocation form is used). If STDOUT is specified, the output is directed to standard output *** test_all_opts --full-help test_all_opts 1.0 This text is printed after the version during --version this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test! This is just a gengetopt's test file Usage: test_all_opts [OPTIONS]... [FILES]... This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option (mandatory) Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -H, --hidden=INT hidden option -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. *** test_all_opts --detailed-help test_all_opts 1.0 This text is printed after the version during --version this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test! This is just a gengetopt's test file Usage: test_all_opts [OPTIONS]... [FILES]... This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option a `function' option is basically an option with no argument. It can be used, e.g., to specify a specific behavior for a program. Well, this further explanation is quite useless, but it's only to show an example of an option with details, which will be printed only when --detailed-help is given at the command line. --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option (mandatory) NOTICE: This option is required, so, unless you specify (-h)--help or (-V)--version, you must always specify this option (and its argument) at command line. Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -H, --hidden=INT hidden option -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. *** test_no_handle_help --detailed-help #################### # HEADER #################### test_no_handle_help 1.0 Usage: test_no_handle_help [OPTIONS]... [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit --height=INT this is the description of height These are the details of option height --vavoom=STRING this is the description of vavoom #################### # FOOTER #################### test_all_opts 1.0 This is just a gengetopt's test file Usage: test_all_opts -rSTRING|--required=STRING [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sSTRING|--string=STRING] [-iINT|--int=INT] [-SSHORT|--short=SHORT] [-lLONG|--long=LONG] [-fFLOAT|--float=FLOAT] [-dDOUBLE|--double=DOUBLE] [-DLONGDOUBLE|--longdouble=LONGDOUBLE] [-LLONGLONG|--longlong=LONGLONG] [-F|--flag] [-u|--function] [--no-short] [--opt-arg=STRING] [-oSTRING|--opt-arg-short=STRING] [-ASTRING|--dependant=STRING] [--very-very-long-option=STRING] [-y|--assume-multimeth-virtual] [--file-save=STRING] This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. test_all_opts 1.0 This is just a gengetopt's test file Usage: test_all_opts -rSTRING|--required=STRING [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sSTRING|--string=STRING] [-iINT|--int=INT] [-SSHORT|--short=SHORT] [-lLONG|--long=LONG] [-fFLOAT|--float=FLOAT] [-dDOUBLE|--double=DOUBLE] [-DLONGDOUBLE|--longdouble=LONGDOUBLE] [-LLONGLONG|--longlong=LONGLONG] [-F|--flag] [-u|--function] [--no-short] [--opt-arg=STRING] [-oSTRING|--opt-arg-short=STRING] [-ASTRING|--dependant=STRING] [--very-very-long-option=STRING] [-y|--assume-multimeth-virtual] [--file-save=STRING] This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -H, --hidden=INT hidden option -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. test_modes 1.0 Usage: test_modes [-h|--help] [-V|--version] [-N|--no-mode] [--no-mode2=STRING] or : test_modes -d|--optd [--optc] or : test_modes -ASTRING|--optA=STRING [-a|--opta] [-MSTRING|--optAmul=STRING] [-b|--optb] or : test_modes [-mINT|--mopt=INT] -h, --help Print help and exit -V, --version Print version and exit some non mode options: -N, --no-mode a generic option not beloging to any mode --no-mode2=STRING another generic option not beloging to any mode some modes just for testing: Mode: mode1 any option of this mode is in contrast with any option of the other mode Notice that this description is quite long so it may spawn many lines... fortunately gengetopt will wrap it for you :-) -a, --opta string a -A, --optA[=STRING] string A -M, --optAmul[=STRING] string M -b, --optb string b Mode: mode 2 --optc string c -d, --optd string d Mode: my mode -m, --mopt=INT option of my mode test_all_opts 1.0 This is just a gengetopt's test file Usage: test_all_opts -rSTRING|--required=STRING [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sSTRING|--string=STRING] [-iINT|--int=INT] [-SSHORT|--short=SHORT] [-lLONG|--long=LONG] [-fFLOAT|--float=FLOAT] [-dDOUBLE|--double=DOUBLE] [-DLONGDOUBLE|--longdouble=LONGDOUBLE] [-LLONGLONG|--longlong=LONGLONG] [-F|--flag] [-u|--function] [--no-short] [--opt-arg=STRING] [-oSTRING|--opt-arg-short=STRING] [-ASTRING|--dependant=STRING] [--very-very-long-option=STRING] [-y|--assume-multimeth-virtual] [--file-save=STRING] This is just a test file to test all possible command line type options. In ggo files comments start with # and end at EOL -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --string=STRING string option -i, --int=INT int option -S, --short=SHORT short option -l, --long=LONG long option -f, --float=FLOAT float option -d, --double=DOUBLE double option -D, --longdouble=LONGDOUBLE longdouble option -L, --longlong=LONGLONG longlong option -F, --flag flag option (default=on) -u, --function function option a `function' option is basically an option with no argument. It can be used, e.g., to specify a specific behavior for a program. Well, this further explanation is quite useless, but it's only to show an example of an option with details, which will be printed only when --detailed-help is given at the command line. --no-short no short option --opt-arg[=STRING] option with optional arg -o, --opt-arg-short[=STRING] option with optional arg (short) -r, --required=STRING required option NOTICE: This option is required, so, unless you specify (-h)--help or (-V)--version, you must always specify this option (and its argument) at command line. Before the dependant option there is a hidden option, so it shouldn't be visible in the output of --help, but it will be visible in the output of --full-help. -H, --hidden=INT hidden option -A, --dependant=STRING option that depends on opt-arg This is a text line just to write something in the output Notice that a text line can contain line breaks, just like this very text, and that, just like all the other texts, it is wrapped by gengetopt automatically if it's too long. Moreover, text can be specified more than once in the input file. --very-very-long-option=STRING the name of this option is long enough to make this description begin on a new line -y, --assume-multimeth-virtual the name of this option is just as long as the maximum allowed, so this description begin on a new line --file-save=STRING save the passed options into a file A text after all options. only_hidden 0.1 Usage: only_hidden --nonhidden=STRING --nonhidden2=STRING [-h|--help] [--full-help] [-V|--version] -h, --help Print help and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit First section. This contains non hidden options: --nonhidden=STRING non hidden --nonhidden2=STRING non hidden2 only_hidden 0.1 Usage: only_hidden --nonhidden=STRING --nonhidden2=STRING [-h|--help] [--full-help] [-V|--version] -h, --help Print help and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit First section. This contains non hidden options: --nonhidden=STRING non hidden --nonhidden2=STRING non hidden2 Hidden section. This contains only hidden options: --hidden=STRING hidden --hidden2=STRING hidden2 test align 1.0 this is just a test to check that the output of --help and --full-help are aligned just the same Usage: test align [OPTIONS]... -h, --help Print help and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit Operation modes and settings: Non-absolute pathnames are relative to the executable's directory. Mode: standalone -y, --non-hidden non-hidden option test align 1.0 this is just a test to check that the output of --help and --full-help are aligned just the same Usage: test align [OPTIONS]... -h, --help Print help and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -m, --hidden-option This is the hidden option that is printed only with --full-help; thanks to its long description we force a possible different alignment for --full-help Operation modes and settings: Non-absolute pathnames are relative to the executable's directory. Mode: standalone -y, --non-hidden non-hidden option required_or_optional 0.1 Usage: required_or_optional --required=STRING --non-specified=STRING --non-specified2=STRING [-h|--help] [-V|--version] [--optional=STRING] -h, --help Print help and exit -V, --version Print version and exit This contains options with specified required/optional: --required=STRING required specified (mandatory) --optional=STRING optional specified This contains options with NON specified required/optional: --non-specified=STRING non specified whether optional or required (mandatory) --non-specified2=STRING non specified whether optional or required (mandatory) required_or_optional 0.1 Usage: required_or_optional --required=STRING [-h|--help] [-V|--version] [--optional=STRING] [--non-specified=STRING] [--non-specified2=STRING] -h, --help Print help and exit -V, --version Print version and exit This contains options with specified required/optional: --required=STRING required specified (mandatory) --optional=STRING optional specified This contains options with NON specified required/optional: --non-specified=STRING non specified whether optional or required --non-specified2=STRING non specified whether optional or required test strict hidden 1.0 This gengetopt configuration fileis intended to check that the --strct-hidden works as expected. If it doesnt work, you will see output written in upper case that says you shouldn't \ be seeing that output. Usage: test strict hidden [-h|--help] [--detailed-help] [-V|--version] [-a|--option1] [--option2] [--option3] [-c|--option4] -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit -a, --option1 (test option 1) --option2 (test option 2) --option3 (test option 3, with details) -c, --option4 (test option 4) test strict hidden 1.0 This gengetopt configuration fileis intended to check that the --strct-hidden works as expected. If it doesnt work, you will see output written in upper case that says you shouldn't \ be seeing that output. Usage: test strict hidden [-h|--help] [--detailed-help] [-V|--version] [-a|--option1] [--option2] [--option3] [-c|--option4] -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit -a, --option1 (test option 1) --option2 (test option 2) --option3 (test option 3, with details) ...just some details -c, --option4 (test option 4) gengetopt-2.22.6/tests/test_groups_option_help.c0000664000175000017500000000144212045003074017002 00000000000000/* test_groups_option_help.c test */ /* test option help fields in the presence of groups */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_groups_cmd.h" #define PRINT_OPTION(s) printf("%s: %s\n", # s, args_info.s) #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) #endif // FIX_UNUSED static struct gengetopt_args_info args_info; int main (int argc, char **argv) { FIX_UNUSED (argc); FIX_UNUSED (argv); test_groups_cmd_parser_init (&args_info); PRINT_OPTION(help_help); PRINT_OPTION(version_help); PRINT_OPTION(opta_help); PRINT_OPTION(optA_help); PRINT_OPTION(optAmul_help); PRINT_OPTION(optb_help); PRINT_OPTION(optc_help); PRINT_OPTION(optd_help); test_groups_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_manual_help_cmd.ggo0000664000175000017500000000102512044745036016534 00000000000000# test_manual_help_cmd.ggo # test manual definition of help and version options package "test_manual_help" version "1.0" option "help" h "show help (possibly of other options)" optional option "detailed-help" ? "show detailed help" optional option "version" V "show version of the program" optional option "height" - "this is the description of height" optional int details="These are the details of option height" option "vavoom" - "this is the description of vavoom" optional string gengetopt-2.22.6/tests/test_no_handle_help.c0000664000175000017500000000271012045003074016021 00000000000000/* test_no_handle_help.c test */ /* test manual handling of help and version */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_no_handle_help_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { int result = 0; /* if --help is specified with other options, do not print the complete output of help, but only the description of that option */ short help_printed = 0; if (test_no_handle_help_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } printf("####################\n# HEADER\n####################\n"); if (args_info.detailed_help_given) test_no_handle_help_cmd_parser_print_detailed_help(); if (args_info.version_given) test_no_handle_help_cmd_parser_print_version(); if (args_info.height_given) { printf ("specified --height %d\n", args_info.height_arg); if (args_info.help_given) { printf ("%s\n", args_info.height_help); help_printed = 1; } } if (args_info.vavoom_given) { printf ("specified --vavoom %s\n", args_info.vavoom_arg); if (args_info.help_given) { printf ("%s\n", args_info.vavoom_help); help_printed = 1; } } if (args_info.help_given && !help_printed) test_no_handle_help_cmd_parser_print_help(); printf("####################\n# FOOTER\n####################\n"); end: test_no_handle_help_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/test_multiple.cc0000664000175000017500000000412412045003074015061 00000000000000/* test_multiple.c test */ /* test options that can be given more than once */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "test_multiple_cmd.h" static struct gengetopt_args_info args_info; using namespace std; int main (int argc, char **argv) { unsigned int i = 0; int result = 0; if (test_multiple_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto end; } for (i = 0; i < args_info.string_given; ++i) printf ("passed string: %s\n", args_info.string_arg[i]); for (i = 0; i < args_info.int_given; ++i) printf ("passed int: %d\n", args_info.int_arg[i]); if (args_info.float_given) { for (i = 0; i < args_info.float_given; ++i) printf ("passed float: %f\n", args_info.float_arg[i]); } else if (args_info.float_arg) printf ("default float: %f\n", args_info.float_arg[0]); for (i = 0; i < args_info.no_short_opt_given; ++i) printf ("passed no-short-opt: %s\n", args_info.no_short_opt_arg[i]); printf ("noarg given %d times\n", args_info.noarg_given); printf ("noarg_noshort given %d times\n", args_info.noarg_noshort_given); printf ("optarg_given %d times\n", args_info.optarg_given); for (i = 0; i < args_info.optarg_given; ++i) printf ("optarg argument: %s\n", (args_info.optarg_arg[i] ? args_info.optarg_arg[i] : "no arg given")); printf ("longlong_given %d times\n", args_info.longlong_given); for (i = 0; i < args_info.longlong_given; ++i) cout << "longlong argument: " << args_info.longlong_arg[i] << endl; printf ("optarg_noshort_given %d times\n", args_info.optarg_noshort_given); for (i = 0; i < args_info.optarg_noshort_given; ++i) printf ("optarg_noshort argument: %s\n", (args_info.optarg_noshort_arg[i] ? args_info.optarg_noshort_arg[i] : "no arg given")); if (args_info.file_save_given && test_multiple_cmd_parser_file_save (args_info.file_save_arg, &args_info) != EXIT_SUCCESS) { result = 1; goto end; } end: test_multiple_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/default_values.c0000664000175000017500000000164612045003074015035 00000000000000/* default_values.c test */ /* it will use default values */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "default_values_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; if (default_values_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; printf ("foo-opt is given: %d\n", args_info.foo_opt_given); printf ("bar-opt is given: %d\n", args_info.bar_opt_given); printf ("Value of foo: %d\n", args_info.foo_arg); printf ("Value of bar: %s\n", args_info.bar_arg); printf ("Value of foo-opt: %d\n", args_info.foo_opt_arg); printf ("Value of bar-opt: %s\n", args_info.bar_opt_arg); printf ("Value of foofloat: %f\n", args_info.foofloat_arg); printf ("Value of foodouble: %lf\n", args_info.foodouble_arg); printf ("Value of PI: %16.10f\n", args_info.pi_arg); default_values_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_err.sh.in0000664000175000017500000000116312044745036014462 00000000000000#!@SHELL@ ## ## test_err.sh ## ## Made by Lorenzo Bettini ## Login ## ## Started on Tue Sep 6 16:39:30 2005 Lorenzo Bettini ## Last update Wed Sep 7 11:44:42 2005 Lorenzo Bettini ## PROGNAME=../src/gengetopt srcdir=@srcdir@ for source in $srcdir/*.err; do test_input="`echo $source|sed s/err/ggo/`"; output="`echo $source|sed -e \"s/^.*\///g\"`"; $PROGNAME --unamed-opt -i $test_input --file-name null 2> $output.out || true ; sed -i -e "s/^.*\///g" $output.out ; echo "diff $output.out $source"; if ! diff $output.out $source; then errors=1; fi; done ; test -z "$errors" gengetopt-2.22.6/tests/no_optgiven_cmd.h.test0000664000175000017500000001514712045003074016170 00000000000000/** @file no_optgiven_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef NO_OPTGIVEN_CMD_H #define NO_OPTGIVEN_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef NO_OPTGIVEN_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define NO_OPTGIVEN_CMD_PARSER_PACKAGE "no_optgiven" #endif #ifndef NO_OPTGIVEN_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define NO_OPTGIVEN_CMD_PARSER_PACKAGE_NAME "no_optgiven" #endif #ifndef NO_OPTGIVEN_CMD_PARSER_VERSION /** @brief the program version */ #define NO_OPTGIVEN_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_arg; /**< @brief foo option. */ char * foo_orig; /**< @brief foo option original value given at command line. */ const char *foo_help; /**< @brief foo option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct no_optgiven_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int no_optgiven_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use no_optgiven_cmd_parser_ext() instead */ int no_optgiven_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int no_optgiven_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_optgiven_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int no_optgiven_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int no_optgiven_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void no_optgiven_cmd_parser_print_help(void); /** * Print the version */ void no_optgiven_cmd_parser_print_version(void); /** * Initializes all the fields a no_optgiven_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void no_optgiven_cmd_parser_params_init(struct no_optgiven_cmd_parser_params *params); /** * Allocates dynamically a no_optgiven_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized no_optgiven_cmd_parser_params structure */ struct no_optgiven_cmd_parser_params *no_optgiven_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void no_optgiven_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void no_optgiven_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int no_optgiven_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* NO_OPTGIVEN_CMD_H */ gengetopt-2.22.6/tests/wrong_numeric_value.err0000664000175000017500000000006112044745036016452 00000000000000wrong_numeric_value.ggo:3: invalid numeric value gengetopt-2.22.6/tests/cmdline.c.test0000664000175000017500000003217612045003074014425 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input ../../tests/cmdline.ggo The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "cmdline.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: " CMDLINE_PARSER_PACKAGE " [OPTIONS]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -f, --foo=INT foo option (default=`15000')", " -b, --bar=STRING bar option (default=`this is a default')", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT } cmdline_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; args_info->bar_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_arg = 15000; args_info->foo_orig = NULL; args_info->bar_arg = gengetopt_strdup ("this is a default"); args_info->bar_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; args_info->bar_help = gengetopt_args_info_help[3] ; } void cmdline_parser_print_version (void) { printf ("%s %s\n", (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), CMDLINE_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { cmdline_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void cmdline_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void cmdline_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); } void cmdline_parser_params_init(struct cmdline_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct cmdline_parser_params * cmdline_parser_params_create(void) { struct cmdline_parser_params *params = (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); cmdline_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void cmdline_parser_release (struct gengetopt_args_info *args_info) { free_string_field (&(args_info->foo_orig)); free_string_field (&(args_info->bar_arg)); free_string_field (&(args_info->bar_orig)); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); if (args_info->bar_given) write_into_file(outfile, "bar", args_info->bar_orig, 0); i = EXIT_SUCCESS; return i; } int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = cmdline_parser_dump(outfile, args_info); fclose (outfile); return i; } void cmdline_parser_free (struct gengetopt_args_info *args_info) { cmdline_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); } int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params) { int result; result = cmdline_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct cmdline_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see cmdline_parser_params.check_ambiguity * @param override @see cmdline_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, cmdline_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int cmdline_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) cmdline_parser_init (args_info); cmdline_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'f' }, { "bar", 1, NULL, 'b' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVf:b:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ cmdline_parser_print_help (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ cmdline_parser_print_version (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'f': /* foo option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, "15000", ARG_INT, check_ambiguity, override, 0, 0, "foo", 'f', additional_error)) goto failure; break; case 'b': /* bar option. */ if (update_arg( (void *)&(args_info->bar_arg), &(args_info->bar_orig), &(args_info->bar_given), &(local_args_info.bar_given), optarg, 0, "this is a default", ARG_STRING, check_ambiguity, override, 0, 0, "bar", 'b', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ cmdline_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); return 0; failure: cmdline_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_all_opts_file_save.sh.in0000664000175000017500000000031212044745036017517 00000000000000#! @SHELL@ # the next program must exit with error $* ./test_all_opts -r "foo" --opt-arg -o -l 150000000 -f 150.217 -u --file-save="test_all_opts.save" -F these are command line options without names gengetopt-2.22.6/tests/wrong_dep.ggo0000664000175000017500000000066712044745036014364 00000000000000# test for problems in dependences: missing dependant option # and depends on itself option "depok" - "option depends on opt1" dependon="opt1" string no option "opt1" f "flag option OK" flag on option "wrongdep" F "depends on undefined option" string default="foo" dependon="foo" option "deponself" - "depends on itself" string default="foo" dependon="deponself" option "opt2" - "flag option OK" flag on gengetopt-2.22.6/tests/test_default_values.sh.in0000664000175000017500000000045012044745036016673 00000000000000#! @SHELL@ # test default values and options with optional arguments $* ./default_values && $* ./default_values -F -B && $* ./default_values -F15 -Bhi && $* ./default_values --foo-opt --bar-opt && $* ./default_values --foo-opt=15 --bar-opt=hi && ! $* ./default_values --foo-opt=a5 --bar-opt=hi gengetopt-2.22.6/tests/canonize-names-cmd.h.test0000664000175000017500000001614412045003074016464 00000000000000/** @file canonize-names-cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef CANONIZE_NAMES_CMD_H #define CANONIZE_NAMES_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef CANONIZE_NAMES_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define CANONIZE_NAMES_CMD_PARSER_PACKAGE "canonize_names" #endif #ifndef CANONIZE_NAMES_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define CANONIZE_NAMES_CMD_PARSER_PACKAGE_NAME "canonize_names" #endif #ifndef CANONIZE_NAMES_CMD_PARSER_VERSION /** @brief the program version */ #define CANONIZE_NAMES_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_bar_arg; /**< @brief foo-bar option. */ char * foo_bar_orig; /**< @brief foo-bar option original value given at command line. */ const char *foo_bar_help; /**< @brief foo-bar option help description. */ int foo_foo_arg; /**< @brief foo.foo option. */ char * foo_foo_orig; /**< @brief foo.foo option original value given at command line. */ const char *foo_foo_help; /**< @brief foo.foo option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_bar_given ; /**< @brief Whether foo-bar was given. */ unsigned int foo_foo_given ; /**< @brief Whether foo.foo was given. */ int my_group_group_counter; /**< @brief Counter for group my_group */ int my_group2_group_counter; /**< @brief Counter for group my_group2 */ int my_group3_group_counter; /**< @brief Counter for group my_group3 */ } ; /** @brief The additional parameters to pass to parser functions */ struct canonize_names_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int canonize_names_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use canonize_names_cmd_parser_ext() instead */ int canonize_names_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int canonize_names_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct canonize_names_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int canonize_names_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int canonize_names_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void canonize_names_cmd_parser_print_help(void); /** * Print the version */ void canonize_names_cmd_parser_print_version(void); /** * Initializes all the fields a canonize_names_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void canonize_names_cmd_parser_params_init(struct canonize_names_cmd_parser_params *params); /** * Allocates dynamically a canonize_names_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized canonize_names_cmd_parser_params structure */ struct canonize_names_cmd_parser_params *canonize_names_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void canonize_names_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void canonize_names_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int canonize_names_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* CANONIZE_NAMES_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser_ov3.sh.in0000664000175000017500000000017512044745036016764 00000000000000#! @SHELL@ if $* ./test_conf_parser_ov3 -r "bar" --float 2.14 -i 100 -c @srcdir@/test_conf2.conf; then true; else false; fi gengetopt-2.22.6/tests/wrong_flag2.ggo0000664000175000017500000000026612044745036014602 00000000000000# test for problems in non flag options option "non-flag-ok" - "non flag option OK" string default="foo" option "non-flag" F "non flag option" on string default="foo" gengetopt-2.22.6/tests/test_conf_parser_cmd.ggoconf0000664000175000017500000000274412044745036017427 00000000000000# test_all_opts_cmd.ggo # test all kinds of options package "test_conf_parser" version "1.0" defgroup "my grp2" defgroup "grp1" groupdesc="an option of this group is required" yes groupoption "opta" a "string a" string group="grp1" groupoption "optb" b "string b" string group="grp1" groupoption "optc" - "string c" group="my grp2" groupoption "optd" C "string d" group="my grp2" option "string" s "string option" string no option "int" i "int option" int no option "short" S "short option" short no option "long" l "long option" long no option "float" f "float option" float no option "double" d "double option" double no option "longdouble" D "longdouble option" longdouble no option "longlong" L "longlong option" longlong no option "flag" F "flag option" flag on option "function" u "function option" no option "no-short" - "no short option" no option "required" r "required option" string yes option "conf-file" c "config file" string default="test_conf.conf" no option "multi-string" M "multiple string option" string no multiple option "multi-string-def" - "multiple string option with default" string default="this default" no multiple option "noarg" n "multiple option with no arg" no multiple option "noarg-noshort" - "multiple option with no arg and no short" no multiple option "opt-arg" - "option with optional arg" string no argoptional option "file-save" - "save the passed options into a file" string no gengetopt-2.22.6/tests/test_manual_help_args_cmd.ggo0000664000175000017500000000116212045003074017540 00000000000000# test_manual_help_cmd.ggo # test manual definition of help and version options # where --no-help and --no-version are specified in args args "--no-help --no-version" package "test_manual_help_args" version "1.0" option "help" h "show help (possibly of other options)" optional option "detailed-help" ? "show detailed help" optional option "version" V "show version of the program" optional option "height" - "this is the description of height" optional int details="These are the details of option height" option "vavoom" - "this is the description of vavoom" optional string gengetopt-2.22.6/tests/test_second_cmdline_cmd.ggostr0000664000175000017500000000051412044745036017750 00000000000000# test for multiple parsers, this is the second command line file option "option-a" a "option a of the second command line to parse" optional string option "option-b" b "option a of the second command line to parse" optional string option "my-multi" M "multiple option of the second command line to parse" optional string multiple gengetopt-2.22.6/tests/no_unamed_cmd.c.test0000664000175000017500000003046112045003074015575 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input ../../tests/no_unamed_cmd.ggonu --func-name no_unamed_cmd_parser --file-name no_unamed_cmd The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "no_unamed_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: no_unamed [OPTIONS]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -i, --foo=STRING foo string option", 0 }; typedef enum {ARG_NO , ARG_STRING } no_unamed_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int no_unamed_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_unamed_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_arg = NULL; args_info->foo_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_help = gengetopt_args_info_help[2] ; } void no_unamed_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(NO_UNAMED_CMD_PARSER_PACKAGE_NAME) ? NO_UNAMED_CMD_PARSER_PACKAGE_NAME : NO_UNAMED_CMD_PARSER_PACKAGE), NO_UNAMED_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { no_unamed_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void no_unamed_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void no_unamed_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); } void no_unamed_cmd_parser_params_init(struct no_unamed_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct no_unamed_cmd_parser_params * no_unamed_cmd_parser_params_create(void) { struct no_unamed_cmd_parser_params *params = (struct no_unamed_cmd_parser_params *)malloc(sizeof(struct no_unamed_cmd_parser_params)); no_unamed_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void no_unamed_cmd_parser_release (struct gengetopt_args_info *args_info) { free_string_field (&(args_info->foo_arg)); free_string_field (&(args_info->foo_orig)); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int no_unamed_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", NO_UNAMED_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_given) write_into_file(outfile, "foo", args_info->foo_orig, 0); i = EXIT_SUCCESS; return i; } int no_unamed_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", NO_UNAMED_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = no_unamed_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void no_unamed_cmd_parser_free (struct gengetopt_args_info *args_info) { no_unamed_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int no_unamed_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return no_unamed_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int no_unamed_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_unamed_cmd_parser_params *params) { int result; result = no_unamed_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { no_unamed_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_unamed_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct no_unamed_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = no_unamed_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { no_unamed_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int no_unamed_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see no_unamed_cmd_parser_params.check_ambiguity * @param override @see no_unamed_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, no_unamed_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int no_unamed_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct no_unamed_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) no_unamed_cmd_parser_init (args_info); no_unamed_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo", 1, NULL, 'i' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVi:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ no_unamed_cmd_parser_print_help (); no_unamed_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ no_unamed_cmd_parser_print_version (); no_unamed_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'i': /* foo string option. */ if (update_arg( (void *)&(args_info->foo_arg), &(args_info->foo_orig), &(args_info->foo_given), &(local_args_info.foo_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "foo", 'i', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", NO_UNAMED_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ no_unamed_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); return 0; failure: no_unamed_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_conf_err_string2.conf0000664000175000017500000000006212044745036017042 00000000000000multi-string="first" multi-string = "unterminatedgengetopt-2.22.6/tests/test_conf_err_string.conf0000664000175000017500000000006012044745036016756 00000000000000multi-string="first" multi-string = mal"formed"gengetopt-2.22.6/tests/test_multiple_err.sh.in0000664000175000017500000000070512044745036016376 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_multiple -i 100 -s "foo" -s; then false; else if $* ./test_multiple -L1 -L2 -L3 -L4 --limited-open-right=1 --limited-interval=1 --limited-interval=1 --limited-interval=1 --limited-interval=1; then false; else if $* ./test_multiple --limited-open-left=1 --limited-open-left==2 --limited-open-left=3 --limited-open-left=toomuch; then false; else true; fi fi fi gengetopt-2.22.6/tests/canonize-names.c0000664000175000017500000000066212045003074014736 00000000000000/* no_strings.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "canonize-names-cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ /* since it is called with no option we expect an error since the option --foo is required */ if (canonize_names_cmd_parser (argc, argv, &args_info) == 0) exit(0) ; return 1; } gengetopt-2.22.6/tests/no_multi_strings_cmd.h.test0000664000175000017500000001643312045003074017237 00000000000000/** @file no_multi_strings_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef NO_MULTI_STRINGS_CMD_H #define NO_MULTI_STRINGS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef NO_MULTI_STRINGS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define NO_MULTI_STRINGS_CMD_PARSER_PACKAGE "no multi strings" #endif #ifndef NO_MULTI_STRINGS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define NO_MULTI_STRINGS_CMD_PARSER_PACKAGE_NAME "no multi strings" #endif #ifndef NO_MULTI_STRINGS_CMD_PARSER_VERSION /** @brief the program version */ #define NO_MULTI_STRINGS_CMD_PARSER_VERSION "0.1" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int test_arg; /**< @brief This is a test option (default='5'). */ char * test_orig; /**< @brief This is a test option original value given at command line. */ const char *test_help; /**< @brief This is a test option help description. */ int* multi_arg; /**< @brief This is a multi option. */ char ** multi_orig; /**< @brief This is a multi option original value given at command line. */ unsigned int multi_min; /**< @brief This is a multi option's minimum occurreces */ unsigned int multi_max; /**< @brief This is a multi option's maximum occurreces */ const char *multi_help; /**< @brief This is a multi option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int test_given ; /**< @brief Whether test was given. */ unsigned int multi_given ; /**< @brief Whether multi was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct no_multi_strings_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int no_multi_strings_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use no_multi_strings_cmd_parser_ext() instead */ int no_multi_strings_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int no_multi_strings_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct no_multi_strings_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int no_multi_strings_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int no_multi_strings_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void no_multi_strings_cmd_parser_print_help(void); /** * Print the version */ void no_multi_strings_cmd_parser_print_version(void); /** * Initializes all the fields a no_multi_strings_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void no_multi_strings_cmd_parser_params_init(struct no_multi_strings_cmd_parser_params *params); /** * Allocates dynamically a no_multi_strings_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized no_multi_strings_cmd_parser_params structure */ struct no_multi_strings_cmd_parser_params *no_multi_strings_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void no_multi_strings_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void no_multi_strings_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int no_multi_strings_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* NO_MULTI_STRINGS_CMD_H */ gengetopt-2.22.6/tests/wrong_group.err0000664000175000017500000000007612044745036014756 00000000000000wrong_group.ggo:5: group specification for a non group option gengetopt-2.22.6/tests/test_conf_parser_ov3.c0000664000175000017500000000352512046536543016174 00000000000000/* test_conf_parser_ov2.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan two conf files and then the command line */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { unsigned int i; /* do not override command line options, initialize args_info */ if (test_conf_parser_cmd_parser_configfile ("../../tests/test_conf2.conf", &args_info, 0, 1, 0) != 0) exit(1); /* do not override, do not initialize args_info */ if (test_conf_parser_cmd_parser_configfile ("../../tests/test_conf3.conf", &args_info, 0, 0, 0) != 0) exit(1); if (test_conf_parser_cmd_parser2 (argc, argv, &args_info, 1, 0, 1) != 0) exit(1) ; printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); printf ("value of multi-string_given: %d\n", args_info.multi_string_given); for (i = 0; i < args_info.multi_string_given; i++) printf (" value of multi-string: %s\n", args_info.multi_string_arg [i]); printf ("value of multi-string-def_given: %d\n", args_info.multi_string_def_given); for (i = 0; i < args_info.multi_string_def_given; i++) printf (" value of multi-string-def: %s\n", args_info.multi_string_def_arg [i]); if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0]) printf ("default value of multi-string-def: %s\n", args_info.multi_string_def_arg [0]); test_conf_parser_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_main_cmdline_cmd.h.test0000664000175000017500000001731512045003074017316 00000000000000/** @file test_main_cmdline_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_MAIN_CMDLINE_CMD_H #define TEST_MAIN_CMDLINE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE PACKAGE #endif #ifndef TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define TEST_MAIN_CMDLINE_CMD_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef TEST_MAIN_CMDLINE_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_MAIN_CMDLINE_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char ** first_cmd_arg; /**< @brief the first command line to parse. */ char ** first_cmd_orig; /**< @brief the first command line to parse original value given at command line. */ unsigned int first_cmd_min; /**< @brief the first command line to parse's minimum occurreces */ unsigned int first_cmd_max; /**< @brief the first command line to parse's maximum occurreces */ const char *first_cmd_help; /**< @brief the first command line to parse help description. */ char ** second_cmd_arg; /**< @brief the second command line to parse. */ char ** second_cmd_orig; /**< @brief the second command line to parse original value given at command line. */ unsigned int second_cmd_min; /**< @brief the second command line to parse's minimum occurreces */ unsigned int second_cmd_max; /**< @brief the second command line to parse's maximum occurreces */ const char *second_cmd_help; /**< @brief the second command line to parse help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int first_cmd_given ; /**< @brief Whether first-cmd was given. */ unsigned int second_cmd_given ; /**< @brief Whether second-cmd was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_main_cmdline_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_main_cmdline_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_main_cmdline_cmd_parser_ext() instead */ int test_main_cmdline_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_main_cmdline_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_main_cmdline_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_main_cmdline_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_main_cmdline_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_main_cmdline_cmd_parser_print_help(void); /** * Print the version */ void test_main_cmdline_cmd_parser_print_version(void); /** * Initializes all the fields a test_main_cmdline_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_main_cmdline_cmd_parser_params_init(struct test_main_cmdline_cmd_parser_params *params); /** * Allocates dynamically a test_main_cmdline_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_main_cmdline_cmd_parser_params structure */ struct test_main_cmdline_cmd_parser_params *test_main_cmdline_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_main_cmdline_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_main_cmdline_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_main_cmdline_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_MAIN_CMDLINE_CMD_H */ gengetopt-2.22.6/tests/more_than_once_cmd.ggo0000664000175000017500000000033112044745036016167 00000000000000# more_than_once_cmd.ggo # To test the call of the command line parser more than once package "more_than_once" version "1.0" option "foo" f "foo option" int no option "bar" b "bar option" string no gengetopt-2.22.6/tests/test_groups.c0000664000175000017500000000152412045003074014403 00000000000000/* test_groups.c test */ /* test all kinds of options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_groups_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { unsigned int i; if (test_groups_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; if (args_info.optA_given) { printf("optA given\n"); if (args_info.optA_arg) printf("optA arg: %s\n", args_info.optA_arg); } if (args_info.optAmul_given) { printf("optAmul given %d time(s)\n", args_info.optAmul_given); for (i = 0; i < args_info.optAmul_given; ++i) printf("optAmul arg: %s\n", (args_info.optAmul_arg[i] ? args_info.optAmul_arg[i] : "(null)")); } test_groups_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_newlines.c0000664000175000017500000000065112045003074014710 00000000000000/* test_newlines.c test */ /* test when \n are specified (escaped) in options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_newlines_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_newlines_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; test_newlines_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_all_opts.c0000664000175000017500000000207512045003074014703 00000000000000/* test_all_opts.c test */ /* test all kinds of options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_all_opts_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_all_opts_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; if (args_info.opt_arg_given) { printf ("specified --opt-arg"); if (args_info.opt_arg_arg) printf (" with argument %s\n", args_info.opt_arg_arg); else printf ("\n"); } if (args_info.opt_arg_short_given) { printf ("specified --opt-arg-short"); if (args_info.opt_arg_short_arg) printf (" with argument %s\n", args_info.opt_arg_short_arg); else printf ("\n"); } if (args_info.hidden_given) printf ("specified --hidden: %d\n", args_info.hidden_arg); if (args_info.file_save_given && test_all_opts_cmd_parser_file_save (args_info.file_save_arg, &args_info) != EXIT_SUCCESS) exit(1) ; test_all_opts_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_first_cmdline_cmd.ggostr0000664000175000017500000000036012044745036017623 00000000000000# test for multiple parsers, this is the first command line file option "option-a" a "option a of the first command line to parse" optional int option "multi" M "multiple option of the first command line to parse" optional string multiple gengetopt-2.22.6/tests/test_manual_help.sh.in0000664000175000017500000000031212044745036016152 00000000000000#! @SHELL@ $* ./test_manual_help --height "100" --help $* ./test_manual_help --height "100" -? $* ./test_manual_help --vavoom "foo" --height "100" --help $* ./test_manual_help --height "100" --version gengetopt-2.22.6/tests/test_simple_multiple.sh.in0000664000175000017500000000021212044745036017070 00000000000000#! @SHELL@ # the next program must succeed if $* ./test_simple_multiple -s "first","second" --string "third"; then true; else false; fi gengetopt-2.22.6/tests/no_unamed_cmd.ggonu0000664000175000017500000000027112044745036015522 00000000000000# no_unamed_cmd.ggo # This test an input file processed without --unamed-opt but with a string package "no_unamed" version "1.0" option "foo" i "foo string option" string no gengetopt-2.22.6/tests/test_multiple_cmd.h.test0000664000175000017500000003602712045003074016533 00000000000000/** @file test_multiple_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_MULTIPLE_CMD_H #define TEST_MULTIPLE_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_MULTIPLE_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_MULTIPLE_CMD_PARSER_PACKAGE "test_multiple" #endif #ifndef TEST_MULTIPLE_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_MULTIPLE_CMD_PARSER_PACKAGE_NAME "test_multiple" #endif #ifndef TEST_MULTIPLE_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_MULTIPLE_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char ** string_arg; /**< @brief string option (default='foo'). */ char ** string_orig; /**< @brief string option original value given at command line. */ unsigned int string_min; /**< @brief string option's minimum occurreces */ unsigned int string_max; /**< @brief string option's maximum occurreces */ const char *string_help; /**< @brief string option help description. */ int* int_arg; /**< @brief int option. */ char ** int_orig; /**< @brief int option original value given at command line. */ unsigned int int_min; /**< @brief int option's minimum occurreces */ unsigned int int_max; /**< @brief int option's maximum occurreces */ const char *int_help; /**< @brief int option help description. */ short* short_arg; /**< @brief short option. */ char ** short_orig; /**< @brief short option original value given at command line. */ unsigned int short_min; /**< @brief short option's minimum occurreces */ unsigned int short_max; /**< @brief short option's maximum occurreces */ const char *short_help; /**< @brief short option help description. */ long* long_arg; /**< @brief long option. */ char ** long_orig; /**< @brief long option original value given at command line. */ unsigned int long_min; /**< @brief long option's minimum occurreces */ unsigned int long_max; /**< @brief long option's maximum occurreces */ const char *long_help; /**< @brief long option help description. */ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int* longlong_arg; /**< @brief long long option. */ #else long* longlong_arg; /**< @brief long long option. */ #endif char ** longlong_orig; /**< @brief long long option original value given at command line. */ unsigned int longlong_min; /**< @brief long long option's minimum occurreces */ unsigned int longlong_max; /**< @brief long long option's maximum occurreces */ const char *longlong_help; /**< @brief long long option help description. */ char ** limited_arg; /**< @brief limited multiple option. */ char ** limited_orig; /**< @brief limited multiple option original value given at command line. */ unsigned int limited_min; /**< @brief limited multiple option's minimum occurreces */ unsigned int limited_max; /**< @brief limited multiple option's maximum occurreces */ const char *limited_help; /**< @brief limited multiple option help description. */ char ** limited_interval_arg; /**< @brief limited multiple option (with interval). */ char ** limited_interval_orig; /**< @brief limited multiple option (with interval) original value given at command line. */ unsigned int limited_interval_min; /**< @brief limited multiple option (with interval)'s minimum occurreces */ unsigned int limited_interval_max; /**< @brief limited multiple option (with interval)'s maximum occurreces */ const char *limited_interval_help; /**< @brief limited multiple option (with interval) help description. */ char ** big_limited_interval_arg; /**< @brief limited multiple option (with interval). */ char ** big_limited_interval_orig; /**< @brief limited multiple option (with interval) original value given at command line. */ unsigned int big_limited_interval_min; /**< @brief limited multiple option (with interval)'s minimum occurreces */ unsigned int big_limited_interval_max; /**< @brief limited multiple option (with interval)'s maximum occurreces */ const char *big_limited_interval_help; /**< @brief limited multiple option (with interval) help description. */ char ** limited_open_right_arg; /**< @brief limited multiple option (with interval right open). */ char ** limited_open_right_orig; /**< @brief limited multiple option (with interval right open) original value given at command line. */ unsigned int limited_open_right_min; /**< @brief limited multiple option (with interval right open)'s minimum occurreces */ unsigned int limited_open_right_max; /**< @brief limited multiple option (with interval right open)'s maximum occurreces */ const char *limited_open_right_help; /**< @brief limited multiple option (with interval right open) help description. */ char ** limited_open_left_arg; /**< @brief limited multiple option (with interval left open). */ char ** limited_open_left_orig; /**< @brief limited multiple option (with interval left open) original value given at command line. */ unsigned int limited_open_left_min; /**< @brief limited multiple option (with interval left open)'s minimum occurreces */ unsigned int limited_open_left_max; /**< @brief limited multiple option (with interval left open)'s maximum occurreces */ const char *limited_open_left_help; /**< @brief limited multiple option (with interval left open) help description. */ float* float_arg; /**< @brief float option (default='15000'). */ char ** float_orig; /**< @brief float option original value given at command line. */ unsigned int float_min; /**< @brief float option's minimum occurreces */ unsigned int float_max; /**< @brief float option's maximum occurreces */ const char *float_help; /**< @brief float option help description. */ char ** no_short_opt_arg; /**< @brief string option with no short. */ char ** no_short_opt_orig; /**< @brief string option with no short original value given at command line. */ unsigned int no_short_opt_min; /**< @brief string option with no short's minimum occurreces */ unsigned int no_short_opt_max; /**< @brief string option with no short's maximum occurreces */ const char *no_short_opt_help; /**< @brief string option with no short help description. */ unsigned int noarg_min; /**< @brief multiple option with no arg's minimum occurreces */ unsigned int noarg_max; /**< @brief multiple option with no arg's maximum occurreces */ const char *noarg_help; /**< @brief multiple option with no arg help description. */ unsigned int noarg_noshort_min; /**< @brief multiple option with no arg and no short's minimum occurreces */ unsigned int noarg_noshort_max; /**< @brief multiple option with no arg and no short's maximum occurreces */ const char *noarg_noshort_help; /**< @brief multiple option with no arg and no short help description. */ char ** optarg_arg; /**< @brief multi with optional args. */ char ** optarg_orig; /**< @brief multi with optional args original value given at command line. */ unsigned int optarg_min; /**< @brief multi with optional args's minimum occurreces */ unsigned int optarg_max; /**< @brief multi with optional args's maximum occurreces */ const char *optarg_help; /**< @brief multi with optional args help description. */ char ** optarg_noshort_arg; /**< @brief multi with optional args and no short. */ char ** optarg_noshort_orig; /**< @brief multi with optional args and no short original value given at command line. */ unsigned int optarg_noshort_min; /**< @brief multi with optional args and no short's minimum occurreces */ unsigned int optarg_noshort_max; /**< @brief multi with optional args and no short's maximum occurreces */ const char *optarg_noshort_help; /**< @brief multi with optional args and no short help description. */ char * file_save_arg; /**< @brief save the passed options into a file. */ char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */ const char *file_save_help; /**< @brief save the passed options into a file help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int string_given ; /**< @brief Whether string was given. */ unsigned int int_given ; /**< @brief Whether int was given. */ unsigned int short_given ; /**< @brief Whether short was given. */ unsigned int long_given ; /**< @brief Whether long was given. */ unsigned int longlong_given ; /**< @brief Whether longlong was given. */ unsigned int limited_given ; /**< @brief Whether limited was given. */ unsigned int limited_interval_given ; /**< @brief Whether limited-interval was given. */ unsigned int big_limited_interval_given ; /**< @brief Whether big-limited-interval was given. */ unsigned int limited_open_right_given ; /**< @brief Whether limited-open-right was given. */ unsigned int limited_open_left_given ; /**< @brief Whether limited-open-left was given. */ unsigned int float_given ; /**< @brief Whether float was given. */ unsigned int no_short_opt_given ; /**< @brief Whether no-short-opt was given. */ unsigned int noarg_given ; /**< @brief Whether noarg was given. */ unsigned int noarg_noshort_given ; /**< @brief Whether noarg-noshort was given. */ unsigned int optarg_given ; /**< @brief Whether optarg was given. */ unsigned int optarg_noshort_given ; /**< @brief Whether optarg-noshort was given. */ unsigned int file_save_given ; /**< @brief Whether file-save was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_multiple_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_multiple_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_multiple_cmd_parser_ext() instead */ int test_multiple_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_multiple_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_multiple_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_multiple_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_multiple_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_multiple_cmd_parser_print_help(void); /** * Print the version */ void test_multiple_cmd_parser_print_version(void); /** * Initializes all the fields a test_multiple_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_multiple_cmd_parser_params_init(struct test_multiple_cmd_parser_params *params); /** * Allocates dynamically a test_multiple_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_multiple_cmd_parser_params structure */ struct test_multiple_cmd_parser_params *test_multiple_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_multiple_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_multiple_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_multiple_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_MULTIPLE_CMD_H */ gengetopt-2.22.6/tests/test_multiple.save.test0000664000175000017500000000115412044775636016433 00000000000000string="\"foo\"" string="bar" string="hello" string="world" int="100" int="200" longlong="1234567890" longlong="234567890" longlong="34567890" limited="1" limited="2" limited="3" limited-interval="1" limited-open-right="1" limited-open-right="2" limited-open-right="3" no-short-opt="check" no-short-opt="this out" no-short-opt="first" no-short-opt="second" no-short-opt="third" no-short-opt="fourth" no-short-opt="fifth" noarg noarg noarg noarg-noshort noarg-noshort optarg optarg="first arg for optarg" optarg="second arg for optarg" optarg-noshort="second arg for optarg" optarg-noshort file-save="test_multiple.save" gengetopt-2.22.6/tests/test_required_optional_cmd.ggo0000664000175000017500000000111512044745036017774 00000000000000# this contains some options with the required/optional flag specified # and some without it. This is used to test --default-optional package "required_or_optional" version "0.1" section "This contains options with specified required/optional" option "required" - "required specified" string required option "optional" - "optional specified" string optional section "This contains options with NON specified required/optional" option "non-specified" - "non specified whether optional or required" string option "non-specified2" - "non specified whether optional or required" string gengetopt-2.22.6/tests/test_no_options_cmd.ggo0000664000175000017500000000027012044745036016437 00000000000000# test_no_options_cmd.ggo # test when no option is specified in the .ggo file package "test_no_options" version "1.0" purpose "This is a program with no option but the default ones" gengetopt-2.22.6/tests/test_conf_parser_ov2.c.in0000664000175000017500000000310412045003074016554 00000000000000/* test_conf_parser_ov2.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan the conf file and then the command line */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { struct test_conf_parser_cmd_parser_params *params; /* initialize the parameters structure */ params = test_conf_parser_cmd_parser_params_create(); /* initialize args_info, but don't check for required options NOTICE: the other fields are initialized to their default values */ params->check_required = 0; /* call the config file parser */ if (test_conf_parser_cmd_parser_config_file ("@srcdir@/test_conf2.conf", &args_info, params) != 0) exit(1); /* override config file options, do not initialize args_info, check for required options. */ params->initialize = 0; params->override = 1; params->check_required = 1; /* call the command line parser */ if (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0) exit(1) ; printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); /* release memory */ test_conf_parser_cmd_parser_free (&args_info); free (params); return 0; } gengetopt-2.22.6/tests/test_text_cmd.c.test0000664000175000017500000003522212045003074015653 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_text_cmd.ggo --func-name=test_text_cmd_parser --file-name=test_text_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_text_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: " TEST_TEXT_CMD_PARSER_PACKAGE " [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", "\nSection 1:", " -s, --str-opt=filename A string option, for a filename", " explain more about the string option some text after section 2", "\nSection 2:", " -i, --int-opt=INT A int option", " some final text", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT } test_text_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_text_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_text_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->str_opt_given = 0 ; args_info->int_opt_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->str_opt_arg = NULL; args_info->str_opt_orig = NULL; args_info->int_opt_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->str_opt_help = gengetopt_args_info_help[3] ; args_info->int_opt_help = gengetopt_args_info_help[6] ; } void test_text_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_TEXT_CMD_PARSER_PACKAGE_NAME) ? TEST_TEXT_CMD_PARSER_PACKAGE_NAME : TEST_TEXT_CMD_PARSER_PACKAGE), TEST_TEXT_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_text_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_text_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_text_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_text_cmd_parser_params_init(struct test_text_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_text_cmd_parser_params * test_text_cmd_parser_params_create(void) { struct test_text_cmd_parser_params *params = (struct test_text_cmd_parser_params *)malloc(sizeof(struct test_text_cmd_parser_params)); test_text_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void test_text_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->str_opt_arg)); free_string_field (&(args_info->str_opt_orig)); free_string_field (&(args_info->int_opt_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_text_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_TEXT_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->str_opt_given) write_into_file(outfile, "str-opt", args_info->str_opt_orig, 0); if (args_info->int_opt_given) write_into_file(outfile, "int-opt", args_info->int_opt_orig, 0); i = EXIT_SUCCESS; return i; } int test_text_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_TEXT_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_text_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_text_cmd_parser_free (struct gengetopt_args_info *args_info) { test_text_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_text_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_text_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_text_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_text_cmd_parser_params *params) { int result; result = test_text_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_text_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_text_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_text_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_text_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_text_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_text_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_text_cmd_parser_params.check_ambiguity * @param override @see test_text_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_text_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int test_text_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_text_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_text_cmd_parser_init (args_info); test_text_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "str-opt", 1, NULL, 's' }, { "int-opt", 1, NULL, 'i' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:i:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_text_cmd_parser_print_help (); test_text_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_text_cmd_parser_print_version (); test_text_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* A string option, for a filename. */ if (update_arg( (void *)&(args_info->str_opt_arg), &(args_info->str_opt_orig), &(args_info->str_opt_given), &(local_args_info.str_opt_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "str-opt", 's', additional_error)) goto failure; break; case 'i': /* A int option. */ if (update_arg( (void *)&(args_info->int_opt_arg), &(args_info->int_opt_orig), &(args_info->int_opt_given), &(local_args_info.int_opt_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "int-opt", 'i', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_TEXT_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_text_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_text_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_conf_inc.conf.in0000664000175000017500000000010612044745036015757 00000000000000multi-string "third" include "@srcdir@/test_conf_inc_inc.conf" n gengetopt-2.22.6/tests/wrong_flag.ggo0000664000175000017500000000022412044745036014512 00000000000000# test for problems in flag options option "flag-ok" f "flag option OK" on flag option "flag" F "flag option" on flag default="foo" gengetopt-2.22.6/tests/test_conf_parser_ov4.c0000664000175000017500000000346612046536543016201 00000000000000/* test_conf_parser_ov4.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan the conf file and then the command line; however, if options were specified in the conf file and also in the command line we get an error (uses check_ambiguity parameter */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { int result = 0; struct test_conf_parser_cmd_parser_params *params; /* initialize the parameters structure */ params = test_conf_parser_cmd_parser_params_create(); /* initialize args_info, but don't check for required options NOTICE: the other fields are initialized to their default values */ params->check_required = 0; /* call the config file parser */ if (test_conf_parser_cmd_parser_config_file ("../../tests/test_conf2.conf", &args_info, params) != 0) { result = 1; goto stop; } /* check ambiguity with config file options, do not initialize args_info, check for required options. */ params->initialize = 0; params->check_ambiguity = 1; params->check_required = 1; /* call the command line parser */ if (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0) { result = 1; goto stop; } printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); stop: /* deallocate structures */ test_conf_parser_cmd_parser_free (&args_info); free (params); return result; } gengetopt-2.22.6/tests/test_groups_cmd.c.test0000664000175000017500000007001612045003074016206 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_groups_cmd.ggo --func-name=test_groups_cmd_parser --file-name=test_groups_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_groups_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_groups [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", "\nsome groups just for testing:", "\n Group: grp1\n an option of this group is required\n Notice that this description is quite long so it may spawn many lines...\n fortunately gengetopt will wrap it for you :-)", " -a, --opta string a", " -A, --optA[=STRING] string A", " -M, --optAmul[=STRING] string M", " -b, --optb string b", "\n Group: my grp2", " --optc string c", " -d, --optd string d", 0 }; typedef enum {ARG_NO , ARG_STRING } test_groups_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_groups_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_groups_cmd_parser_params *params, const char *additional_error); static int test_groups_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->opta_given = 0 ; args_info->opta_group = 0 ; args_info->optA_given = 0 ; args_info->optAmul_given = 0 ; args_info->optAmul_group = 0 ; args_info->optb_given = 0 ; args_info->optc_given = 0 ; args_info->optd_given = 0 ; args_info->grp1_group_counter = 0 ; args_info->my_grp2_group_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->optA_arg = NULL; args_info->optA_orig = NULL; args_info->optAmul_arg = NULL; args_info->optAmul_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->opta_help = gengetopt_args_info_help[4] ; args_info->opta_min = 0; args_info->opta_max = 0; args_info->optA_help = gengetopt_args_info_help[5] ; args_info->optAmul_help = gengetopt_args_info_help[6] ; args_info->optAmul_min = 0; args_info->optAmul_max = 0; args_info->optb_help = gengetopt_args_info_help[7] ; args_info->optc_help = gengetopt_args_info_help[9] ; args_info->optd_help = gengetopt_args_info_help[10] ; } void test_groups_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_GROUPS_CMD_PARSER_PACKAGE_NAME) ? TEST_GROUPS_CMD_PARSER_PACKAGE_NAME : TEST_GROUPS_CMD_PARSER_PACKAGE), TEST_GROUPS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_groups_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_groups_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_groups_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_groups_cmd_parser_params_init(struct test_groups_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_groups_cmd_parser_params * test_groups_cmd_parser_params_create(void) { struct test_groups_cmd_parser_params *params = (struct test_groups_cmd_parser_params *)malloc(sizeof(struct test_groups_cmd_parser_params)); test_groups_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_groups_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->optA_arg)); free_string_field (&(args_info->optA_orig)); free_multiple_string_field (args_info->optAmul_given, &(args_info->optAmul_arg), &(args_info->optAmul_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_groups_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_GROUPS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); write_multiple_into_file(outfile, args_info->opta_given, "opta", 0, 0); if (args_info->optA_given) write_into_file(outfile, "optA", args_info->optA_orig, 0); write_multiple_into_file(outfile, args_info->optAmul_given, "optAmul", args_info->optAmul_orig, 0); if (args_info->optb_given) write_into_file(outfile, "optb", 0, 0 ); if (args_info->optc_given) write_into_file(outfile, "optc", 0, 0 ); if (args_info->optd_given) write_into_file(outfile, "optd", 0, 0 ); i = EXIT_SUCCESS; return i; } int test_groups_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_GROUPS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_groups_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_groups_cmd_parser_free (struct gengetopt_args_info *args_info) { test_groups_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } static void reset_group_grp1(struct gengetopt_args_info *args_info) { if (! args_info->grp1_group_counter) return; args_info->opta_given = 0 ; args_info->opta_group = 0 ; args_info->optA_given = 0 ; free_string_field (&(args_info->optA_arg)); free_string_field (&(args_info->optA_orig)); args_info->optAmul_given = 0 ; args_info->optAmul_group = 0 ; free_multiple_string_field (args_info->optAmul_given, &(args_info->optAmul_arg), &(args_info->optAmul_orig)); args_info->optb_given = 0 ; args_info->grp1_group_counter = 0; } static void reset_group_my_grp2(struct gengetopt_args_info *args_info) { if (! args_info->my_grp2_group_counter) return; args_info->optc_given = 0 ; args_info->optd_given = 0 ; args_info->my_grp2_group_counter = 0; } int test_groups_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_groups_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_groups_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_groups_cmd_parser_params *params) { int result; result = test_groups_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_groups_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_groups_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_groups_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_groups_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_groups_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_groups_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_groups_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_groups_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_groups_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->opta_given, args_info->opta_min, args_info->opta_max, "'--opta' ('-a')")) error_occurred = 1; if (check_multiple_option_occurrences(prog_name, args_info->optAmul_given, args_info->optAmul_min, args_info->optAmul_max, "'--optAmul' ('-M')")) error_occurred = 1; if (args_info->grp1_group_counter == 0) { fprintf (stderr, "%s: %d options of group grp1 were given. One is required%s.\n", prog_name, args_info->grp1_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_groups_cmd_parser_params.check_ambiguity * @param override @see test_groups_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_groups_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_groups_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_groups_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_groups_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_groups_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * optAmul_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_groups_cmd_parser_init (args_info); test_groups_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "opta", 0, NULL, 'a' }, { "optA", 2, NULL, 'A' }, { "optAmul", 2, NULL, 'M' }, { "optb", 0, NULL, 'b' }, { "optc", 0, NULL, 0 }, { "optd", 0, NULL, 'd' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVaA::M::bd", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_groups_cmd_parser_print_help (); test_groups_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_groups_cmd_parser_print_version (); test_groups_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'a': /* string a. */ local_args_info.opta_given++; if (!args_info->opta_group) { args_info->opta_group = 1; args_info->grp1_group_counter += 1; } break; case 'A': /* string A. */ if (args_info->grp1_group_counter && override) reset_group_grp1 (args_info); args_info->grp1_group_counter += 1; if (update_arg( (void *)&(args_info->optA_arg), &(args_info->optA_orig), &(args_info->optA_given), &(local_args_info.optA_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "optA", 'A', additional_error)) goto failure; break; case 'M': /* string M. */ if (update_multiple_arg_temp(&optAmul_list, &(local_args_info.optAmul_given), optarg, 0, 0, ARG_STRING, "optAmul", 'M', additional_error)) goto failure; if (!args_info->optAmul_group) { args_info->optAmul_group = 1; args_info->grp1_group_counter += 1; } break; case 'b': /* string b. */ if (args_info->grp1_group_counter && override) reset_group_grp1 (args_info); args_info->grp1_group_counter += 1; if (update_arg( 0 , 0 , &(args_info->optb_given), &(local_args_info.optb_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optb", 'b', additional_error)) goto failure; break; case 'd': /* string d. */ if (args_info->my_grp2_group_counter && override) reset_group_my_grp2 (args_info); args_info->my_grp2_group_counter += 1; if (update_arg( 0 , 0 , &(args_info->optd_given), &(local_args_info.optd_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optd", 'd', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* string c. */ if (strcmp (long_options[option_index].name, "optc") == 0) { if (args_info->my_grp2_group_counter && override) reset_group_my_grp2 (args_info); args_info->my_grp2_group_counter += 1; if (update_arg( 0 , 0 , &(args_info->optc_given), &(local_args_info.optc_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "optc", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_GROUPS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (args_info->grp1_group_counter > 1) { fprintf (stderr, "%s: %d options of group grp1 were given. One is required%s.\n", argv[0], args_info->grp1_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } if (args_info->my_grp2_group_counter > 1) { fprintf (stderr, "%s: %d options of group my grp2 were given. At most one is required%s.\n", argv[0], args_info->my_grp2_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } update_multiple_arg((void *)&(args_info->optAmul_arg), &(args_info->optAmul_orig), args_info->optAmul_given, local_args_info.optAmul_given, 0, ARG_STRING, optAmul_list); args_info->opta_given += local_args_info.opta_given; local_args_info.opta_given = 0; args_info->optAmul_given += local_args_info.optAmul_given; local_args_info.optAmul_given = 0; if (check_required) { error_occurred += test_groups_cmd_parser_required2 (args_info, argv[0], additional_error); } test_groups_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (optAmul_list, 1 ); test_groups_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_only_flags_cmd.h.test0000664000175000017500000001524112045003074017030 00000000000000/** @file test_only_flags_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_ONLY_FLAGS_CMD_H #define TEST_ONLY_FLAGS_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE "test_only_flags" #endif #ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME "test_only_flags" #endif #ifndef TEST_ONLY_FLAGS_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_ONLY_FLAGS_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_flag; /**< @brief foo option (default=on). */ const char *foo_help; /**< @brief foo option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_only_flags_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_only_flags_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_only_flags_cmd_parser_ext() instead */ int test_only_flags_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_only_flags_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_only_flags_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_only_flags_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_only_flags_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_only_flags_cmd_parser_print_help(void); /** * Print the version */ void test_only_flags_cmd_parser_print_version(void); /** * Initializes all the fields a test_only_flags_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_only_flags_cmd_parser_params_init(struct test_only_flags_cmd_parser_params *params); /** * Allocates dynamically a test_only_flags_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_only_flags_cmd_parser_params structure */ struct test_only_flags_cmd_parser_params *test_only_flags_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_only_flags_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_only_flags_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_only_flags_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_ONLY_FLAGS_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser.c0000664000175000017500000000540512045003074015367 00000000000000/* test_conf_parser.c test */ /* test all kinds of options and the conf file parser */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { unsigned int i; int result = 0; struct test_conf_parser_cmd_parser_params *params; /* initialize the parameters structure */ params = test_conf_parser_cmd_parser_params_create(); /* call the command line parser */ if (test_conf_parser_cmd_parser (argc, argv, &args_info) != 0) { result = 1; goto stop; } /* override command line options, but do not initialize args_info, check for required options. NOTICE: we must NOT skip the 0 assignment to initialize, since its default value is 1 and override defaults to 0 while check_required is already set to its default value, 1 */ params->initialize = 0; params->override = 1; /* call the config file parser */ if (test_conf_parser_cmd_parser_config_file (args_info.conf_file_arg, &args_info, params) != 0) { result = 1; goto stop; } printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); printf ("value of multi-string_given: %d\n", args_info.multi_string_given); for (i = 0; i < args_info.multi_string_given; i++) printf (" value of multi-string: %s\n", args_info.multi_string_arg [i]); printf ("value of multi-string-def_given: %d\n", args_info.multi_string_def_given); for (i = 0; i < args_info.multi_string_def_given; ++i) printf (" value of multi-string-def: %s\n", args_info.multi_string_def_arg [i]); if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0]) printf ("default value of multi-string-def: %s\n", args_info.multi_string_def_arg [0]); printf ("value of opta: %s\n", args_info.opta_arg); printf ("noarg given %d times\n", args_info.noarg_given); printf ("noarg_noshort given %d times\n", args_info.noarg_noshort_given); printf ("opt-arg given: %d\n", args_info.opt_arg_given); printf ("opt-arg value: %s\n", (args_info.opt_arg_arg ? args_info.opt_arg_arg : "not given")); if (args_info.file_save_given) { if (test_conf_parser_cmd_parser_file_save (args_info.file_save_arg, &args_info) == EXIT_FAILURE) result = 1; else printf ("saved configuration file %s\n", args_info.file_save_arg); } stop: /* deallocate structures */ test_conf_parser_cmd_parser_free (&args_info); free (params); return result; } gengetopt-2.22.6/tests/test_conf_parser_grp.sh.in0000664000175000017500000000024212044745036017040 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_conf_parser -r "bar" -i 100 -c @srcdir@/test_conf2.conf --opta "FOO"; then true; else false; fi gengetopt-2.22.6/tests/test_conf_parser_save.sh.in0000664000175000017500000000027712044745036017216 00000000000000#! @SHELL@ # reads the configuration file that was previously saved by test_conf_parser.sh if $* ./test_conf_parser_file_save --conf-file="test_conf_parser.save"; then true; else false; fi gengetopt-2.22.6/tests/Makefile.am0000664000175000017500000004713312045003074013723 00000000000000# Copyright (C) 1999-2009 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if NO_CROSSCOMPILING SUBDIRS = output_dir output_header_dir # .ggonu is used in this test suite for command line parsers that have # to be created without --unamed-opt SUFFIXES = .ggo .ggonu .ggoconf .ggostr # we do not generate the gengetopt version number in the output # file so that the number does not disturb in diffing when changing # gengetopt version PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT) --gen-version PROGNAMESHOWHELP = $(PROGNAME) --show-help --long-help PROGNAMESHOWFULLHELP = $(PROGNAME) --show-full-help --long-help PROGNAMESHOWDETAILEDHELP = $(PROGNAME) --show-detailed-help --long-help PROGNAMESHOWHELPREQUIRED = $(PROGNAME) --show-help --long-help --show-required GGO_COMPILE = $(PROGNAME) --input=$< --func-name=$*_parser --file-name=$* .ggo.c: $(GGO_COMPILE) --unamed-opt --show-required .ggonu.c: $(PROGNAME) --input $< --func-name $*_parser --file-name $* .ggoconf.c: $(GGO_COMPILE) --unamed-opt="OTHER NAMES" --conf-parser --arg-struct-name="my_args_info" --no-handle-error .ggostr.c: $(GGO_COMPILE) --unamed-opt="OTHER NAMES" --string-parser --arg-struct-name=$*_struct --include-getopt #.ggo.err: # $(PROGNAME) --unamed-opt -i $< --file-name null 2> $@ || true test_manual_help_cmd.c: $(srcdir)/test_manual_help_cmd.ggo $(GGO_COMPILE) --unamed-opt --show-required --no-help --no-version # INCLUDES is added to LDFLAGS because .ggo file are sources, and thus # the .c files are passed to the linker, which also compiles, thus # the include options should be passed to it as well AM_LDFLAGS = $(DEFS) $(INCLUDES) #LDADD = $(GETOPTLONG_O) $(STRDUP_O) -lefence # these are for gnulib AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl #AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl -Wall -Wunused -W -Wcast-align -Wfloat-equal -Wpointer-arith -Wwrite-strings LDADD = $(top_builddir)/gl/libgnu.la OUTPUTDIR=$(top_builddir)/tests/output_dir OUTPUT_SRC_DIR=$(top_builddir)/tests/output_dir OUTPUT_HEADER_DIR=$(top_builddir)/tests/output_header_dir OUTPUTDIR_OPTION= --output-dir=$(OUTPUTDIR) OUTPUTDIRS_OPTION= --src-output-dir=$(OUTPUT_SRC_DIR) --header-output-dir=$(OUTPUT_HEADER_DIR) EXPECT = 1 VALGRINDTESTS = no_strings \ no_multi_strings no_multi_types \ no_unamed no_optgiven.sh \ more_than_once.sh canonize-names \ no_prog_name \ default_values default_cmdline test_all_opts.sh \ test_all_opts_file_save.sh \ test_groups.sh test_modes.sh \ test_conf_parser.sh test_conf_parser_ov.sh test_conf_parser_ov2.sh \ test_conf_parser_ov3.sh \ test_conf_parser_ov4.sh \ test_conf_parser_err.sh test_conf_parser_err_string.sh \ test_conf_parser_grp.sh \ test_conf_parser_save.sh \ test_multiple.sh \ test_simple_multiple_default.sh \ test_simple_multiple.sh \ test_multiple_err.sh \ test_sections.sh \ test_default_values.sh \ test_values.sh test_values_err.sh \ test_dep.sh \ test_manual_help.sh \ test_multiple_parsers.sh \ test_sections_option_help \ test_all_opts_option_help \ test_groups_option_help \ test_modes_option_help \ test_no_options \ test_newlines \ test_text \ test_only_flags \ test_usage TESTS = $(VALGRINDTESTS) \ test_show_help.sh \ test_err.sh check_PROGRAMS = no_strings \ no_multi_strings no_multi_types \ no_unamed no_optgiven \ no_optgiven2 more_than_once no_prog_name \ canonize-names default_values default_cmdline test_all_opts \ test_groups \ test_modes \ test_conf_parser test_conf_parser_ov \ test_conf_parser_ov2 \ test_conf_parser_ov3 \ test_conf_parser_ov4 \ test_conf_parser_file_save \ test_multiple \ test_simple_multiple \ test_sections \ test_values test_values_cc \ test_redef_help \ test_manual_help \ test_no_handle_help \ test_multiple_parsers \ test_sections_option_help \ test_all_opts_option_help \ test_groups_option_help \ test_modes_option_help \ test_no_options \ test_newlines \ test_text \ test_only_flags \ test_usage hidden_options_programs = test_all_opts details_options_programs = test_all_opts test_no_handle_help # in order to make it work with parallel make we need to make # these deps explicit # NOTE: this problem shows only on distribution tarballs # since files in .deps are empty no_strings_cmd.h: no_strings_cmd.c no_multi_strings_cmd.h: no_multi_strings_cmd.c no_multi_types_cmd.h: no_multi_types_cmd.c no_unamed_cmd.h: no_unamed_cmd.c no_optgiven_cmd.h: no_optgiven_cmd.c more_than_once_cmd.h: more_than_once_cmd.c canonize-names-cmd.h: canonize-names-cmd.c default_values_cmd.h: default_values_cmd.c cmdline.h: cmdline.c test_all_opts_cmd.h: test_all_opts_cmd.c test_groups_cmd.h: test_groups_cmd.c test_modes_cmd.h: test_modes_cmd.c test_conf_parser_cmd.h: test_conf_parser_cmd.c test_multiple_cmd.h: test_multiple_cmd.c test_simple_multiple_cmd.h: test_simple_multiple_cmd.c test_sections_cmd.h: test_sections_cmd.c test_values_cmd.h: test_values_cmd.c test_values_cmd_cc.cc: test_values_cmd.c test_redef_help_cmd.h: test_redef_help_cmd.c test_manual_help_cmd.h: test_manual_help_cmd.c test_manual_help_args_cmd.h: test_manual_help_args_cmd.c test_no_handle_help_cmd.h: test_no_handle_help_cmd.c test_main_cmdline_cmd.h: test_main_cmdline_cmd.c test_first_cmdline_cmd.h: test_first_cmdline_cmd.c test_second_cmdline_cmd.h: test_second_cmdline_cmd.c test_no_options_cmd.h: test_no_options_cmd.c test_align_cmd.h: test_align_cmd.c test_newlines_cmd.h: test_newlines_cmd.c test_text_cmd.h: test_text_cmd.c test_only_flags_cmd.h: test_only_flags_cmd.c test_usage_cmd.h: test_usage_cmd.c no_strings_SOURCES = no_strings_cmd.ggo no_strings.c no_multi_strings_SOURCES = no_multi_strings_cmd.ggo no_multi_strings.c no_multi_types_SOURCES = no_multi_types_cmd.ggo no_multi_types.c no_unamed_SOURCES = no_unamed_cmd.ggonu no_unamed.c no_optgiven_SOURCES = no_optgiven_cmd.ggo no_optgiven.c no_optgiven2_SOURCES = no_optgiven_cmd.ggo no_optgiven2.c more_than_once_SOURCES = more_than_once_cmd.ggo more_than_once.c canonize_names_SOURCES = canonize-names-cmd.ggo canonize-names.c default_values_SOURCES = default_values_cmd.ggo default_values.c default_cmdline_SOURCES = cmdline.ggo default_cmdline.c #default_cmdline_CPPFLAGS = -DPACKAGE_NAME="\"default_cmdline\"" test_all_opts_SOURCES = test_all_opts_cmd.ggo test_all_opts.c no_prog_name_SOURCES = test_all_opts_cmd.ggo no_prog_name.c # force using our version of getopt test_groups_SOURCES = test_groups_cmd.ggo test_groups.c test_modes_SOURCES = test_modes_cmd.ggo test_modes.c test_conf_parser_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser.c test_conf_parser_ov_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov.c test_conf_parser_ov2_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov2.c test_conf_parser_ov3_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov3.c test_conf_parser_ov4_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_ov4.c test_conf_parser_file_save_SOURCES = test_conf_parser_cmd.ggoconf test_conf_parser_file_save.c test_multiple_SOURCES = test_multiple_cmd.ggo test_multiple.cc test_simple_multiple_SOURCES = test_simple_multiple_cmd.ggo test_simple_multiple.cc test_sections_SOURCES = test_sections_cmd.ggo test_sections.c test_values_SOURCES = test_values_cmd.ggo test_values.c test_values_cc_SOURCES = test_values_cmd_cc.cc test_values_cc.cc test_redef_help_SOURCES = test_redef_help_cmd.ggo test_redef_help.c test_manual_help_SOURCES = test_manual_help_cmd.ggo test_manual_help.c test_manual_help_args_SOURCES = test_manual_help_args_cmd.ggo test_no_handle_help_SOURCES = test_no_handle_help_cmd.ggo test_no_handle_help.c test_multiple_parsers_SOURCES = test_main_cmdline_cmd.ggo test_first_cmdline_cmd.ggostr test_second_cmdline_cmd.ggostr test_multiple_parsers.c test_sections_option_help_SOURCES = test_sections_cmd.ggo test_sections_option_help.c test_all_opts_option_help_SOURCES = test_all_opts_cmd.ggo test_all_opts_option_help.c test_groups_option_help_SOURCES = test_groups_cmd.ggo test_groups_option_help.c test_modes_option_help_SOURCES = test_modes_cmd.ggo test_modes_option_help.c test_no_options_SOURCES = test_no_options_cmd.ggo test_no_options.c test_newlines_SOURCES = test_newlines_cmd.ggo test_newlines.c test_text_SOURCES = test_text_cmd.ggo test_text.c test_only_flags_SOURCES = test_only_flags_cmd.ggo test_only_flags.c test_usage_SOURCES = test_usage_cmd.ggo test_usage.c CHECKDIFFFILES = no_strings_cmd.c no_strings_cmd.h \ no_multi_strings_cmd.c no_multi_strings_cmd.h \ no_multi_types_cmd.c no_multi_types_cmd.h \ no_unamed_cmd.c no_unamed_cmd.h \ no_optgiven_cmd.c no_optgiven_cmd.h \ more_than_once_cmd.c more_than_once_cmd.h \ canonize-names-cmd.c canonize-names-cmd.h \ default_values_cmd.c default_values_cmd.h \ cmdline.c cmdline.h \ test_all_opts_cmd.c test_all_opts_cmd.h \ test_groups_cmd.c test_groups_cmd.h \ test_modes_cmd.c test_modes_cmd.h \ test_conf_parser_cmd.c test_conf_parser_cmd.h \ test_multiple_cmd.c test_multiple_cmd.h \ test_simple_multiple_cmd.c test_simple_multiple_cmd.h \ test_sections_cmd.c \ test_values_cmd.c test_values_cmd.h \ test_redef_help_cmd.c test_redef_help_cmd.h \ test_manual_help_cmd.c test_manual_help_cmd.h \ test_manual_help_args_cmd.c test_manual_help_args_cmd.h \ test_no_handle_help_cmd.c test_no_handle_help_cmd.h \ test_main_cmdline_cmd.c test_main_cmdline_cmd.h \ test_first_cmdline_cmd.c test_first_cmdline_cmd.h \ test_second_cmdline_cmd.c test_second_cmdline_cmd.h \ test_no_options_cmd.h test_no_options_cmd.c \ test_newlines_cmd.h test_newlines_cmd.c \ test_align_cmd.h test_align_cmd.c \ test_text_cmd.h test_text_cmd.c \ test_only_flags_cmd.h test_only_flags_cmd.c \ test_usage_cmd.h test_usage_cmd.c BUILT_SOURCES = $(CHECKDIFFFILES) GENERATED_TESTS = no_strings_cmd.c.test no_strings_cmd.h.test \ no_multi_strings_cmd.c.test no_multi_strings_cmd.h.test \ no_unamed_cmd.c.test no_unamed_cmd.h.test \ no_optgiven_cmd.c.test no_optgiven_cmd.h.test \ more_than_once_cmd.c.test more_than_once_cmd.h.test \ canonize-names-cmd.c.test canonize-names-cmd.h.test \ default_values_cmd.c.test default_values_cmd.h.test \ cmdline.c.test cmdline.h.test \ test_all_opts_cmd.c.test test_all_opts_cmd.h.test \ test_groups_cmd.c.test test_groups_cmd.h.test \ test_modes_cmd.c.test test_modes_cmd.h.test \ test_conf_parser_cmd.c.test test_conf_parser_cmd.h.test \ test_multiple_cmd.c.test test_multiple_cmd.h.test \ test_simple_multiple_cmd.c.test test_simple_multiple_cmd.h.test \ test_sections_cmd.c.test \ test_values_cmd.c.test test_values_cmd.h.test \ test_all_opts.save.test test_multiple.save.test \ test_conf_parser.save.test test_values.save.test \ test_redef_help_cmd.c.test test_redef_help_cmd.h.test \ test_main_cmdline_cmd.c.test test_main_cmdline_cmd.h.test \ test_first_cmdline_cmd.c.test test_first_cmdline_cmd.h.test \ test_second_cmdline_cmd.c.test test_second_cmdline_cmd.h.test \ test_no_options_cmd.h.test test_no_options_cmd.c.test \ test_align_cmd.h.test test_align_cmd.c.test \ test_text_cmd.h.test test_text_cmd.c.test \ test_only_flags_cmd.h.test test_only_flags_cmd.c.test # the original command line used to be: # $(GGO_COMPILE) --no-handle-error -u # but now are in the input .ggo file no_optgiven_cmd.c: no_optgiven_cmd.ggo $(GGO_COMPILE) # using $(top_builddir) should test also the removal of leading path # for the generation of the #ifndef in the generated header file canonize-names-cmd.c: canonize-names-cmd.ggo $(PROGNAME) --input $(srcdir)/canonize-names-cmd.ggo --func-name $*-parser --file-name $(top_builddir)/tests/$* cmdline.c: cmdline.ggo $(PROGNAME) --input $(srcdir)/cmdline.ggo TESTSOUT = test.out TESTSOUTPUT = test.output ERRFILES = wrong_flag.err wrong_flag2.err wrong_group.err wrong_group2.err \ wrong_dep.err wrong_default.err wrong_numeric_value.err wrong_enum_use.err \ wrong_help_redef.err wrong_version_redef.err wrong_multiple_occurrence.err ERRGGOFILES = wrong_flag.ggo wrong_flag2.ggo wrong_group.ggo wrong_group2.ggo \ wrong_dep.ggo wrong_default.ggo wrong_numeric_value.ggo wrong_enum_use.ggo \ wrong_help_redef.ggo wrong_version_redef.ggo wrong_multiple_occurrence.ggo gengetoptexamples_DATA = test_manual_help_cmd.c test_manual_help_cmd.h \ test_manual_help_cmd.ggo test_manual_help.c EXTRA_DIST = no_optgiven.sh.in more_than_once.sh.in \ test_all_opts.sh.in test_all_opts_file_save.sh.in \ test_groups.sh.in test_modes.sh.in \ test_conf_parser.sh.in test_conf_parser_save.sh.in \ test_conf_parser_grp.sh.in \ test_conf_parser_ov.sh.in test_conf_parser_ov2.sh.in \ test_conf_parser_ov3.sh.in \ test_conf_parser_ov4.sh.in \ test_conf_parser_err.sh.in test_conf_parser_err_string.sh.in \ test_multiple.sh.in test_multiple_err.sh.in test_sections.sh.in test_default_values.sh.in \ test_simple_multiple_default.sh.in \ test_simple_multiple.sh.in \ test_conf_parser_ov2.c.in test_conf_parser_ov3.c.in \ test_conf_parser_ov4.c.in \ test_values.sh.in test_values_err.sh.in test_show_help.sh.in \ valgrind_tests.sh.in valgrind_suppressions.sh.in test_err.sh.in \ test_dep.sh.in test_manual_help.sh.in test_multiple_parsers.sh.in \ $(GENERATED_TESTS) \ $(TESTSOUTPUT) \ $(gengetoptexamples_DATA) \ suppressions.supp \ test_conf.conf.in \ test_conf_inc.conf.in test_conf_inc_inc.conf test_conf_inc2.conf \ test_conf2.conf test_conf3.conf test_conf_err.conf \ test_conf_err_string.conf test_conf_err_string2.conf \ test_section_with_all_hidden.ggo \ test_required_optional_cmd.ggo \ test_align_cmd.ggo \ test_manual_help_args_cmd.ggo \ $(ERRFILES) $(ERRGGOFILES) check-am: check-output-dir check-output-dirs check-output-dir: rm -f $(OUTPUTDIR)/cmdline.c $(OUTPUTDIR)/cmdline.h $(PROGNAME) --unamed-opt --show-required $(OUTPUTDIR_OPTION) -i $(srcdir)/cmdline.ggo test -f $(OUTPUTDIR)/cmdline.c test -f $(OUTPUTDIR)/cmdline.h check-output-dirs: rm -f $(OUTPUTDIR)/cmdline.c $(OUTPUTDIR)/cmdline.h rm -f $(OUTPUT_SRC_DIR)/cmdline.c $(OUTPUT_HEADER_DIR)/cmdline.h $(PROGNAME) --unamed-opt --show-required $(OUTPUTDIRS_OPTION) -i $(srcdir)/cmdline.ggo test -f $(OUTPUT_SRC_DIR)/cmdline.c test -f $(OUTPUT_HEADER_DIR)/cmdline.h check-err: $(ERRFILES) for source in $(ERRFILES); do \ test_input="`echo $$source|sed s/err/ggo/`"; \ $(PROGNAME) --unamed-opt -i $(srcdir)/$$test_input --file-name null 2> $$source.out || true ; \ sed -i -e "s/.*\///" $$source.out ; \ echo "diff $$source.out $$source"; \ if ! diff $$source.out $(srcdir)/$$source; \ then errors=1; fi; \ done ; \ test -z $$errors $(TESTSOUTPUT): rm -f $(TESTSOUTPUT); \ for source in $(TESTS); do \ echo "*** $$source" >> $@; \ $(top_builddir)/tests/$$source >> $@ 2>&1; \ done && \ for source in $(check_PROGRAMS); do \ echo "*** $$source -h" >> $@; \ $(top_builddir)/tests/$$source -h >> $@ 2>&1; \ done && \ for source in $(hidden_options_programs); do \ echo "*** $$source --full-help" >> $@; \ $(top_builddir)/tests/$$source --full-help >> $@ 2>&1; \ done && \ for source in $(details_options_programs); do \ echo "*** $$source --detailed-help" >> $@; \ $(top_builddir)/tests/$$source --detailed-help >> $@ 2>&1; \ done && \ $(PROGNAMESHOWHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_modes_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $@ 2>&1; $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $@ 2>&1; $(PROGNAME) --show-help < $(srcdir)/test_align_cmd.ggo >> $@ 2>&1; $(PROGNAME) --show-full-help < $(srcdir)/test_align_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWHELPREQUIRED) < $(srcdir)/test_required_optional_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWHELPREQUIRED) --default-optional < $(srcdir)/test_required_optional_cmd.ggo >> $@ 2>&1; $(PROGNAMESHOWFULLHELP) $(srcdir)/test_strict_hidden.ggo >> $@ 2>&1; $(PROGNAMESHOWDETAILEDHELP) $(srcdir)/test_strict_hidden.ggo >> $@ 2>&1; store-backup: $(BUILT_SOURCES) $(TESTSOUTPUT) rm -f *.test; \ for source in $(BUILT_SOURCES); do \ back_output="`echo $$source.test`"; \ echo "saving $$back_output"; \ cp $$source $(srcdir)/$$back_output; \ done; \ for source in `ls *.save`; do \ test_output="`echo $$source|sed s/save/save\.test/`"; \ cp $$source $(srcdir)/$$test_output; \ done; \ cp $(TESTSOUT) $(srcdir)/$(TESTSOUTPUT); \ rm -f *.err.test check-diff: for source in $(CHECKDIFFFILES); do \ back_output="`echo $$source.test`"; \ echo "diff $$source $$back_output"; \ if ! diff $$source $(srcdir)/$$back_output; \ then errors=1; fi; \ done && \ echo "creating output of tests..."; \ rm -f $(TESTSOUT); \ for tests in $(TESTS); do \ echo "*** $$tests" >> $(TESTSOUT); \ $(top_builddir)/tests/$$tests >> $(TESTSOUT) 2>&1 ; \ done && \ for tests in $(check_PROGRAMS); do \ echo "*** $$tests -h" >> $(TESTSOUT); \ $(top_builddir)/tests/$$tests -h >> $(TESTSOUT) 2>&1; \ done && \ for tests in $(hidden_options_programs); do \ echo "*** $$tests --full-help" >> $(TESTSOUT); \ $(top_builddir)/tests/$$tests --full-help >> $(TESTSOUT) 2>&1; \ done && \ for tests in $(details_options_programs); do \ echo "*** $$tests --detailed-help" >> $(TESTSOUT); \ $(top_builddir)/tests/$$tests --detailed-help >> $(TESTSOUT) 2>&1; \ done && \ $(PROGNAMESHOWHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_modes_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_all_opts_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_section_with_all_hidden.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAME) --show-help < $(srcdir)/test_align_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAME) --show-full-help < $(srcdir)/test_align_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWHELPREQUIRED) < $(srcdir)/test_required_optional_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWHELPREQUIRED) --default-optional < $(srcdir)/test_required_optional_cmd.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWFULLHELP) < $(srcdir)/test_strict_hidden.ggo >> $(TESTSOUT) 2>&1; \ $(PROGNAMESHOWDETAILEDHELP) < $(srcdir)/test_strict_hidden.ggo >> ${TESTSOUT} 2>&1; \ sed -i -e "s/\.exe//g" $(TESTSOUT) ; \ echo "diff $(TESTSOUTPUT) $(TESTSOUT)"; \ if ! diff $(srcdir)/$(TESTSOUTPUT) $(TESTSOUT); \ then errors=1; fi; \ for source in `ls *.save`; do \ test_output="`echo $$source|sed s/save/save\.test/`"; \ echo "diff $$source $(srcdir)/$$test_output"; \ if ! diff $$source $(srcdir)/$$test_output; \ then errors=1; fi; \ done; \ test -z $$errors my-check: clean check check-diff check-valgrind: $(top_builddir)/tests/valgrind_tests.sh $(VALGRINDTESTS) $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/default_values$(EXEEXT) --help $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/default_values$(EXEEXT) --version $(top_builddir)/tests/valgrind_tests.sh $(top_builddir)/tests/test_all_opts$(EXEEXT) --help clean-err: rm -f *.err CLEANFILES = *_cmd.c *_cmd.h *-cmd.h *-cmd.c cmdline.c cmdline.h *.save *.err.out endif gengetopt-2.22.6/tests/test_only_flags.c0000664000175000017500000000052412045003074015220 00000000000000/* test_only_flags.c test */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "test_only_flags_cmd.h" int main (int argc, char **argv) { struct gengetopt_args_info args_info; /* let's call our cmdline parser */ if (test_only_flags_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; return 0; } gengetopt-2.22.6/tests/default_values_cmd.ggo0000664000175000017500000000142312044745036016215 00000000000000# default_values_cmd.ggo # test default values package "default_values" version "1.0" option "foo" f "foo option" int default="15000" no option "bar" b "bar option" string default="this is a default" no option "foo-opt" F "foo option with optional arg" int default="15000" no argoptional option "bar-opt" B "bar option with optional arg" string default="this is a default" no argoptional option "foofloat" - "foo float option" float default="15000" no option "foodouble" - "foo double option" double default="15000" no option "pi" p "PI option" double default="3.1415926536" no option "timeout" s "number of seconds after the scanning is cancelled if no progress is shown at all." int typestr="123456789012" default="120" nogengetopt-2.22.6/tests/test_conf3.conf0000664000175000017500000000012112044745036014601 00000000000000# multiple options M "from another file" multi-string = multi-string "last?" gengetopt-2.22.6/tests/no_strings_cmd.ggo0000664000175000017500000000031712044745036015400 00000000000000# no_strings_cmd.ggo # This test an input file with no string options package "no_strings" version "1.0" usage "no_strings [--foo|-i] " option "foo" i "foo option" int optional gengetopt-2.22.6/tests/test_conf_parser_ov2.c0000664000175000017500000000310712046536543016167 00000000000000/* test_conf_parser_ov2.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser_ov.c, first scan the conf file and then the command line */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { struct test_conf_parser_cmd_parser_params *params; /* initialize the parameters structure */ params = test_conf_parser_cmd_parser_params_create(); /* initialize args_info, but don't check for required options NOTICE: the other fields are initialized to their default values */ params->check_required = 0; /* call the config file parser */ if (test_conf_parser_cmd_parser_config_file ("../../tests/test_conf2.conf", &args_info, params) != 0) exit(1); /* override config file options, do not initialize args_info, check for required options. */ params->initialize = 0; params->override = 1; params->check_required = 1; /* call the command line parser */ if (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0) exit(1) ; printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); /* release memory */ test_conf_parser_cmd_parser_free (&args_info); free (params); return 0; } gengetopt-2.22.6/tests/test_conf_parser_ov.c0000664000175000017500000000323312045003074016070 00000000000000/* test_conf_parser_ov.c test */ /* test all kinds of options and the conf file parser */ /* differently from test_conf_parser.c, the conf file does not override command line options */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; int main (int argc, char **argv) { unsigned int i; if (test_conf_parser_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; /* do not override command line options, do not initialize args_info */ if (test_conf_parser_cmd_parser_configfile (args_info.conf_file_arg, &args_info, 0, 0, 1) != 0) exit(1); printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); printf ("value of multi-string_given: %d\n", args_info.multi_string_given); for (i = 0; i < args_info.multi_string_given; ++i) printf (" value of multi-string: %s\n", args_info.multi_string_arg [i]); printf ("value of multi-string-def_given: %d\n", args_info.multi_string_def_given); for (i = 0; i < args_info.multi_string_def_given; ++i) printf (" value of multi-string-def: %s\n", args_info.multi_string_def_arg [i]); if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0]) printf ("default value of multi-string-def: %s\n", args_info.multi_string_def_arg [0]); test_conf_parser_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_first_cmdline_cmd.c.test0000664000175000017500000013547112045003074017520 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_first_cmdline_cmd.ggostr --func-name=test_first_cmdline_cmd_parser --file-name=test_first_cmdline_cmd --unamed-opt=OTHER NAMES --string-parser --arg-struct-name=test_first_cmdline_cmd_struct --include-getopt The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include "test_first_cmdline_cmd.h" const char *test_first_cmdline_cmd_struct_purpose = ""; const char *test_first_cmdline_cmd_struct_usage = "Usage: " TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE " [OPTIONS]... [OTHER NAMES]..."; const char *test_first_cmdline_cmd_struct_versiontext = ""; const char *test_first_cmdline_cmd_struct_description = ""; const char *test_first_cmdline_cmd_struct_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -a, --option-a=INT option a of the first command line to parse", " -M, --multi=STRING multiple option of the first command line to parse", 0 }; typedef enum {ARG_NO , ARG_STRING , ARG_INT } test_first_cmdline_cmd_parser_arg_type; static void clear_given (struct test_first_cmdline_cmd_struct *args_info); static void clear_args (struct test_first_cmdline_cmd_struct *args_info); static int test_first_cmdline_cmd_parser_internal (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, struct test_first_cmdline_cmd_parser_params *params, const char *additional_error); static int test_first_cmdline_cmd_parser_required2 (struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, const char *additional_error); struct line_list { char * string_arg; struct line_list * next; }; static struct line_list *cmd_line_list = 0; static struct line_list *cmd_line_list_tmp = 0; static void free_cmd_list(void) { /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } } } static char * gengetopt_strdup (const char *s); static void clear_given (struct test_first_cmdline_cmd_struct *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->option_a_given = 0 ; args_info->multi_given = 0 ; } static void clear_args (struct test_first_cmdline_cmd_struct *args_info) { FIX_UNUSED (args_info); args_info->option_a_orig = NULL; args_info->multi_arg = NULL; args_info->multi_orig = NULL; } static void init_args_info(struct test_first_cmdline_cmd_struct *args_info) { args_info->help_help = test_first_cmdline_cmd_struct_help[0] ; args_info->version_help = test_first_cmdline_cmd_struct_help[1] ; args_info->option_a_help = test_first_cmdline_cmd_struct_help[2] ; args_info->multi_help = test_first_cmdline_cmd_struct_help[3] ; args_info->multi_min = 0; args_info->multi_max = 0; } void test_first_cmdline_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE_NAME) ? TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE_NAME : TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE), TEST_FIRST_CMDLINE_CMD_PARSER_VERSION); if (strlen(test_first_cmdline_cmd_struct_versiontext) > 0) printf("\n%s\n", test_first_cmdline_cmd_struct_versiontext); } static void print_help_common(void) { test_first_cmdline_cmd_parser_print_version (); if (strlen(test_first_cmdline_cmd_struct_purpose) > 0) printf("\n%s\n", test_first_cmdline_cmd_struct_purpose); if (strlen(test_first_cmdline_cmd_struct_usage) > 0) printf("\n%s\n", test_first_cmdline_cmd_struct_usage); printf("\n"); if (strlen(test_first_cmdline_cmd_struct_description) > 0) printf("%s\n\n", test_first_cmdline_cmd_struct_description); } void test_first_cmdline_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (test_first_cmdline_cmd_struct_help[i]) printf("%s\n", test_first_cmdline_cmd_struct_help[i++]); } void test_first_cmdline_cmd_parser_init (struct test_first_cmdline_cmd_struct *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_first_cmdline_cmd_parser_params_init(struct test_first_cmdline_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_first_cmdline_cmd_parser_params * test_first_cmdline_cmd_parser_params_create(void) { struct test_first_cmdline_cmd_parser_params *params = (struct test_first_cmdline_cmd_parser_params *)malloc(sizeof(struct test_first_cmdline_cmd_parser_params)); test_first_cmdline_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { int int_arg; char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_first_cmdline_cmd_parser_release (struct test_first_cmdline_cmd_struct *args_info) { unsigned int i; free_string_field (&(args_info->option_a_orig)); free_multiple_string_field (args_info->multi_given, &(args_info->multi_arg), &(args_info->multi_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_first_cmdline_cmd_parser_dump(FILE *outfile, struct test_first_cmdline_cmd_struct *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->option_a_given) write_into_file(outfile, "option-a", args_info->option_a_orig, 0); write_multiple_into_file(outfile, args_info->multi_given, "multi", args_info->multi_orig, 0); i = EXIT_SUCCESS; return i; } int test_first_cmdline_cmd_parser_file_save(const char *filename, struct test_first_cmdline_cmd_struct *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_first_cmdline_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_first_cmdline_cmd_parser_free (struct test_first_cmdline_cmd_struct *args_info) { test_first_cmdline_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_first_cmdline_cmd_parser (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info) { return test_first_cmdline_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_first_cmdline_cmd_parser_ext (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, struct test_first_cmdline_cmd_parser_params *params) { int result; result = test_first_cmdline_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_first_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_first_cmdline_cmd_parser2 (int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, int override, int initialize, int check_required) { int result; struct test_first_cmdline_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_first_cmdline_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_first_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_first_cmdline_cmd_parser_required (struct test_first_cmdline_cmd_struct *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_first_cmdline_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_first_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_first_cmdline_cmd_parser_required2 (struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->multi_given, args_info->multi_min, args_info->multi_max, "'--multi' ('-M')")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } /* * Extracted from the glibc source tree, version 2.3.6 * * Licensed under the GPL as per the whole glibc source tree. * * This file was modified so that getopt_long can be called * many times without risking previous memory to be spoiled. * * Modified by Andre Noll and Lorenzo Bettini for use in * GNU gengetopt generated files. * */ /* * we must include anything we need since this file is not thought to be * inserted in a file already using getopt.h * * Lorenzo */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. */ /* If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `custom_optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ /* Names for the values of the `has_arg' field of `struct option'. */ #ifndef no_argument #define no_argument 0 #endif #ifndef required_argument #define required_argument 1 #endif #ifndef optional_argument #define optional_argument 2 #endif struct custom_getopt_data { /* * These have exactly the same meaning as the corresponding global variables, * except that they are used for the reentrant versions of getopt. */ int custom_optind; int custom_opterr; int custom_optopt; char *custom_optarg; /* True if the internal members have been initialized. */ int initialized; /* * The next char to be scanned in the option-element in which the last option * character we returned was found. This allows us to pick up the scan where * we left off. If this is zero, or a null string, it means resume the scan by * advancing to the next ARGV-element. */ char *nextchar; /* * Describe the part of ARGV that contains non-options that have been skipped. * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is * the index after the last of them. */ int first_nonopt; int last_nonopt; }; /* * the variables optarg, optind, opterr and optopt are renamed with * the custom_ prefix so that they don't interfere with getopt ones. * * Moreover they're static so they are visible only from within the * file where this very file will be included. */ /* * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an * option that takes an argument, the argument value is returned here. */ static char *custom_optarg; /* * Index in ARGV of the next element to be scanned. This is used for * communication to and from the caller and for communication between * successive calls to `custom_getopt'. * * On entry to `custom_getopt', 1 means this is the first call; initialize. * * When `custom_getopt' returns -1, this is the index of the first of the non-option * elements that the caller should itself scan. * * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV * has been scanned so far. * * 1003.2 says this must be 1 before any call. */ static int custom_optind = 1; /* * Callers store zero here to inhibit the error message for unrecognized * options. */ static int custom_opterr = 1; /* * Set to an option character which was unrecognized. This must be initialized * on some systems to avoid linking in the system's own getopt implementation. */ static int custom_optopt = '?'; /* * Exchange two adjacent subsequences of ARGV. One subsequence is elements * [first_nonopt,last_nonopt) which contains all the non-options that have been * skipped so far. The other is elements [last_nonopt,custom_optind), which contains * all the options processed since those non-options were skipped. * `first_nonopt' and `last_nonopt' are relocated so that they describe the new * indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv, struct custom_getopt_data *d) { int bottom = d->first_nonopt; int middle = d->last_nonopt; int top = d->custom_optind; char *tem; /* * Exchange the shorter segment with the far end of the longer segment. * That puts the shorter segment into the right place. It leaves the * longer segment in the right place overall, but it consists of two * parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->first_nonopt += (d->custom_optind - d->last_nonopt); d->last_nonopt = d->custom_optind; } /* Initialize the internal data when the first call is made. */ static void custom_getopt_initialize(struct custom_getopt_data *d) { /* * Start processing options with ARGV-element 1 (since ARGV-element 0 * is the program name); the sequence of previously skipped non-option * ARGV-elements is empty. */ d->first_nonopt = d->last_nonopt = d->custom_optind; d->nextchar = NULL; d->initialized = 1; } #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0') /* return: zero: continue, nonzero: return given value to user */ static int shuffle_argv(int argc, char *const *argv,const struct option *longopts, struct custom_getopt_data *d) { /* * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been * moved back by the user (who may also have changed the arguments). */ if (d->last_nonopt > d->custom_optind) d->last_nonopt = d->custom_optind; if (d->first_nonopt > d->custom_optind) d->first_nonopt = d->custom_optind; /* * If we have just processed some options following some * non-options, exchange them so that the options come first. */ if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->last_nonopt != d->custom_optind) d->first_nonopt = d->custom_optind; /* * Skip any additional non-options and extend the range of * non-options previously skipped. */ while (d->custom_optind < argc && NONOPTION_P) d->custom_optind++; d->last_nonopt = d->custom_optind; /* * The special ARGV-element `--' means premature end of options. Skip * it like a null option, then exchange with previous non-options as if * it were an option, then skip everything else like a non-option. */ if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) { d->custom_optind++; if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->first_nonopt == d->last_nonopt) d->first_nonopt = d->custom_optind; d->last_nonopt = argc; d->custom_optind = argc; } /* * If we have done all the ARGV-elements, stop the scan and back over * any non-options that we skipped and permuted. */ if (d->custom_optind == argc) { /* * Set the next-arg-index to point at the non-options that we * previously skipped, so the caller will digest them. */ if (d->first_nonopt != d->last_nonopt) d->custom_optind = d->first_nonopt; return -1; } /* * If we have come to a non-option and did not permute it, either stop * the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { d->custom_optarg = argv[d->custom_optind++]; return 1; } /* * We have found another option-ARGV-element. Skip the initial * punctuation. */ d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-')); return 0; } /* * Check whether the ARGV-element is a long option. * * If there's a long option "fubar" and the ARGV-element is "-fu", consider * that an abbreviation of the long option, just like "--fu", and not "-f" with * arg "u". * * This distinction seems to be the most useful approach. * */ static int check_long_opt(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int print_errors, struct custom_getopt_data *d) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) { if ((unsigned int) (nameend - d->nextchar) == (unsigned int) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[d->custom_optind]); } d->nextchar += strlen(d->nextchar); d->custom_optind++; d->custom_optopt = 0; return '?'; } if (pfound) { option_index = indfound; d->custom_optind++; if (*nameend) { if (pfound->has_arg != no_argument) d->custom_optarg = nameend + 1; else { if (print_errors) { if (argv[d->custom_optind - 1][1] == '-') { /* --option */ fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); } else { /* +option or -option */ fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[d->custom_optind - 1][0], pfound->name); } } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return '?'; } } else if (pfound->has_arg == required_argument) { if (d->custom_optind < argc) d->custom_optarg = argv[d->custom_optind++]; else { if (print_errors) { fprintf(stderr, "%s: option `%s' requires an argument\n", argv[0], argv[d->custom_optind - 1]); } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->nextchar += strlen(d->nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* * Can't find it as a long option. If this is not getopt_long_only, or * the option starts with '--' or is not a valid short option, then * it's an error. Otherwise interpret it as a short option. */ if (print_errors) { if (argv[d->custom_optind][1] == '-') { /* --option */ fprintf(stderr, "%s: unrecognized option `--%s'\n", argv[0], d->nextchar); } else { /* +option or -option */ fprintf(stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[d->custom_optind][0], d->nextchar); } } d->nextchar = (char *) ""; d->custom_optind++; d->custom_optopt = 0; return '?'; } static int check_short_opt(int argc, char *const *argv, const char *optstring, int print_errors, struct custom_getopt_data *d) { char c = *d->nextchar++; const char *temp = strchr(optstring, c); /* Increment `custom_optind' when we start to process its last character. */ if (*d->nextchar == '\0') ++d->custom_optind; if (!temp || c == ':') { if (print_errors) fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); d->custom_optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; d->custom_optind++; } else d->custom_optarg = NULL; d->nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; /* * If we end this ARGV-element by taking the * rest as an arg, we must advance to the next * element now. */ d->custom_optind++; } else if (d->custom_optind == argc) { if (print_errors) { fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c); } d->custom_optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* * We already incremented `custom_optind' once; * increment it again when taking next ARGV-elt * as argument. */ d->custom_optarg = argv[d->custom_optind++]; d->nextchar = NULL; } } return c; } /* * Scan elements of ARGV for option characters given in OPTSTRING. * * If an element of ARGV starts with '-', and is not exactly "-" or "--", * then it is an option element. The characters of this element * (aside from the initial '-') are option characters. If `getopt' * is called repeatedly, it returns successively each of the option characters * from each of the option elements. * * If `getopt' finds another option character, it returns that character, * updating `custom_optind' and `nextchar' so that the next call to `getopt' can * resume the scan with the following option character or ARGV-element. * * If there are no more option characters, `getopt' returns -1. * Then `custom_optind' is the index in ARGV of the first ARGV-element * that is not an option. (The ARGV-elements have been permuted * so that those that are not options now come last.) * * OPTSTRING is a string containing the legitimate option characters. * If an option character is seen that is not listed in OPTSTRING, * return '?' after printing an error message. If you set `custom_opterr' to * zero, the error message is suppressed but we still return '?'. * * If a char in OPTSTRING is followed by a colon, that means it wants an arg, * so the following text in the same ARGV-element, or the text of the following * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that * wants an optional arg; if there is text in the current ARGV-element, * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero. * * If OPTSTRING starts with `-' or `+', it requests different methods of * handling the non-option ARGV-elements. * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. * * Long-named options begin with `--' instead of `-'. * Their names may be abbreviated as long as the abbreviation is unique * or is an exact match for some defined option. If they have an * argument, it follows the option name in the same ARGV-element, separated * from the option name by a `=', or else the in next ARGV-element. * When `getopt' finds a long-named option, it returns 0 if that option's * `flag' field is nonzero, the value of the option's `val' field * if the `flag' field is zero. * * The elements of ARGV aren't really const, because we permute them. * But we pretend they're const in the prototype to be compatible * with other systems. * * LONGOPTS is a vector of `struct option' terminated by an * element containing a name which is zero. * * LONGIND returns the index in LONGOPT of the long-named option found. * It is only valid when a long-named option has been found by the most * recent call. * * Return the option character from OPTS just read. Return -1 when there are * no more options. For unrecognized options, or options missing arguments, * `custom_optopt' is set to the option letter, and '?' is returned. * * The OPTS string is a list of characters which are recognized option letters, * optionally followed by colons, specifying that that letter takes an * argument, to be placed in `custom_optarg'. * * If a letter in OPTS is followed by two colons, its argument is optional. * This behavior is specific to the GNU `getopt'. * * The argument `--' causes premature termination of argument scanning, * explicitly telling `getopt' that there are no more options. If OPTS begins * with `--', then non-option arguments are treated as arguments to the option * '\0'. This behavior is specific to the GNU `getopt'. */ static int getopt_internal_r(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, struct custom_getopt_data *d) { int ret, print_errors = d->custom_opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->custom_optarg = NULL; /* * This is a big difference with GNU getopt, since optind == 0 * means initialization while here 1 means first call. */ if (d->custom_optind == 0 || !d->initialized) { if (d->custom_optind == 0) d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */ custom_getopt_initialize(d); } if (d->nextchar == NULL || *d->nextchar == '\0') { ret = shuffle_argv(argc, argv, longopts, d); if (ret) return ret; } if (longopts && (argv[d->custom_optind][1] == '-' )) return check_long_opt(argc, argv, optstring, longopts, longind, print_errors, d); return check_short_opt(argc, argv, optstring, print_errors, d); } static int custom_getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind) { int result; /* Keep a global copy of all internal members of d */ static struct custom_getopt_data d; d.custom_optind = custom_optind; d.custom_opterr = custom_opterr; result = getopt_internal_r(argc, argv, optstring, longopts, longind, &d); custom_optind = d.custom_optind; custom_optarg = d.custom_optarg; custom_optopt = d.custom_optopt; return result; } static int custom_getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return custom_getopt_internal(argc, argv, options, long_options, opt_index); } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_first_cmdline_cmd_parser_params.check_ambiguity * @param override @see test_first_cmdline_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_first_cmdline_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_first_cmdline_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_first_cmdline_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_INT: *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_INT: if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_first_cmdline_cmd_parser_internal ( int argc, char **argv, struct test_first_cmdline_cmd_struct *args_info, struct test_first_cmdline_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * multi_list = NULL; int error_occurred = 0; struct test_first_cmdline_cmd_struct local_args_info; int override; int initialize; int check_required; int check_ambiguity; char *optarg; int optind; int opterr; int optopt; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_first_cmdline_cmd_parser_init (args_info); test_first_cmdline_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "option-a", 1, NULL, 'a' }, { "multi", 1, NULL, 'M' }, { 0, 0, 0, 0 } }; custom_optarg = optarg; custom_optind = optind; custom_opterr = opterr; custom_optopt = optopt; c = custom_getopt_long (argc, argv, "hVa:M:", long_options, &option_index); optarg = custom_optarg; optind = custom_optind; opterr = custom_opterr; optopt = custom_optopt; if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_first_cmdline_cmd_parser_print_help (); test_first_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_first_cmdline_cmd_parser_print_version (); test_first_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'a': /* option a of the first command line to parse. */ if (update_arg( (void *)&(args_info->option_a_arg), &(args_info->option_a_orig), &(args_info->option_a_given), &(local_args_info.option_a_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "option-a", 'a', additional_error)) goto failure; break; case 'M': /* multiple option of the first command line to parse. */ if (update_multiple_arg_temp(&multi_list, &(local_args_info.multi_given), optarg, 0, 0, ARG_STRING, "multi", 'M', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_FIRST_CMDLINE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ update_multiple_arg((void *)&(args_info->multi_arg), &(args_info->multi_orig), args_info->multi_given, local_args_info.multi_given, 0, ARG_STRING, multi_list); args_info->multi_given += local_args_info.multi_given; local_args_info.multi_given = 0; if (check_required) { error_occurred += test_first_cmdline_cmd_parser_required2 (args_info, argv[0], additional_error); } test_first_cmdline_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; } return 0; failure: free_list (multi_list, 1 ); test_first_cmdline_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } static unsigned int test_first_cmdline_cmd_parser_create_argv(const char *cmdline_, char ***argv_ptr, const char *prog_name) { char *cmdline, *p; size_t n = 0, j; int i; if (prog_name) { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (prog_name); ++n; } cmdline = gengetopt_strdup(cmdline_); p = cmdline; while (p && strlen(p)) { j = strcspn(p, " \t"); ++n; if (j && j < strlen(p)) { p[j] = '\0'; cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); p += (j+1); p += strspn(p, " \t"); } else { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); break; } } *argv_ptr = (char **) malloc((n + 1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = (n-1); i >= 0; --i) { (*argv_ptr)[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } (*argv_ptr)[n] = 0; free(cmdline); return n; } int test_first_cmdline_cmd_parser_string(const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name) { return test_first_cmdline_cmd_parser_string2(cmdline, args_info, prog_name, 0, 1, 1); } int test_first_cmdline_cmd_parser_string2(const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, int override, int initialize, int check_required) { struct test_first_cmdline_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return test_first_cmdline_cmd_parser_string_ext(cmdline, args_info, prog_name, ¶ms); } int test_first_cmdline_cmd_parser_string_ext(const char *cmdline, struct test_first_cmdline_cmd_struct *args_info, const char *prog_name, struct test_first_cmdline_cmd_parser_params *params) { char **argv_ptr = 0; int result; unsigned int argc; argc = test_first_cmdline_cmd_parser_create_argv(cmdline, &argv_ptr, prog_name); result = test_first_cmdline_cmd_parser_internal (argc, argv_ptr, args_info, params, 0); if (argv_ptr) { free (argv_ptr); } free_cmd_list(); if (result == EXIT_FAILURE) { test_first_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } gengetopt-2.22.6/tests/test_conf_parser.sh.in0000664000175000017500000000056212044745036016175 00000000000000#! @SHELL@ # the next program uses a configuration file and saves the output into # another file that will be used as a configuration file by # test_conf_parser_file_save if $* ./test_conf_parser -r "bar" -i 100 -c ./test_conf.conf --opta "FOO" -M "-1" -M "zero" --file-save="test_conf_parser.save" --opt-arg these are options without names; then true; else false; fi gengetopt-2.22.6/tests/test_no_options.c0000664000175000017500000000066712045003074015262 00000000000000/* test_no_options.c test */ /* test when no option is specified but the default ones */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_no_options_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { if (test_no_options_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; test_no_options_cmd_parser_free (&args_info); return 0; } gengetopt-2.22.6/tests/test_conf_err.conf0000664000175000017500000000005512044745036015374 00000000000000required "foo" float 3.14 no-short string gengetopt-2.22.6/tests/more_than_once.sh.in0000664000175000017500000000020612044745036015610 00000000000000#! @SHELL@ # the next program must exit with error if $* ./more_than_once -f 10 -b hey test1 test2 test3; then true; else false; fi gengetopt-2.22.6/tests/wrong_group2.err0000664000175000017500000000006012044745036015031 00000000000000wrong_group2.ggo:4: missing group specification gengetopt-2.22.6/tests/wrong_help_redef.err0000664000175000017500000000012412044745036015711 00000000000000wrong_help_redef.ggo:4: if you want to redefine --help, please use option --no-help gengetopt-2.22.6/tests/more_than_once.c0000664000175000017500000000203412045003074015002 00000000000000/* more_than_once.c test */ /* it will call the command line parser more than once */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "more_than_once_cmd.h" void print_args (void); static struct gengetopt_args_info args_info; int main (int argc, char **argv) { /* let's call our cmdline parser a first time */ if (more_than_once_cmd_parser (argc, argv, &args_info) != 0) exit (1); print_args (); more_than_once_cmd_parser_free (&args_info); /* OK, let's call it again! */ if (more_than_once_cmd_parser (argc, argv, &args_info) != 0) exit (1); print_args (); more_than_once_cmd_parser_free (&args_info); return 0; } void print_args (void) { unsigned int i; if (args_info.foo_given) printf ("foo option: %d\n", args_info.foo_arg); if (args_info.bar_given) printf ("bar option: %s\n", args_info.bar_arg); if (args_info.inputs_num) { for (i = 0; i < args_info.inputs_num; ++i) printf ("arg: %s\n", args_info.inputs [i]); } } gengetopt-2.22.6/tests/test_main_cmdline_cmd.ggo0000664000175000017500000000042612044745036016672 00000000000000# test for multiple parsers, this is the main file version "1.0" option "first-cmd" F "the first command line to parse" required typestr="first command" string multiple option "second-cmd" S "the second command line to parse" required typestr="second command" string multiple gengetopt-2.22.6/tests/test_second_cmdline_cmd.c.test0000664000175000017500000013640712045003074017644 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_second_cmdline_cmd.ggostr --func-name=test_second_cmdline_cmd_parser --file-name=test_second_cmdline_cmd --unamed-opt=OTHER NAMES --string-parser --arg-struct-name=test_second_cmdline_cmd_struct --include-getopt The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include "test_second_cmdline_cmd.h" const char *test_second_cmdline_cmd_struct_purpose = ""; const char *test_second_cmdline_cmd_struct_usage = "Usage: " TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE " [OPTIONS]... [OTHER NAMES]..."; const char *test_second_cmdline_cmd_struct_versiontext = ""; const char *test_second_cmdline_cmd_struct_description = ""; const char *test_second_cmdline_cmd_struct_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -a, --option-a=STRING option a of the second command line to parse", " -b, --option-b=STRING option a of the second command line to parse", " -M, --my-multi=STRING multiple option of the second command line to parse", 0 }; typedef enum {ARG_NO , ARG_STRING } test_second_cmdline_cmd_parser_arg_type; static void clear_given (struct test_second_cmdline_cmd_struct *args_info); static void clear_args (struct test_second_cmdline_cmd_struct *args_info); static int test_second_cmdline_cmd_parser_internal (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, struct test_second_cmdline_cmd_parser_params *params, const char *additional_error); static int test_second_cmdline_cmd_parser_required2 (struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, const char *additional_error); struct line_list { char * string_arg; struct line_list * next; }; static struct line_list *cmd_line_list = 0; static struct line_list *cmd_line_list_tmp = 0; static void free_cmd_list(void) { /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } } } static char * gengetopt_strdup (const char *s); static void clear_given (struct test_second_cmdline_cmd_struct *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->option_a_given = 0 ; args_info->option_b_given = 0 ; args_info->my_multi_given = 0 ; } static void clear_args (struct test_second_cmdline_cmd_struct *args_info) { FIX_UNUSED (args_info); args_info->option_a_arg = NULL; args_info->option_a_orig = NULL; args_info->option_b_arg = NULL; args_info->option_b_orig = NULL; args_info->my_multi_arg = NULL; args_info->my_multi_orig = NULL; } static void init_args_info(struct test_second_cmdline_cmd_struct *args_info) { args_info->help_help = test_second_cmdline_cmd_struct_help[0] ; args_info->version_help = test_second_cmdline_cmd_struct_help[1] ; args_info->option_a_help = test_second_cmdline_cmd_struct_help[2] ; args_info->option_b_help = test_second_cmdline_cmd_struct_help[3] ; args_info->my_multi_help = test_second_cmdline_cmd_struct_help[4] ; args_info->my_multi_min = 0; args_info->my_multi_max = 0; } void test_second_cmdline_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE_NAME) ? TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE_NAME : TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE), TEST_SECOND_CMDLINE_CMD_PARSER_VERSION); if (strlen(test_second_cmdline_cmd_struct_versiontext) > 0) printf("\n%s\n", test_second_cmdline_cmd_struct_versiontext); } static void print_help_common(void) { test_second_cmdline_cmd_parser_print_version (); if (strlen(test_second_cmdline_cmd_struct_purpose) > 0) printf("\n%s\n", test_second_cmdline_cmd_struct_purpose); if (strlen(test_second_cmdline_cmd_struct_usage) > 0) printf("\n%s\n", test_second_cmdline_cmd_struct_usage); printf("\n"); if (strlen(test_second_cmdline_cmd_struct_description) > 0) printf("%s\n\n", test_second_cmdline_cmd_struct_description); } void test_second_cmdline_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (test_second_cmdline_cmd_struct_help[i]) printf("%s\n", test_second_cmdline_cmd_struct_help[i++]); } void test_second_cmdline_cmd_parser_init (struct test_second_cmdline_cmd_struct *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_second_cmdline_cmd_parser_params_init(struct test_second_cmdline_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_second_cmdline_cmd_parser_params * test_second_cmdline_cmd_parser_params_create(void) { struct test_second_cmdline_cmd_parser_params *params = (struct test_second_cmdline_cmd_parser_params *)malloc(sizeof(struct test_second_cmdline_cmd_parser_params)); test_second_cmdline_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_second_cmdline_cmd_parser_release (struct test_second_cmdline_cmd_struct *args_info) { unsigned int i; free_string_field (&(args_info->option_a_arg)); free_string_field (&(args_info->option_a_orig)); free_string_field (&(args_info->option_b_arg)); free_string_field (&(args_info->option_b_orig)); free_multiple_string_field (args_info->my_multi_given, &(args_info->my_multi_arg), &(args_info->my_multi_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_second_cmdline_cmd_parser_dump(FILE *outfile, struct test_second_cmdline_cmd_struct *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->option_a_given) write_into_file(outfile, "option-a", args_info->option_a_orig, 0); if (args_info->option_b_given) write_into_file(outfile, "option-b", args_info->option_b_orig, 0); write_multiple_into_file(outfile, args_info->my_multi_given, "my-multi", args_info->my_multi_orig, 0); i = EXIT_SUCCESS; return i; } int test_second_cmdline_cmd_parser_file_save(const char *filename, struct test_second_cmdline_cmd_struct *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_second_cmdline_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_second_cmdline_cmd_parser_free (struct test_second_cmdline_cmd_struct *args_info) { test_second_cmdline_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_second_cmdline_cmd_parser (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info) { return test_second_cmdline_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_second_cmdline_cmd_parser_ext (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, struct test_second_cmdline_cmd_parser_params *params) { int result; result = test_second_cmdline_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_second_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_second_cmdline_cmd_parser2 (int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, int override, int initialize, int check_required) { int result; struct test_second_cmdline_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_second_cmdline_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_second_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_second_cmdline_cmd_parser_required (struct test_second_cmdline_cmd_struct *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_second_cmdline_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_second_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_second_cmdline_cmd_parser_required2 (struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->my_multi_given, args_info->my_multi_min, args_info->my_multi_max, "'--my-multi' ('-M')")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } /* * Extracted from the glibc source tree, version 2.3.6 * * Licensed under the GPL as per the whole glibc source tree. * * This file was modified so that getopt_long can be called * many times without risking previous memory to be spoiled. * * Modified by Andre Noll and Lorenzo Bettini for use in * GNU gengetopt generated files. * */ /* * we must include anything we need since this file is not thought to be * inserted in a file already using getopt.h * * Lorenzo */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. */ /* If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `custom_optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ /* Names for the values of the `has_arg' field of `struct option'. */ #ifndef no_argument #define no_argument 0 #endif #ifndef required_argument #define required_argument 1 #endif #ifndef optional_argument #define optional_argument 2 #endif struct custom_getopt_data { /* * These have exactly the same meaning as the corresponding global variables, * except that they are used for the reentrant versions of getopt. */ int custom_optind; int custom_opterr; int custom_optopt; char *custom_optarg; /* True if the internal members have been initialized. */ int initialized; /* * The next char to be scanned in the option-element in which the last option * character we returned was found. This allows us to pick up the scan where * we left off. If this is zero, or a null string, it means resume the scan by * advancing to the next ARGV-element. */ char *nextchar; /* * Describe the part of ARGV that contains non-options that have been skipped. * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is * the index after the last of them. */ int first_nonopt; int last_nonopt; }; /* * the variables optarg, optind, opterr and optopt are renamed with * the custom_ prefix so that they don't interfere with getopt ones. * * Moreover they're static so they are visible only from within the * file where this very file will be included. */ /* * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an * option that takes an argument, the argument value is returned here. */ static char *custom_optarg; /* * Index in ARGV of the next element to be scanned. This is used for * communication to and from the caller and for communication between * successive calls to `custom_getopt'. * * On entry to `custom_getopt', 1 means this is the first call; initialize. * * When `custom_getopt' returns -1, this is the index of the first of the non-option * elements that the caller should itself scan. * * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV * has been scanned so far. * * 1003.2 says this must be 1 before any call. */ static int custom_optind = 1; /* * Callers store zero here to inhibit the error message for unrecognized * options. */ static int custom_opterr = 1; /* * Set to an option character which was unrecognized. This must be initialized * on some systems to avoid linking in the system's own getopt implementation. */ static int custom_optopt = '?'; /* * Exchange two adjacent subsequences of ARGV. One subsequence is elements * [first_nonopt,last_nonopt) which contains all the non-options that have been * skipped so far. The other is elements [last_nonopt,custom_optind), which contains * all the options processed since those non-options were skipped. * `first_nonopt' and `last_nonopt' are relocated so that they describe the new * indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv, struct custom_getopt_data *d) { int bottom = d->first_nonopt; int middle = d->last_nonopt; int top = d->custom_optind; char *tem; /* * Exchange the shorter segment with the far end of the longer segment. * That puts the shorter segment into the right place. It leaves the * longer segment in the right place overall, but it consists of two * parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->first_nonopt += (d->custom_optind - d->last_nonopt); d->last_nonopt = d->custom_optind; } /* Initialize the internal data when the first call is made. */ static void custom_getopt_initialize(struct custom_getopt_data *d) { /* * Start processing options with ARGV-element 1 (since ARGV-element 0 * is the program name); the sequence of previously skipped non-option * ARGV-elements is empty. */ d->first_nonopt = d->last_nonopt = d->custom_optind; d->nextchar = NULL; d->initialized = 1; } #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0') /* return: zero: continue, nonzero: return given value to user */ static int shuffle_argv(int argc, char *const *argv,const struct option *longopts, struct custom_getopt_data *d) { /* * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been * moved back by the user (who may also have changed the arguments). */ if (d->last_nonopt > d->custom_optind) d->last_nonopt = d->custom_optind; if (d->first_nonopt > d->custom_optind) d->first_nonopt = d->custom_optind; /* * If we have just processed some options following some * non-options, exchange them so that the options come first. */ if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->last_nonopt != d->custom_optind) d->first_nonopt = d->custom_optind; /* * Skip any additional non-options and extend the range of * non-options previously skipped. */ while (d->custom_optind < argc && NONOPTION_P) d->custom_optind++; d->last_nonopt = d->custom_optind; /* * The special ARGV-element `--' means premature end of options. Skip * it like a null option, then exchange with previous non-options as if * it were an option, then skip everything else like a non-option. */ if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) { d->custom_optind++; if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->first_nonopt == d->last_nonopt) d->first_nonopt = d->custom_optind; d->last_nonopt = argc; d->custom_optind = argc; } /* * If we have done all the ARGV-elements, stop the scan and back over * any non-options that we skipped and permuted. */ if (d->custom_optind == argc) { /* * Set the next-arg-index to point at the non-options that we * previously skipped, so the caller will digest them. */ if (d->first_nonopt != d->last_nonopt) d->custom_optind = d->first_nonopt; return -1; } /* * If we have come to a non-option and did not permute it, either stop * the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { d->custom_optarg = argv[d->custom_optind++]; return 1; } /* * We have found another option-ARGV-element. Skip the initial * punctuation. */ d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-')); return 0; } /* * Check whether the ARGV-element is a long option. * * If there's a long option "fubar" and the ARGV-element is "-fu", consider * that an abbreviation of the long option, just like "--fu", and not "-f" with * arg "u". * * This distinction seems to be the most useful approach. * */ static int check_long_opt(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int print_errors, struct custom_getopt_data *d) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) { if ((unsigned int) (nameend - d->nextchar) == (unsigned int) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[d->custom_optind]); } d->nextchar += strlen(d->nextchar); d->custom_optind++; d->custom_optopt = 0; return '?'; } if (pfound) { option_index = indfound; d->custom_optind++; if (*nameend) { if (pfound->has_arg != no_argument) d->custom_optarg = nameend + 1; else { if (print_errors) { if (argv[d->custom_optind - 1][1] == '-') { /* --option */ fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); } else { /* +option or -option */ fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[d->custom_optind - 1][0], pfound->name); } } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return '?'; } } else if (pfound->has_arg == required_argument) { if (d->custom_optind < argc) d->custom_optarg = argv[d->custom_optind++]; else { if (print_errors) { fprintf(stderr, "%s: option `%s' requires an argument\n", argv[0], argv[d->custom_optind - 1]); } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->nextchar += strlen(d->nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* * Can't find it as a long option. If this is not getopt_long_only, or * the option starts with '--' or is not a valid short option, then * it's an error. Otherwise interpret it as a short option. */ if (print_errors) { if (argv[d->custom_optind][1] == '-') { /* --option */ fprintf(stderr, "%s: unrecognized option `--%s'\n", argv[0], d->nextchar); } else { /* +option or -option */ fprintf(stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[d->custom_optind][0], d->nextchar); } } d->nextchar = (char *) ""; d->custom_optind++; d->custom_optopt = 0; return '?'; } static int check_short_opt(int argc, char *const *argv, const char *optstring, int print_errors, struct custom_getopt_data *d) { char c = *d->nextchar++; const char *temp = strchr(optstring, c); /* Increment `custom_optind' when we start to process its last character. */ if (*d->nextchar == '\0') ++d->custom_optind; if (!temp || c == ':') { if (print_errors) fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); d->custom_optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; d->custom_optind++; } else d->custom_optarg = NULL; d->nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; /* * If we end this ARGV-element by taking the * rest as an arg, we must advance to the next * element now. */ d->custom_optind++; } else if (d->custom_optind == argc) { if (print_errors) { fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c); } d->custom_optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* * We already incremented `custom_optind' once; * increment it again when taking next ARGV-elt * as argument. */ d->custom_optarg = argv[d->custom_optind++]; d->nextchar = NULL; } } return c; } /* * Scan elements of ARGV for option characters given in OPTSTRING. * * If an element of ARGV starts with '-', and is not exactly "-" or "--", * then it is an option element. The characters of this element * (aside from the initial '-') are option characters. If `getopt' * is called repeatedly, it returns successively each of the option characters * from each of the option elements. * * If `getopt' finds another option character, it returns that character, * updating `custom_optind' and `nextchar' so that the next call to `getopt' can * resume the scan with the following option character or ARGV-element. * * If there are no more option characters, `getopt' returns -1. * Then `custom_optind' is the index in ARGV of the first ARGV-element * that is not an option. (The ARGV-elements have been permuted * so that those that are not options now come last.) * * OPTSTRING is a string containing the legitimate option characters. * If an option character is seen that is not listed in OPTSTRING, * return '?' after printing an error message. If you set `custom_opterr' to * zero, the error message is suppressed but we still return '?'. * * If a char in OPTSTRING is followed by a colon, that means it wants an arg, * so the following text in the same ARGV-element, or the text of the following * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that * wants an optional arg; if there is text in the current ARGV-element, * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero. * * If OPTSTRING starts with `-' or `+', it requests different methods of * handling the non-option ARGV-elements. * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. * * Long-named options begin with `--' instead of `-'. * Their names may be abbreviated as long as the abbreviation is unique * or is an exact match for some defined option. If they have an * argument, it follows the option name in the same ARGV-element, separated * from the option name by a `=', or else the in next ARGV-element. * When `getopt' finds a long-named option, it returns 0 if that option's * `flag' field is nonzero, the value of the option's `val' field * if the `flag' field is zero. * * The elements of ARGV aren't really const, because we permute them. * But we pretend they're const in the prototype to be compatible * with other systems. * * LONGOPTS is a vector of `struct option' terminated by an * element containing a name which is zero. * * LONGIND returns the index in LONGOPT of the long-named option found. * It is only valid when a long-named option has been found by the most * recent call. * * Return the option character from OPTS just read. Return -1 when there are * no more options. For unrecognized options, or options missing arguments, * `custom_optopt' is set to the option letter, and '?' is returned. * * The OPTS string is a list of characters which are recognized option letters, * optionally followed by colons, specifying that that letter takes an * argument, to be placed in `custom_optarg'. * * If a letter in OPTS is followed by two colons, its argument is optional. * This behavior is specific to the GNU `getopt'. * * The argument `--' causes premature termination of argument scanning, * explicitly telling `getopt' that there are no more options. If OPTS begins * with `--', then non-option arguments are treated as arguments to the option * '\0'. This behavior is specific to the GNU `getopt'. */ static int getopt_internal_r(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, struct custom_getopt_data *d) { int ret, print_errors = d->custom_opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->custom_optarg = NULL; /* * This is a big difference with GNU getopt, since optind == 0 * means initialization while here 1 means first call. */ if (d->custom_optind == 0 || !d->initialized) { if (d->custom_optind == 0) d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */ custom_getopt_initialize(d); } if (d->nextchar == NULL || *d->nextchar == '\0') { ret = shuffle_argv(argc, argv, longopts, d); if (ret) return ret; } if (longopts && (argv[d->custom_optind][1] == '-' )) return check_long_opt(argc, argv, optstring, longopts, longind, print_errors, d); return check_short_opt(argc, argv, optstring, print_errors, d); } static int custom_getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind) { int result; /* Keep a global copy of all internal members of d */ static struct custom_getopt_data d; d.custom_optind = custom_optind; d.custom_opterr = custom_opterr; result = getopt_internal_r(argc, argv, optstring, longopts, longind, &d); custom_optind = d.custom_optind; custom_optarg = d.custom_optarg; custom_optopt = d.custom_optopt; return result; } static int custom_getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return custom_getopt_internal(argc, argv, options, long_options, opt_index); } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_second_cmdline_cmd_parser_params.check_ambiguity * @param override @see test_second_cmdline_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_second_cmdline_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_second_cmdline_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_second_cmdline_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_second_cmdline_cmd_parser_internal ( int argc, char **argv, struct test_second_cmdline_cmd_struct *args_info, struct test_second_cmdline_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ struct generic_list * my_multi_list = NULL; int error_occurred = 0; struct test_second_cmdline_cmd_struct local_args_info; int override; int initialize; int check_required; int check_ambiguity; char *optarg; int optind; int opterr; int optopt; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_second_cmdline_cmd_parser_init (args_info); test_second_cmdline_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "option-a", 1, NULL, 'a' }, { "option-b", 1, NULL, 'b' }, { "my-multi", 1, NULL, 'M' }, { 0, 0, 0, 0 } }; custom_optarg = optarg; custom_optind = optind; custom_opterr = opterr; custom_optopt = optopt; c = custom_getopt_long (argc, argv, "hVa:b:M:", long_options, &option_index); optarg = custom_optarg; optind = custom_optind; opterr = custom_opterr; optopt = custom_optopt; if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_second_cmdline_cmd_parser_print_help (); test_second_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_second_cmdline_cmd_parser_print_version (); test_second_cmdline_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'a': /* option a of the second command line to parse. */ if (update_arg( (void *)&(args_info->option_a_arg), &(args_info->option_a_orig), &(args_info->option_a_given), &(local_args_info.option_a_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "option-a", 'a', additional_error)) goto failure; break; case 'b': /* option a of the second command line to parse. */ if (update_arg( (void *)&(args_info->option_b_arg), &(args_info->option_b_orig), &(args_info->option_b_given), &(local_args_info.option_b_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "option-b", 'b', additional_error)) goto failure; break; case 'M': /* multiple option of the second command line to parse. */ if (update_multiple_arg_temp(&my_multi_list, &(local_args_info.my_multi_given), optarg, 0, 0, ARG_STRING, "my-multi", 'M', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_SECOND_CMDLINE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ update_multiple_arg((void *)&(args_info->my_multi_arg), &(args_info->my_multi_orig), args_info->my_multi_given, local_args_info.my_multi_given, 0, ARG_STRING, my_multi_list); args_info->my_multi_given += local_args_info.my_multi_given; local_args_info.my_multi_given = 0; if (check_required) { error_occurred += test_second_cmdline_cmd_parser_required2 (args_info, argv[0], additional_error); } test_second_cmdline_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; } return 0; failure: free_list (my_multi_list, 1 ); test_second_cmdline_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } static unsigned int test_second_cmdline_cmd_parser_create_argv(const char *cmdline_, char ***argv_ptr, const char *prog_name) { char *cmdline, *p; size_t n = 0, j; int i; if (prog_name) { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (prog_name); ++n; } cmdline = gengetopt_strdup(cmdline_); p = cmdline; while (p && strlen(p)) { j = strcspn(p, " \t"); ++n; if (j && j < strlen(p)) { p[j] = '\0'; cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); p += (j+1); p += strspn(p, " \t"); } else { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); break; } } *argv_ptr = (char **) malloc((n + 1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = (n-1); i >= 0; --i) { (*argv_ptr)[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } (*argv_ptr)[n] = 0; free(cmdline); return n; } int test_second_cmdline_cmd_parser_string(const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name) { return test_second_cmdline_cmd_parser_string2(cmdline, args_info, prog_name, 0, 1, 1); } int test_second_cmdline_cmd_parser_string2(const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, int override, int initialize, int check_required) { struct test_second_cmdline_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return test_second_cmdline_cmd_parser_string_ext(cmdline, args_info, prog_name, ¶ms); } int test_second_cmdline_cmd_parser_string_ext(const char *cmdline, struct test_second_cmdline_cmd_struct *args_info, const char *prog_name, struct test_second_cmdline_cmd_parser_params *params) { char **argv_ptr = 0; int result; unsigned int argc; argc = test_second_cmdline_cmd_parser_create_argv(cmdline, &argv_ptr, prog_name); result = test_second_cmdline_cmd_parser_internal (argc, argv_ptr, args_info, params, 0); if (argv_ptr) { free (argv_ptr); } free_cmd_list(); if (result == EXIT_FAILURE) { test_second_cmdline_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } gengetopt-2.22.6/tests/test_multiple_parsers.sh.in0000664000175000017500000000036312044745036017265 00000000000000#! @SHELL@ # the next program must exit with error if $* ./test_multiple_parsers --first-cmd="-M400 -a10 --multi 100\,200\,300" --second-cmd="-a20 -b10 --my-multi=a\,b\,c\,d\,e\,f" -F"-M500 -M600" -S"--my-multi g"; then true; else false; fi gengetopt-2.22.6/tests/test_usage_cmd.ggo0000664000175000017500000000131312044745036015353 00000000000000# ~/work/gengetopt/gengetopt/build/src/gengetopt -i cmdline.ggo && make cmdline.o package "foo" version "1.0" purpose "Highlight the syntax of a source file (e.g. Java) into a specific format (e.g. HTML)" usage "1. source-highlight [OPTIONS]... < input_file > output_file 2. source-highlight [OPTIONS]... -i input_file -o output_file\n 3. source-highlight [OPTIONS]... [FILES]..." # Options option "input" i "input file. default std input" string typestr="filename" no option "output" o "output file. default std output (when the third invocation form is used). If STDOUT\n is specified, the output is directed to standard output" string typestr="filename" no gengetopt-2.22.6/tests/test_sections_option_help.c0000664000175000017500000000170512045003074017314 00000000000000/* test_sections_option_help.c test */ /* test option help fields in the presence of sections */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_sections_cmd.h" #define PRINT_OPTION(s) printf("%s: %s\n", # s, args_info.s) #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) #endif // FIX_UNUSED static struct gengetopt_args_info args_info; int main (int argc, char **argv) { FIX_UNUSED (argc); FIX_UNUSED (argv); test_sections_cmd_parser_init (&args_info); PRINT_OPTION (help_help); PRINT_OPTION (version_help); PRINT_OPTION (string_help); PRINT_OPTION (int_help); PRINT_OPTION (short_help); PRINT_OPTION (long_help); PRINT_OPTION (float_help); PRINT_OPTION (double_help); PRINT_OPTION (longdouble_help); PRINT_OPTION (longlong_help); PRINT_OPTION (flag_help); PRINT_OPTION (function_help); PRINT_OPTION (no_short_help); PRINT_OPTION (required_help); return 0; } gengetopt-2.22.6/tests/test_values.save.test0000664000175000017500000000142712044775636016102 00000000000000string-values="foob" # foobar string-values-def-argopt string-values-no-short="bar" # bar multistring-values="foo" # foo multistring-values="b" # bar multistring-values="bar" # bar multistring-values="foo" # foo multistring-values-def="bar" # bar multistring-values-def multistring-values-no-short="foo" # foo multistring-values-no-short="foo" # foo multistring-values-no-short="bar" # bar multistring-values-no-short="bar" # bar multistring-values-no-short="bar" # bar multistring-values-no-short="foo" # foo int-values="1" # 180 int-values-m="1" # 1800 int-values-m="27" # 2700 values-first-enums-plus="-foo" # -foo values-multiple-enums="FI" # FIRST values-multiple-enums="S" # SECOND values-multiple-enums="T" # THIRD values-multiple-enums="FOURTH" # FOURTH file-save="test_values.save" gengetopt-2.22.6/tests/test_text_cmd.h.test0000664000175000017500000001575712045003074015673 00000000000000/** @file test_text_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_TEXT_CMD_H #define TEST_TEXT_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_TEXT_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_TEXT_CMD_PARSER_PACKAGE PACKAGE #endif #ifndef TEST_TEXT_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define TEST_TEXT_CMD_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define TEST_TEXT_CMD_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef TEST_TEXT_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_TEXT_CMD_PARSER_VERSION VERSION #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * str_opt_arg; /**< @brief A string option, for a filename. */ char * str_opt_orig; /**< @brief A string option, for a filename original value given at command line. */ const char *str_opt_help; /**< @brief A string option, for a filename help description. */ int int_opt_arg; /**< @brief A int option. */ char * int_opt_orig; /**< @brief A int option original value given at command line. */ const char *int_opt_help; /**< @brief A int option help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int str_opt_given ; /**< @brief Whether str-opt was given. */ unsigned int int_opt_given ; /**< @brief Whether int-opt was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_text_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_text_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_text_cmd_parser_ext() instead */ int test_text_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_text_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_text_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_text_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_text_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void test_text_cmd_parser_print_help(void); /** * Print the version */ void test_text_cmd_parser_print_version(void); /** * Initializes all the fields a test_text_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_text_cmd_parser_params_init(struct test_text_cmd_parser_params *params); /** * Allocates dynamically a test_text_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_text_cmd_parser_params structure */ struct test_text_cmd_parser_params *test_text_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_text_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_text_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_text_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_TEXT_CMD_H */ gengetopt-2.22.6/tests/wrong_numeric_value.ggo0000664000175000017500000000015112044745036016436 00000000000000# wrong numeric value "hhh" option "noarg" n "multiple option with no arg" values="180","hhh" int gengetopt-2.22.6/tests/test_no_options_cmd.c.test0000664000175000017500000002336412045003074017062 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_no_options_cmd.ggo --func-name=test_no_options_cmd_parser --file-name=test_no_options_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_no_options_cmd.h" const char *gengetopt_args_info_purpose = "This is a program with no option but the default ones"; const char *gengetopt_args_info_usage = "Usage: test_no_options [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", 0 }; typedef enum {ARG_NO } test_no_options_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_no_options_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_no_options_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; } void test_no_options_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_NO_OPTIONS_CMD_PARSER_PACKAGE_NAME) ? TEST_NO_OPTIONS_CMD_PARSER_PACKAGE_NAME : TEST_NO_OPTIONS_CMD_PARSER_PACKAGE), TEST_NO_OPTIONS_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_no_options_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_no_options_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_no_options_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_no_options_cmd_parser_params_init(struct test_no_options_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_no_options_cmd_parser_params * test_no_options_cmd_parser_params_create(void) { struct test_no_options_cmd_parser_params *params = (struct test_no_options_cmd_parser_params *)malloc(sizeof(struct test_no_options_cmd_parser_params)); test_no_options_cmd_parser_params_init(params); return params; } static void test_no_options_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int test_no_options_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_NO_OPTIONS_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); i = EXIT_SUCCESS; return i; } int test_no_options_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_NO_OPTIONS_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_no_options_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_no_options_cmd_parser_free (struct gengetopt_args_info *args_info) { test_no_options_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int test_no_options_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_no_options_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_no_options_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_no_options_cmd_parser_params *params) { int result; result = test_no_options_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_no_options_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_no_options_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_no_options_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_no_options_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_no_options_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_no_options_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; int test_no_options_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_no_options_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_no_options_cmd_parser_init (args_info); test_no_options_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hV", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_no_options_cmd_parser_print_help (); test_no_options_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_no_options_cmd_parser_print_version (); test_no_options_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_NO_OPTIONS_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ test_no_options_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: test_no_options_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/test_simple_multiple_cmd.c.test0000664000175000017500000005515612045003074020103 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input=../../tests/test_simple_multiple_cmd.ggo --func-name=test_simple_multiple_cmd_parser --file-name=test_simple_multiple_cmd --unamed-opt --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "test_simple_multiple_cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: test_simple_multiple [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -s, --string=STRING string option (default=`foo')", 0 }; typedef enum {ARG_NO , ARG_STRING } test_simple_multiple_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int test_simple_multiple_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_simple_multiple_cmd_parser_params *params, const char *additional_error); static int test_simple_multiple_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->string_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->string_arg = NULL; args_info->string_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->string_help = gengetopt_args_info_help[2] ; args_info->string_min = 0; args_info->string_max = 0; } void test_simple_multiple_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE_NAME) ? TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE_NAME : TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE), TEST_SIMPLE_MULTIPLE_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { test_simple_multiple_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void test_simple_multiple_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void test_simple_multiple_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void test_simple_multiple_cmd_parser_params_init(struct test_simple_multiple_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct test_simple_multiple_cmd_parser_params * test_simple_multiple_cmd_parser_params_create(void) { struct test_simple_multiple_cmd_parser_params *params = (struct test_simple_multiple_cmd_parser_params *)malloc(sizeof(struct test_simple_multiple_cmd_parser_params)); test_simple_multiple_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } /** @brief generic value variable */ union generic_value { char *string_arg; const char *default_string_arg; }; /** @brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } static void test_simple_multiple_cmd_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_multiple_string_field (args_info->string_given, &(args_info->string_arg), &(args_info->string_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } int test_simple_multiple_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); write_multiple_into_file(outfile, args_info->string_given, "string", args_info->string_orig, 0); i = EXIT_SUCCESS; return i; } int test_simple_multiple_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = test_simple_multiple_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void test_simple_multiple_cmd_parser_free (struct gengetopt_args_info *args_info) { test_simple_multiple_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } int test_simple_multiple_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return test_simple_multiple_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int test_simple_multiple_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct test_simple_multiple_cmd_parser_params *params) { int result; result = test_simple_multiple_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { test_simple_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_simple_multiple_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct test_simple_multiple_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = test_simple_multiple_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { test_simple_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_simple_multiple_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (test_simple_multiple_cmd_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { test_simple_multiple_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int test_simple_multiple_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (check_multiple_option_occurrences(prog_name, args_info->string_given, args_info->string_min, args_info->string_max, "'--string' ('-s')")) error_occurred = 1; /* checks for dependences among options */ return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see test_simple_multiple_cmd_parser_params.check_ambiguity * @param override @see test_simple_multiple_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, test_simple_multiple_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } /** * @brief store information about a multiple option in a temporary list * @param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, test_simple_multiple_cmd_parser_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, test_simple_multiple_cmd_parser_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } int test_simple_multiple_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct test_simple_multiple_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ union generic_value multiple_default_value; struct generic_list * string_list = NULL; int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) test_simple_multiple_cmd_parser_init (args_info); test_simple_multiple_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "string", 1, NULL, 's' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ test_simple_multiple_cmd_parser_print_help (); test_simple_multiple_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ test_simple_multiple_cmd_parser_print_version (); test_simple_multiple_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* string option. */ if (update_multiple_arg_temp(&string_list, &(local_args_info.string_given), optarg, 0, "foo", ARG_STRING, "string", 's', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", TEST_SIMPLE_MULTIPLE_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ multiple_default_value.default_string_arg = "foo"; update_multiple_arg((void *)&(args_info->string_arg), &(args_info->string_orig), args_info->string_given, local_args_info.string_given, &multiple_default_value, ARG_STRING, string_list); args_info->string_given += local_args_info.string_given; local_args_info.string_given = 0; if (check_required) { error_occurred += test_simple_multiple_cmd_parser_required2 (args_info, argv[0], additional_error); } test_simple_multiple_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: free_list (string_list, 1 ); test_simple_multiple_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/wrong_dep.err0000664000175000017500000000013612044745036014367 00000000000000wrong_dep.ggo:6: option depends on undefined option wrong_dep.ggo:7: option depends on itself gengetopt-2.22.6/tests/wrong_default.err0000664000175000017500000000005312044745036015241 00000000000000wrong_default.ggo:3: invalid default value gengetopt-2.22.6/tests/test_conf_parser_file_save.c0000664000175000017500000000517512045003074017410 00000000000000/* test_conf_parser.c test */ /* test all kinds of options and the conf file parser. Moreover it tries to use a previously saved configuration file. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "test_conf_parser_cmd.h" static struct my_args_info args_info; char conf_file[256]; int main (int argc, char **argv) { unsigned int i; int result = 0; /* initialized but no check required */ if (test_conf_parser_cmd_parser2 (argc, argv, &args_info, 0, 1, 0) != 0) { result = 1; goto stop; } conf_file[0] = 0; strcpy(conf_file, args_info.conf_file_arg); /* override cmd options, but do not initialize args_info, check for required options */ if (test_conf_parser_cmd_parser_configfile (args_info.conf_file_arg, &args_info, 1, 0, 1) != 0) { result = 1; goto stop; } else { printf ("read configuration file: %s\n", conf_file); } printf ("value of required: %s\n", args_info.required_arg); printf ("value of string: %s\n", args_info.string_arg); printf ("value of no-short_given: %d\n", args_info.no_short_given); printf ("value of int: %d\n", args_info.int_arg); printf ("value of float: %f\n", args_info.float_arg); printf ("value of multi-string_given: %d\n", args_info.multi_string_given); for (i = 0; i < args_info.multi_string_given; ++i) printf (" value of multi-string: %s\n", args_info.multi_string_arg [i]); printf ("value of multi-string-def_given: %d\n", args_info.multi_string_def_given); for (i = 0; i < args_info.multi_string_def_given; ++i) printf (" value of multi-string-def: %s\n", args_info.multi_string_def_arg [i]); if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0]) printf ("default value of multi-string-def: %s\n", args_info.multi_string_def_arg [0]); printf ("value of opta: %s\n", args_info.opta_arg); printf ("noarg given %d times\n", args_info.noarg_given); printf ("noarg_noshort given %d times\n", args_info.noarg_noshort_given); printf ("opt-arg given: %d\n", args_info.opt_arg_given); printf ("opt-arg value: %s\n", (args_info.opt_arg_arg ? args_info.opt_arg_arg : "not given")); if (args_info.inputs_num) { printf ("options without names:\n"); for (i = 0; i < args_info.inputs_num; ++i) printf (" %s\n", args_info.inputs[i]); } if (args_info.file_save_given) { if (test_conf_parser_cmd_parser_file_save (args_info.file_save_arg, &args_info) == EXIT_FAILURE) result = 1; } stop: test_conf_parser_cmd_parser_free (&args_info); return result; } gengetopt-2.22.6/tests/wrong_help_redef.ggo0000664000175000017500000000024712044745036015703 00000000000000# test for error when trying redefining help option "depok" - "option depends on opt1" dependon="opt1" string no option "help" H "my help redefined" optional gengetopt-2.22.6/tests/canonize-names-cmd.c.test0000664000175000017500000003456512045003074016466 00000000000000/* File autogenerated by gengetopt generated with the following command: ../src/gengetopt --gen-version --input ../../tests/canonize-names-cmd.ggo --func-name canonize-names-cmd-parser --file-name ../tests/canonize-names-cmd The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "../tests/canonize-names-cmd.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: canonize_names [OPTIONS]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " -i, --foo-bar=INT foo-bar option", " -j, --foo.foo=INT foo.foo option", 0 }; typedef enum {ARG_NO , ARG_INT } canonize_names_cmd_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int canonize_names_cmd_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct canonize_names_cmd_parser_params *params, const char *additional_error); static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->foo_bar_given = 0 ; args_info->foo_foo_given = 0 ; args_info->my_group_group_counter = 0 ; args_info->my_group2_group_counter = 0 ; args_info->my_group3_group_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->foo_bar_orig = NULL; args_info->foo_foo_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->foo_bar_help = gengetopt_args_info_help[2] ; args_info->foo_foo_help = gengetopt_args_info_help[3] ; } void canonize_names_cmd_parser_print_version (void) { printf ("%s %s\n", (strlen(CANONIZE_NAMES_CMD_PARSER_PACKAGE_NAME) ? CANONIZE_NAMES_CMD_PARSER_PACKAGE_NAME : CANONIZE_NAMES_CMD_PARSER_PACKAGE), CANONIZE_NAMES_CMD_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { canonize_names_cmd_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void canonize_names_cmd_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void canonize_names_cmd_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); } void canonize_names_cmd_parser_params_init(struct canonize_names_cmd_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct canonize_names_cmd_parser_params * canonize_names_cmd_parser_params_create(void) { struct canonize_names_cmd_parser_params *params = (struct canonize_names_cmd_parser_params *)malloc(sizeof(struct canonize_names_cmd_parser_params)); canonize_names_cmd_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void canonize_names_cmd_parser_release (struct gengetopt_args_info *args_info) { free_string_field (&(args_info->foo_bar_orig)); free_string_field (&(args_info->foo_foo_orig)); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int canonize_names_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", CANONIZE_NAMES_CMD_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->foo_bar_given) write_into_file(outfile, "foo-bar", args_info->foo_bar_orig, 0); if (args_info->foo_foo_given) write_into_file(outfile, "foo.foo", args_info->foo_foo_orig, 0); i = EXIT_SUCCESS; return i; } int canonize_names_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", CANONIZE_NAMES_CMD_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = canonize_names_cmd_parser_dump(outfile, args_info); fclose (outfile); return i; } void canonize_names_cmd_parser_free (struct gengetopt_args_info *args_info) { canonize_names_cmd_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int canonize_names_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return canonize_names_cmd_parser2 (argc, argv, args_info, 0, 1, 1); } int canonize_names_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct canonize_names_cmd_parser_params *params) { int result; result = canonize_names_cmd_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { canonize_names_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int canonize_names_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct canonize_names_cmd_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = canonize_names_cmd_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { canonize_names_cmd_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int canonize_names_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see canonize_names_cmd_parser_params.check_ambiguity * @param override @see canonize_names_cmd_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, canonize_names_cmd_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int canonize_names_cmd_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct canonize_names_cmd_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) canonize_names_cmd_parser_init (args_info); canonize_names_cmd_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "foo-bar", 1, NULL, 'i' }, { "foo.foo", 1, NULL, 'j' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVi:j:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ canonize_names_cmd_parser_print_help (); canonize_names_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ canonize_names_cmd_parser_print_version (); canonize_names_cmd_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'i': /* foo-bar option. */ if (update_arg( (void *)&(args_info->foo_bar_arg), &(args_info->foo_bar_orig), &(args_info->foo_bar_given), &(local_args_info.foo_bar_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "foo-bar", 'i', additional_error)) goto failure; break; case 'j': /* foo.foo option. */ if (update_arg( (void *)&(args_info->foo_foo_arg), &(args_info->foo_foo_orig), &(args_info->foo_foo_given), &(local_args_info.foo_foo_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "foo.foo", 'j', additional_error)) goto failure; break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", CANONIZE_NAMES_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (args_info->my_group_group_counter > 1) { fprintf (stderr, "%s: %d options of group my-group were given. At most one is required%s.\n", argv[0], args_info->my_group_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } if (args_info->my_group2_group_counter > 1) { fprintf (stderr, "%s: %d options of group my.group2 were given. At most one is required%s.\n", argv[0], args_info->my_group2_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } if (args_info->my_group3_group_counter > 1) { fprintf (stderr, "%s: %d options of group my/group3 were given. At most one is required%s.\n", argv[0], args_info->my_group3_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } canonize_names_cmd_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); return 0; failure: canonize_names_cmd_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/tests/default_values_cmd.h.test0000664000175000017500000002217712045003074016645 00000000000000/** @file default_values_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef DEFAULT_VALUES_CMD_H #define DEFAULT_VALUES_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef DEFAULT_VALUES_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define DEFAULT_VALUES_CMD_PARSER_PACKAGE "default_values" #endif #ifndef DEFAULT_VALUES_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define DEFAULT_VALUES_CMD_PARSER_PACKAGE_NAME "default_values" #endif #ifndef DEFAULT_VALUES_CMD_PARSER_VERSION /** @brief the program version */ #define DEFAULT_VALUES_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ int foo_arg; /**< @brief foo option (default='15000'). */ char * foo_orig; /**< @brief foo option original value given at command line. */ const char *foo_help; /**< @brief foo option help description. */ char * bar_arg; /**< @brief bar option (default='this is a default'). */ char * bar_orig; /**< @brief bar option original value given at command line. */ const char *bar_help; /**< @brief bar option help description. */ int foo_opt_arg; /**< @brief foo option with optional arg (default='15000'). */ char * foo_opt_orig; /**< @brief foo option with optional arg original value given at command line. */ const char *foo_opt_help; /**< @brief foo option with optional arg help description. */ char * bar_opt_arg; /**< @brief bar option with optional arg (default='this is a default'). */ char * bar_opt_orig; /**< @brief bar option with optional arg original value given at command line. */ const char *bar_opt_help; /**< @brief bar option with optional arg help description. */ float foofloat_arg; /**< @brief foo float option (default='15000'). */ char * foofloat_orig; /**< @brief foo float option original value given at command line. */ const char *foofloat_help; /**< @brief foo float option help description. */ double foodouble_arg; /**< @brief foo double option (default='15000'). */ char * foodouble_orig; /**< @brief foo double option original value given at command line. */ const char *foodouble_help; /**< @brief foo double option help description. */ double pi_arg; /**< @brief PI option (default='3.1415926536'). */ char * pi_orig; /**< @brief PI option original value given at command line. */ const char *pi_help; /**< @brief PI option help description. */ int timeout_arg; /**< @brief number of seconds after the scanning is cancelled if no progress is shown at all. (default='120'). */ char * timeout_orig; /**< @brief number of seconds after the scanning is cancelled if no progress is shown at all. original value given at command line. */ const char *timeout_help; /**< @brief number of seconds after the scanning is cancelled if no progress is shown at all. help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int foo_given ; /**< @brief Whether foo was given. */ unsigned int bar_given ; /**< @brief Whether bar was given. */ unsigned int foo_opt_given ; /**< @brief Whether foo-opt was given. */ unsigned int bar_opt_given ; /**< @brief Whether bar-opt was given. */ unsigned int foofloat_given ; /**< @brief Whether foofloat was given. */ unsigned int foodouble_given ; /**< @brief Whether foodouble was given. */ unsigned int pi_given ; /**< @brief Whether pi was given. */ unsigned int timeout_given ; /**< @brief Whether timeout was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ } ; /** @brief The additional parameters to pass to parser functions */ struct default_values_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int default_values_cmd_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use default_values_cmd_parser_ext() instead */ int default_values_cmd_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int default_values_cmd_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct default_values_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int default_values_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int default_values_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void default_values_cmd_parser_print_help(void); /** * Print the version */ void default_values_cmd_parser_print_version(void); /** * Initializes all the fields a default_values_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void default_values_cmd_parser_params_init(struct default_values_cmd_parser_params *params); /** * Allocates dynamically a default_values_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized default_values_cmd_parser_params structure */ struct default_values_cmd_parser_params *default_values_cmd_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void default_values_cmd_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void default_values_cmd_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int default_values_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* DEFAULT_VALUES_CMD_H */ gengetopt-2.22.6/tests/test_conf_parser_ov.sh.in0000664000175000017500000000020112044745036016667 00000000000000#! @SHELL@ if $* ./test_conf_parser_ov -r "bar" --float 2.14 -i 100 -c ./test_conf.conf --opta "FOO"; then true; else false; fi gengetopt-2.22.6/tests/test_values_cmd.ggo0000664000175000017500000000476312044745036015562 00000000000000# test_values_cmd.ggo # test values options package "test_values" version "1.0" purpose "This is just a test file to test options with the list of acceptable values" defgroup "group1" option "string-values" s "string option with values" values="foo","foa","bar","foobar","barfoo" no option "string-values-plus" - "string option with values containing + and -" values="+foo","-foo","bar","foobar","barfoo","+foobar","-barfoo" no option "string-values-def" - "string option with values and default" values="foo","bar","foobar","barfoo" default="bar" no option "string-values-def-argopt" - "string option with values and default and optional argument" values="foo","bar","foobar","barfoo" default="foobar" optional argoptional option "string-values-no-short" - "string option with values no short" values="foo","bar","foobar","barfoo" no option "multistring-values" S "multiple string option with values" values="foo","bar" no multiple option "multistring-values-def" - "multiple string option with values and default" values="foo","bar" no multiple default="foo" argoptional option "multistring-values-no-short" - "multiple string option with values no-short" typestr="BAR" values="foo","bar" no multiple groupoption "string-values-group" - "group string option with values and default" typestr="FOO" values="foo","bar","foobar","barfoo" default="bar" group="group1" option "int-values" i "int option with values" values="90","180","270","360" int optional option "int-values-m" I "multiple int option with values" values="900","1800","2700","3600" int optional multiple option "int-values-def" - "int option with values and default" values="90","180","270","360" default="180" int optional option "values-first-enums" e "option with values and enums 1" values="FOO","BAR","ANOTHER","SOMETHING" enum optional option "values-first-enums-plus" E "option with values and enums with plus and minus 1" values="+foo","+bar","-foo","-bar","all" enum optional option "values-second-enums" - "option with values and enums 2 with default" values="90","180","270","360" enum optional default="180" option "values-multiple-enums" W "multiple option with values and enums" values="FIRST","SECOND","THIRD","FOURTH" enum optional multiple default="FOURTH" option "values-unspecified-enums" N "option with values that will not be specified on the command line" values="FOO","BAR","ANOTHER","SOMETHING" enum optional option "file-save" - "save the passed options into a file" string nogengetopt-2.22.6/src/0000775000175000017500000000000012046541043011370 500000000000000gengetopt-2.22.6/src/parser.h0000664000175000017500000001033112045003074012747 00000000000000/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_PACKAGE = 258, TOK_VERSION = 259, TOK_OPTION = 260, TOK_DEFGROUP = 261, TOK_GROUPOPTION = 262, TOK_DEFMODE = 263, TOK_MODEOPTION = 264, TOK_YES = 265, TOK_NO = 266, TOK_ON = 267, TOK_OFF = 268, TOK_FLAG = 269, TOK_PURPOSE = 270, TOK_DESCRIPTION = 271, TOK_USAGE = 272, TOK_DEFAULT = 273, TOK_GROUP = 274, TOK_GROUPDESC = 275, TOK_MODE = 276, TOK_MODEDESC = 277, TOK_MULTIPLE = 278, TOK_ARGOPTIONAL = 279, TOK_TYPESTR = 280, TOK_SECTION = 281, TOK_DETAILS = 282, TOK_SECTIONDESC = 283, TOK_TEXT = 284, TOK_VERSIONTEXT = 285, TOK_ARGS = 286, TOK_VALUES = 287, TOK_HIDDEN = 288, TOK_DEPENDON = 289, TOK_STRING = 290, TOK_CHAR = 291, TOK_ARGTYPE = 292, TOK_SIZE = 293 }; #endif /* Tokens. */ #define TOK_PACKAGE 258 #define TOK_VERSION 259 #define TOK_OPTION 260 #define TOK_DEFGROUP 261 #define TOK_GROUPOPTION 262 #define TOK_DEFMODE 263 #define TOK_MODEOPTION 264 #define TOK_YES 265 #define TOK_NO 266 #define TOK_ON 267 #define TOK_OFF 268 #define TOK_FLAG 269 #define TOK_PURPOSE 270 #define TOK_DESCRIPTION 271 #define TOK_USAGE 272 #define TOK_DEFAULT 273 #define TOK_GROUP 274 #define TOK_GROUPDESC 275 #define TOK_MODE 276 #define TOK_MODEDESC 277 #define TOK_MULTIPLE 278 #define TOK_ARGOPTIONAL 279 #define TOK_TYPESTR 280 #define TOK_SECTION 281 #define TOK_DETAILS 282 #define TOK_SECTIONDESC 283 #define TOK_TEXT 284 #define TOK_VERSIONTEXT 285 #define TOK_ARGS 286 #define TOK_VALUES 287 #define TOK_HIDDEN 288 #define TOK_DEPENDON 289 #define TOK_STRING 290 #define TOK_CHAR 291 #define TOK_ARGTYPE 292 #define TOK_SIZE 293 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 2068 of yacc.c */ #line 150 "./parser.yy" char *str; char chr; int argtype; int boolean; class AcceptedValues *ValueList; struct gengetopt_option *gengetopt_option; struct multiple_size *multiple_size; /* Line 2068 of yacc.c */ #line 138 "./parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif extern YYLTYPE yylloc; gengetopt-2.22.6/src/fileutils.h0000664000175000017500000000060012044745036013463 00000000000000// // C++ Interface: fileutils // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FILEUTILS_H #define FILEUTILS_H #include using std::ofstream; char *create_filename (char *name, char *ext); ofstream *open_fstream (const char *filename); #endif gengetopt-2.22.6/src/tests/0000775000175000017500000000000012046541044012533 500000000000000gengetopt-2.22.6/src/tests/Makefile.in0000664000175000017500000006521712046536525014543 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2010 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @NO_CROSSCOMPILING_TRUE@TESTS = $(am__EXEEXT_1) @NO_CROSSCOMPILING_TRUE@check_PROGRAMS = $(am__EXEEXT_1) subdir = src/tests DIST_COMMON = $(am__noinst_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @NO_CROSSCOMPILING_TRUE@am__EXEEXT_1 = test_specialchars$(EXEEXT) am__test_specialchars_SOURCES_DIST = test_specialchars.cc @NO_CROSSCOMPILING_TRUE@am_test_specialchars_OBJECTS = \ @NO_CROSSCOMPILING_TRUE@ test_specialchars.$(OBJEXT) test_specialchars_OBJECTS = $(am_test_specialchars_OBJECTS) test_specialchars_LDADD = $(LDADD) @NO_CROSSCOMPILING_TRUE@test_specialchars_DEPENDENCIES = \ @NO_CROSSCOMPILING_TRUE@ $(top_builddir)/src/libgengetopt.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(test_specialchars_SOURCES) DIST_SOURCES = $(am__test_specialchars_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__noinst_HEADERS_DIST = asserttestexit.h HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # these are for gnulib @NO_CROSSCOMPILING_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/gl -I$(top_builddir)/gl @NO_CROSSCOMPILING_TRUE@LDADD = $(top_builddir)/src/libgengetopt.la @NO_CROSSCOMPILING_TRUE@VALGRINDTESTS = test_specialchars @NO_CROSSCOMPILING_TRUE@test_specialchars_SOURCES = test_specialchars.cc @NO_CROSSCOMPILING_TRUE@noinst_HEADERS = asserttestexit.h all: all-am .SUFFIXES: .SUFFIXES: .cc .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list test_specialchars$(EXEEXT): $(test_specialchars_OBJECTS) $(test_specialchars_DEPENDENCIES) $(EXTRA_test_specialchars_DEPENDENCIES) @rm -f test_specialchars$(EXEEXT) $(CXXLINK) $(test_specialchars_OBJECTS) $(test_specialchars_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_specialchars.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/src/tests/test_specialchars.cc0000664000175000017500000000364412045003074016464 00000000000000#include #include #include #include "asserttestexit.h" using namespace std; static void show_results(int result, int num_of_newlines) { cout << "result: " << result << endl; cout << "num_of_newlines: " << num_of_newlines << endl; } int main() { string s = "this\n contains \t special chars"; int num_of_newlines; int result = not_newlines(s, num_of_newlines); show_results(result, num_of_newlines); assertEquals(0, result); assertEquals(0, num_of_newlines); result = not_newlines("\n\nnew lines in front", num_of_newlines); show_results(result, num_of_newlines); assertEquals(2, result); assertEquals(2, num_of_newlines); result = not_newlines("\n", num_of_newlines); show_results(result, num_of_newlines); assertEquals(1, result); assertEquals(1, num_of_newlines); result = not_newlines("\\n", num_of_newlines); show_results(result, num_of_newlines); assertEquals(0, result); assertEquals(0, num_of_newlines); string wrapped; wrap_cstr(wrapped, 0, 2, s); cout << "wrapped: " << wrapped << endl; s = "this\\n contains escaped special chars"; wrapped = ""; wrap_cstr(wrapped, 0, 2, s); cout << "wrapped: " << wrapped << endl; assertEquals(s, wrapped); s = "this\n contains escaped special chars"; wrapped = ""; wrap_cstr(wrapped, 0, 2, s); cout << "wrapped: " << wrapped << endl; assertEquals("this\\n contains escaped special chars", wrapped); s = "this\\n contains escaped special chars near the end of this long long long long long long long string \\nso let's see"; wrapped = ""; wrap_cstr(wrapped, 0, 2, s); cout << "wrapped: " << wrapped << endl; assertEquals( "this\\n contains escaped special chars near the end of this long long long long\\n long long long string \\nso let's see", wrapped); return 0; } gengetopt-2.22.6/src/tests/Makefile.am0000664000175000017500000000222212044745036014512 00000000000000# Copyright (C) 1999-2010 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if NO_CROSSCOMPILING # these are for gnulib AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/gl -I$(top_builddir)/gl LDADD = $(top_builddir)/src/libgengetopt.la VALGRINDTESTS = test_specialchars TESTS = $(VALGRINDTESTS) check_PROGRAMS = $(VALGRINDTESTS) test_specialchars_SOURCES = test_specialchars.cc noinst_HEADERS = asserttestexit.h endifgengetopt-2.22.6/src/tests/asserttestexit.h0000664000175000017500000000432212044745036015725 00000000000000/** * C++ functions: asserttestexit.h * * Description: assert functions used for tests * * Author: Lorenzo Bettini , (C) 2005-2008 * Copyright: See COPYING file that comes with this distribution */ #ifndef _ASSERTTESTEXIT_H_ #define _ASSERTTESTEXIT_H_ #include #include #include #include #include static std::exception std_exception; /** * returns the string representing a standard exception (which * can be different from system to system) */ const std::string stdExceptionToString() { return std_exception.what(); } const std::string stdCausedBy() { return "Caused by: " + stdExceptionToString(); } template void assertEquals(T expected, T actual) { if (expected != actual) { std::cerr << "assertEquals failed" << std::endl; std::cerr << "expected: " << expected << std::endl; std::cerr << "actual : " << actual << std::endl; exit(EXIT_FAILURE); } } template void assertEqualsException(const std::string &expected, T2 actual) { std::ostringstream o; o << actual; assertEquals(expected, o.str()); } void assertEquals(const std::string &expected, const std::string &actual) { if (expected != actual) { std::cerr << "assertEquals failed" << std::endl; std::cerr << "expected: " << expected << std::endl; std::cerr << "actual : " << actual << std::endl; exit(EXIT_FAILURE); } } void assertTrue(bool actual, const std::string &expl = "") { if (!actual) { std::cerr << "assertion failed! " << expl << std::endl; exit(EXIT_FAILURE); } } void assertFalse(bool actual, const std::string &expl = "") { if (actual) { std::cerr << "assertion failed! " << expl << std::endl; exit(EXIT_FAILURE); } } template void assertEqualsCollections(const T1 &expected, const T2 &actual) { assertEquals(expected.size(), actual.size()); typename T1::const_iterator it1 = expected.begin(); typename T2::const_iterator it2 = actual.begin(); for (; it1 != expected.end(); ++it1, ++it2) assertEquals(*it1, *it2); } #endif /*_ASSERTTESTEXIT_H_*/ gengetopt-2.22.6/src/argsdef.h0000664000175000017500000000273612044745036013112 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GENGETOPT_ARGSDEF_H #define GENGETOPT_ARGSDEF_H #define ARG_NO 0 #define ARG_FLAG 1 #define ARG_STRING 2 #define ARG_INT 3 #define ARG_SHORT 4 #define ARG_LONG 5 #define ARG_FLOAT 6 #define ARG_DOUBLE 7 #define ARG_LONGDOUBLE 8 #define ARG_LONGLONG 9 #define ARG_ENUM 10 /** corresponding strings for above defines */ extern const char * arg_type_constants []; /** symbolic names for argument types */ extern const char * arg_names []; /** corresponding C types */ extern const char * arg_types []; /** string representation of types */ extern const char * arg_types_names []; #define ARGS_STRUCT "args_info" #endif /* GENGETOPT_ARGSDEF_H */ gengetopt-2.22.6/src/groups.h0000664000175000017500000000251112044745036013005 00000000000000/** * Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GGO_GROUPS_H #define GGO_GROUPS_H #include #include using std::string; using std::map; /** * Represents a group of options */ struct Group { string desc; bool required; Group(const string &s, bool r) : desc (s), required (r) {} }; typedef map groups_collection_t; /** * Represents a mode of options */ struct Mode { string desc; Mode(const string &s) : desc (s) {} }; typedef map modes_collection_t; #endif // GROUPS_H gengetopt-2.22.6/src/Makefile.in0000664000175000017500000011741512046536525013377 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2009 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = gengetopt$(EXEEXT) subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libgengetopt_la_DEPENDENCIES = $(top_builddir)/gl/libgnu.la \ @LTLIBOBJS@ skels/libgen.la am_libgengetopt_la_OBJECTS = parser.lo scanner.lo globals.lo \ argsdef.lo cmdline.lo gm.lo yyerror.lo gm_utils.lo \ fileutils.lo acceptedvalues.lo ggos.lo libgengetopt_la_OBJECTS = $(am_libgengetopt_la_OBJECTS) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)" PROGRAMS = $(bin_PROGRAMS) am_gengetopt_OBJECTS = gengetopt.$(OBJEXT) gengetopt_OBJECTS = $(am_gengetopt_OBJECTS) gengetopt_LDADD = $(LDADD) gengetopt_DEPENDENCIES = $(top_builddir)/src/libgengetopt.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libgengetopt_la_SOURCES) $(gengetopt_SOURCES) DIST_SOURCES = $(libgengetopt_la_SOURCES) $(gengetopt_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(pkgdata_DATA) HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = skels tests #INCLUDES = -I@top_srcdir@/src/skels SUFFIXES = .text .c .ggo noinst_LTLIBRARIES = libgengetopt.la libgengetopt_la_SOURCES = parser.cc scanner.cc \ globals.cpp \ argsdef.c cmdline.ggo gm.cc \ yyerror.cc gm_utils.cpp fileutils.cpp acceptedvalues.cpp ggos.cpp gengetopt_SOURCES = gengetopt.cc #gengetopt_LDADD = @LIBOBJS@ @LEXLIB@ skels/libgen.a # these are for gnulib AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl libgengetopt_la_LIBADD = $(top_builddir)/gl/libgnu.la \ @LTLIBOBJS@ \ skels/libgen.la LDADD = $(top_builddir)/src/libgengetopt.la EXTRA_DIST = parser.h argsdef.h gengetopt.h ggos.h gm.h gnugetopt.h \ cmdline.c cmdline.h \ global_opts.h \ ggo_options.h \ groups.h \ parser.yy scanner.ll \ globals.h \ $(pkgdata_DATA) # version of gengetopt linked to the ElectricFence library # don't use it anymore: use valgrind #EXTRA_PROGRAMS = gengetopt-efence #gengetopt_efence_SOURCES = $(gengetopt_SOURCES) #gengetopt_efence_LDADD = -lefence $(gengetopt_LDADD) PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT) # to have flex generate a case insensitive scanner AM_LFLAGS = -i BUILT_SOURCES = cmdline.h cmdline.c parser.cc scanner.cc # automatically generate gengetopt_strdup() from the replacement function # strdup(). # gengetopt_strdup.text: strdup.c # echo "/* gengetopt_strdup(): automatically generated from strdup.c. */" > $@ # cat strdup.c | sed -e 's/^strdup (/gengetopt_&/' \ # -e 's/^char \* *$$/&/' \ # -e '/^#include.*$$/D' -e '/^$$/D' >> $@ # we distribute these files because who uses gengetopt might need them # these are installed in $(prefix)/share/gengetopt pkgdata_DATA = gnugetopt.h getopt.c getopt1.c # yywrap.c is added only if it is not found on lex (flex) lib, and will be # added automatically by automake # automake (maybe due to a bug) doesn't added these files well, # so we explicitely declare them MAINTAINERCLEANFILES = scanner.cc parser.h parser.cc noinst_HEADERS = acceptedvalues.h errorcodes.h fileutils.h \ gm_utils.h yyerror.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .text .c .ggo .cc .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgengetopt.la: $(libgengetopt_la_OBJECTS) $(libgengetopt_la_DEPENDENCIES) $(EXTRA_libgengetopt_la_DEPENDENCIES) $(CXXLINK) $(libgengetopt_la_OBJECTS) $(libgengetopt_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list gengetopt$(EXEEXT): $(gengetopt_OBJECTS) $(gengetopt_DEPENDENCIES) $(EXTRA_gengetopt_DEPENDENCIES) @rm -f gengetopt$(EXEEXT) $(CXXLINK) $(gengetopt_OBJECTS) $(gengetopt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acceptedvalues.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argsdef.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdline.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileutils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gengetopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ggos.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gm_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yyerror.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgdataDATA: $(pkgdata_DATA) @$(NORMAL_INSTALL) @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ done uninstall-pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgdataDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-pkgdataDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ ctags-recursive install install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkgdataDATA install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-pkgdataDATA .text.o: $(TXTC) $< scanner.cc: $(srcdir)/scanner.ll $(LEX) $(LFLAGS) -o $(srcdir)/scanner.cc $(srcdir)/scanner.ll parser.cc: $(srcdir)/parser.yy $(YACC) -o $(srcdir)/parser.cc $(srcdir)/parser.yy --defines=$(srcdir)/parser.h # it may happen, usually if the sources have been downloaded from CVS # repository, that cmdline.ggo is more recent than cmdline.c, but # cmdline.c cannot be re-generated, even because gengetopt has # to be built first. For instance if you only change spaces in cmdline.ggo # cmdline.c will not be different, and thus it is not updated in the CVS # repository; then when you make a checkout on another place, make # would try to build cmdline.c, but to do this it would need gengetopt # which is not built yet; so we simply touch cmdline.c (and this is safe) .ggo.c: if test -f $(PROGNAME); then \ $(PROGNAME) --input=$< --output-dir=$(srcdir) ; \ else touch $(srcdir)/$@ ; fi cmdline.h: cmdline.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/src/cmdline.ggo0000664000175000017500000001620412045003074013420 00000000000000# Copyright (C) 1999-2012 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Specification file format: # # This file consist in lines of sentences with the following format: # # package # version # purpose # option # option flag # option # ... # ... # # Where: # # = Double quoted string. # = Double quoted string. # = What the program does # Double quoted string (even on more than one line) # = Double quoted string with upper and lower case chars, digits, # '-' and '.'. No spaces allowed. # = A single upper or lower case char, or a digit. # = String with upper and lower case chars, digits, '-', '.' and # spaces. # = string, int, short, long, float, double, longdouble or longlong. # = required or optional. # = on or off. # Comments begins with '#' in any place of the line and ends in the # end of line. # The third form of option is used if the option does not take an argument; # it must not be required. # Name of our program #package "gengetopt" # we don't use it: we're using automake # Version of our program #version "1.0.1" # we don't use it: we're using automake purpose "This program generates a C function that uses getopt_long function to parse the command line options, validate them and fill a struct." # options that will be added to command line options of gengetopt args "--no-handle-version --no-handle-help --no-handle-error --string-parser" # Options section "Main options" text "" option "input" i "input file (default std input)" string typestr="filename" optional option "func-name" f "name of generated function" string typestr="name" default="cmdline_parser" optional option "arg-struct-name" a "name of generated args info struct" string typestr="name" default="gengetopt_args_info" optional option "file-name" F "name of generated file" string typestr="name" default="cmdline" optional option "output-dir" - "output directory" string typestr="path" optional details="\nif this option is not specified, the \ files are generated in the current directory.\n" option "header-output-dir" - "header output directory" string typestr="path" optional option "src-output-dir" - "source output directory" string typestr="path" optional option "c-extension" c "extension of c file" string typestr="ext" default="c" optional option "header-extension" H "extension of header file" string typestr="ext" default="h" optional option "long-help" l "long usage line in help" optional details="\nThe usage line will print all the options, e.g., sample1 -iINT|--int-opt=INT [-h|--help]\n" option "default-optional" - "by default, an option is considered optional if not specified otherwise" optional option "unamed-opts" u "accept options without names (e.g., file names)" string default="FILES" optional argoptional text "\nThe parser generated is thought to be used to parse the command line arguments. " text "However, you can also generate parsers for configuration files, or strings " text "that contain the arguments to parse, by using the following two options.\n" option "conf-parser" C "generate a config file parser" optional option "string-parser" S "generate a string parser (the string contains the command line)" optional section "Additional options" option "include-getopt" G "adds the code for getopt_long in the generated C file" optional option "no-handle-help" n "do not handle --help|-h automatically" optional details="\nIf --no-handle-help is specified, the command line option \ --help|-h will not be handled automatically, so the programmer will be able \ to print some \ other information; then the function for printing the standard help \ output can be used; this function is called \ _print_help.\n\nNotice \ that, although the programmer can handle --help|-h manually, the \ parser will return after finding such option: the other command \ line options, if any, will be ignored. In case you want to have full \ control on --help|-h, you should use --ho-help.\n" option "no-help" - "do not add --help|-h automatically" optional details="\nWith this option you can disable the \ automatic addition of options --help|-h. The programmer \ will then be able to add this option in \ the input file and handle it as he sees fit. Notice that \ --no-help will also disable the automatic options \ --detailed-help and --full-help. The programmer can still \ define options with short character h as he wants, \ but he cannot define options help, unless he \ specifies --no-help \ (otherwise an error will be printed).\n" option "no-handle-version" N "do not handle --version|-V automatically" optional option "no-version" - "do not add --version|-V automatically" optional details="\nSee above the details about \ --no-handle-help and --no-help, respectively.\n" option "no-handle-error" e "do not exit on errors" optional details="\nWith this option, if the generated parser encounters an error \ (e.g., an unknown option) it does not make the main program exit; instead, the parser \ function returns a value different 0, and the main program can print a help message.\n" option "show-required" - "in the output of help will specify which options are mandatory, \ by using the optional passed string" string default="(mandatory)" optional argoptional option "strict-hidden" - "completely hide hidden options" optional option "gen-version" g "put gengetopt version in the generated file" flag on option "set-package" - "set the package name (override package defined in the .ggo file)" string optional option "set-version" - "set the version number (override version defined in the .ggo file)" string optional option "show-help" - "show the output of --help instead of generating code" optional option "show-full-help" - "show the output of --full-help (i.e., including hidden options) instead of generating code" optional option "show-detailed-help" - "show the output of --detailed-help (i.e., including details and hidden options) instead of generating code" optional option "show-version" - "show the output of --version instead of generating code" optional text "\nPlease refer to the info manual for further explanations." gengetopt-2.22.6/src/gm.cc0000664000175000017500000017305512045003074012231 00000000000000/** * Copyright (C) 1999-2010 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include // for pair #include #include extern "C" { #include "argsdef.h" #include "global_opts.h" }; #include "ggo_options.h" #include "gm.h" #include "groups.h" #include "skels/option_arg.h" #include "skels/required_option.h" #include "skels/dependant_option.h" #include "skels/generic_option.h" #include "skels/group_option.h" #include "skels/group_counter.h" #include "skels/handle_help.h" #include "skels/handle_version.h" #include "skels/print_help_string.h" #include "skels/multiple_opt_list.h" #include "skels/multiple_fill_array.h" #include "skels/free_string.h" #include "skels/free_multiple.h" #include "skels/reset_group.h" #include "skels/exit_failure.h" #include "skels/update_given.h" #include "skels/given_field.h" #include "skels/clear_given.h" #include "skels/clear_arg.h" #include "skels/free_list.h" #include "skels/file_save.h" #include "skels/file_save_multiple.h" #include "skels/init_args_info.h" #include "skels/custom_getopt_gen.h" #include "skels/check_modes.h" #include "skels/enum_decl.h" #include "gm_utils.h" #include "fileutils.h" #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) #endif // FIX_UNUSED #define MAX_STARTING_COLUMN 32 #define EXE_NAME "argv[0]" #define PARSER_NAME_PREFIX (c_source_gen_class::parser_name + "_") #define OPTION_VALUES_NAME(n) (PARSER_NAME_PREFIX + n + "_values") using namespace std; extern char * gengetopt_package; extern char * gengetopt_version; extern char * gengetopt_purpose; extern char * gengetopt_versiontext; extern char * gengetopt_description; extern char * gengetopt_usage; extern groups_collection_t gengetopt_groups; extern modes_collection_t gengetopt_modes; // a map where for each mode we store the corresponding given field names // and the options typedef std::pair OptionValueElem; typedef std::list ModeOptions; typedef std::map ModeOptionMap; static ModeOptionMap modeOptionMap; static const ModeOptionMap &getModeOptionMap() { if (modeOptionMap.size() == 0) { // it's the first time, so we build it struct gengetopt_option * opt; foropt { if (opt->mode_value) { modeOptionMap[opt->mode_value].push_back (std::make_pair("args_info->" + string(opt->var_arg) + "_given", string("\"--") + opt->long_opt + "\"")); } } } return modeOptionMap; } // a map associating to a mode the list of gengetopt_options typedef std::map ModeOptMap; static ModeOptMap modeOptMap; static const ModeOptMap &getModeOptMap() { if (modeOptMap.size() == 0) { // it's the first time, so we build it struct gengetopt_option * opt; foropt { if (opt->mode_value) { modeOptMap[opt->mode_value].push_back(opt); } } } return modeOptMap; } static void _generate_option_arg(ostream &stream, unsigned int indentation, struct gengetopt_option * opt); static void generate_help_desc_print(ostream &stream, unsigned int desc_column, const char *descript, const char *defval, const string &values, const string &show_required_string); CmdlineParserCreator::CmdlineParserCreator (char *function_name, char *struct_name, char *unamed_options_, char *filename_, char *header_ext, char *c_ext, bool long_help_, bool no_handle_help_, bool no_help_, bool no_handle_version_, bool no_version_, bool no_handle_error_, bool strict_hidden_, bool conf_parser_, bool string_parser_, bool gen_version, bool gen_getopt, bool no_options_, const string &comment_, const string &outdir, const string &header_outdir, const string &src_outdir, const string &show_required) : filename (filename_), args_info_name (struct_name), output_dir (outdir), header_output_dir (header_outdir), src_output_dir (src_outdir), comment (comment_), unamed_options (unamed_options_), show_required_string (show_required), long_help (long_help_), no_handle_help (no_handle_help_), no_help (no_help_), no_handle_version (no_handle_version_), no_version (no_version_), no_handle_error (no_handle_error_), strict_hidden (strict_hidden_), conf_parser (conf_parser_), string_parser (string_parser_), gen_gengetopt_version (gen_version), tab_indentation (0) { parser_function_name = canonize_names (function_name); c_filename = create_filename (filename, c_ext); header_filename = create_filename (filename, header_ext); // header_gen_class const string stripped_header_file_name = strip_path (filename); set_header_file_name (stripped_header_file_name); header_gen_class::set_header_file_ext (header_ext); c_source_gen_class::set_header_file_ext (header_ext); if (gen_gengetopt_version) { header_gen_class::set_generator_version("version " VERSION); } const string my_ifndefname = to_upper (strip_path (stripped_header_file_name)); set_ifndefname (canonize_names (my_ifndefname.c_str ())); header_gen_class::set_parser_name (parser_function_name); const string my_package_var_name = to_upper (parser_function_name) + "_PACKAGE"; const string my_version_var_name = to_upper (parser_function_name) + "_VERSION"; header_gen_class::set_package_var_name (my_package_var_name); c_source_gen_class::set_package_var_name (my_package_var_name); header_gen_class::set_version_var_name (my_version_var_name); c_source_gen_class::set_version_var_name (my_version_var_name); header_gen_class::set_args_info (args_info_name); c_source_gen_class::set_args_info (args_info_name); const string uppersand = "\""; // if no_options then we don't need to generate update_arg, // but if we need to handle help or version we still need to generate it set_no_options (no_options_ && !no_handle_help && !no_handle_version); if (gengetopt_package) set_package_var_val (uppersand + gengetopt_package + uppersand); else set_package_var_val ("PACKAGE"); if (gengetopt_version) set_version_var_val (uppersand + gengetopt_version + uppersand); else set_version_var_val ("VERSION"); header_gen_class::set_generate_config_parser (conf_parser); header_gen_class::set_generate_string_parser (string_parser); c_source_gen_class::set_generate_string_parser (string_parser); // c_source_gen_class set_command_line (comment); if (gen_gengetopt_version) c_source_gen_class::set_generator_version ("version " VERSION); c_source_gen_class::set_parser_name (parser_function_name); set_source_name (filename); ostringstream exit_failure_str; exit_failure_gen_class exit_gen; exit_gen.set_parser_name (c_source_gen_class::parser_name); exit_gen.set_handle_error (! no_handle_error); exit_gen.generate_exit_failure (exit_failure_str); set_final_exit (exit_failure_str.str ()); set_conf_parser (conf_parser); set_cmd_list (conf_parser || string_parser); set_include_getopt (gen_getopt); struct gengetopt_option * opt; gen_strdup = (unamed_options != 0 || conf_parser || string_parser); if (! gen_strdup) { foropt if (opt->type != ARG_FLAG || opt->type != ARG_NO) { gen_strdup = true; break; } } set_do_generate_strdup(gen_strdup); set_check_possible_values(has_values()); set_multiple_token_functions(has_multiple_options_with_type()); set_multiple_options_with_default(has_multiple_options_with_default()); set_multiple_options(has_multiple_options()); set_multiple_options_string(has_multiple_options_string()); set_multiple_options_all_string(has_multiple_options_all_string()); set_has_typed_options(has_options_with_type()); set_has_modes(has_options_with_mode()); set_handle_unamed(unamed_options); set_check_required_options(has_required() || has_dependencies() || has_multiple_options()); set_purpose(generate_purpose()); set_description(generate_description()); set_versiontext(generate_versiontext()); set_no_package((gengetopt_package == 0)); c_source_gen_class::set_has_hidden(!strict_hidden && has_hidden_options()); header_gen_class::set_has_hidden(c_source_gen_class::has_hidden); c_source_gen_class::set_has_details(has_options_with_details(strict_hidden)); header_gen_class::set_has_details(c_source_gen_class::has_details); set_has_arg_types(); } void CmdlineParserCreator::set_has_arg_types() { struct gengetopt_option * opt; set_has_arg_flag(false); set_has_arg_string(false); set_has_arg_int(false); set_has_arg_short(false); set_has_arg_long(false); set_has_arg_float(false); set_has_arg_double(false); set_has_arg_longdouble(false); set_has_arg_longlong(false); foropt { switch (opt->type) { case ARG_NO: break; case ARG_FLAG: set_has_arg_flag(true); break; case ARG_STRING: set_has_arg_string(true); break; case ARG_INT: set_has_arg_int(true); break; case ARG_SHORT: set_has_arg_short(true); break; case ARG_LONG: set_has_arg_long(true); break; case ARG_FLOAT: set_has_arg_float(true); break; case ARG_DOUBLE: set_has_arg_double(true); break; case ARG_LONGDOUBLE: set_has_arg_longdouble(true); break; case ARG_LONGLONG: set_has_arg_longlong(true); break; case ARG_ENUM: set_has_arg_enum(true); break; default: fprintf (stderr, "gengetopt: bug found in %s:%d!!\n", __FILE__, __LINE__); abort (); } } } void CmdlineParserCreator::generateBreak(ostream &stream, unsigned int indentation) { string indent_str (indentation, ' '); stream << endl; stream << indent_str; stream << "break;"; } int CmdlineParserCreator::generate () { int head_result; head_result = generate_header_file (); if (head_result) return head_result; return generate_source (); } int CmdlineParserCreator::generate_header_file () { if (! gengetopt_options.size()) { fprintf (stderr, "gengetopt: none option given\n"); return 1; } /* ****************************************************** */ /* HEADER FILE******************************************* */ /* ****************************************************** */ string header_file = header_filename; if (header_output_dir.size()) header_file = header_output_dir + "/" + header_file; else if (output_dir.size()) header_file = output_dir + "/" + header_file; ofstream *output_file = open_fstream (header_file.c_str()); generate_header (*output_file); output_file->close (); delete output_file; return 0; } /** * generate the enum value from a given option * @param name the (canonized) name of the option * @param val the value of the option * @return the enum value string */ static const string from_value_to_enum(const string &name, const string &val) { return name + "_arg_" + canonize_enum(val); } void CmdlineParserCreator::generate_enum_types(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; FIX_UNUSED (indentation); if (has_arg_enum) stream << endl; foropt { // if type is enum then it should also have values (checked during parsing) // but it's better to check it if (opt->type == ARG_ENUM) { if (! (opt->acceptedvalues)) { fprintf (stderr, "gengetopt: bug found in %s:%d!!\n", __FILE__, __LINE__); abort (); } ostringstream enum_values; enum_decl_gen_class enum_gen; enum_gen.set_var_arg(opt->var_arg); for (AcceptedValues::const_iterator iter = opt->acceptedvalues->begin(); iter != opt->acceptedvalues->end(); ++iter) { enum_values << ", "; // the first enum element is set to 0 enum_values << from_value_to_enum(opt->var_arg, *iter); if (iter == opt->acceptedvalues->begin()) enum_values << " = 0"; } enum_gen.set_enum_values(enum_values.str()); enum_gen.generate_enum_decl(stream); } } } void CmdlineParserCreator::generate_option_arg(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; foropt { _generate_option_arg (stream, indentation, opt); } } void _generate_option_arg(ostream &stream, unsigned int indentation, struct gengetopt_option *opt) { option_arg_gen_class option_arg_gen; string type = ""; if (opt->type) type = arg_types[opt->type]; string origtype = "char *"; if (opt->multiple) { type += "*"; origtype += "*"; option_arg_gen.set_multiple(true); } else { option_arg_gen.set_multiple(false); } option_arg_gen.set_type(type); option_arg_gen.set_origtype(origtype); option_arg_gen.set_flag_arg((opt->type == ARG_FLAG)); option_arg_gen.set_desc(opt->desc); option_arg_gen.set_name(opt->var_arg); option_arg_gen.set_has_arg(opt->type != ARG_NO); option_arg_gen.set_has_enum(opt->type == ARG_ENUM); if (opt->default_given) { option_arg_gen.set_has_default(true); option_arg_gen.set_default_value(opt->default_string); } if (opt->type == ARG_FLAG) { option_arg_gen.set_default_on(opt->flagstat); } if (opt->type == ARG_LONGLONG) { // the fallback type in case longlong is not supported by the compiler string longtype = arg_types[ARG_LONG]; if (opt->multiple) longtype += "*"; option_arg_gen.set_long_long_arg(true); option_arg_gen.set_longtype(longtype); } option_arg_gen.generate_option_arg(stream, indentation); } void CmdlineParserCreator::generate_option_given(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; string indent_str (indentation, ' '); bool first = true; given_field_gen_class given_gen; foropt { switch (opt->type) { case ARG_NO: case ARG_FLAG: case ARG_STRING: case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: case ARG_ENUM: break; default: fprintf (stderr, "gengetopt: bug found in %s:%d!!\n", __FILE__, __LINE__); abort (); } if (! first) stream << indent_str; else first = false; given_gen.set_arg_name (opt->var_arg); given_gen.set_long_opt (opt->long_opt); given_gen.set_group (opt->multiple && opt->group_value); given_gen.generate_given_field (stream); } if (unamed_options) { stream << endl; stream << indent_str; stream << "char **inputs ; /**< @brief unamed options (options without names) */\n" ; stream << indent_str; stream << "unsigned inputs_num ; /**< @brief unamed options number */" ; } } void CmdlineParserCreator::generate_option_values_decl(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; bool first = true; FIX_UNUSED (indentation); foropt { if (opt->acceptedvalues) { if (first) { first = false; } stream << "extern const char *" << OPTION_VALUES_NAME(opt->var_arg) << "[]; /**< @brief Possible values for " << opt->long_opt << ". */\n"; } } if (! first) stream << "\n"; } void CmdlineParserCreator::generate_option_values(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; bool first = true; FIX_UNUSED (indentation); foropt { if (opt->acceptedvalues) { if (first) { first = false; } stream << "const char *" << OPTION_VALUES_NAME(opt->var_arg) << "[] = {" << opt->acceptedvalues->toString(false) << ", 0}; /*< Possible values for " << opt->long_opt << ". */\n"; } } if (! first) stream << "\n"; } static void generate_option_usage_string(gengetopt_option * opt, ostream &usage) { const char *type_str; usage << " "; if (!opt->required) usage << "["; switch (opt->type) { case ARG_NO: case ARG_FLAG: if (opt->short_opt) usage << "-" << opt->short_opt << "|"; usage << "--" << opt->long_opt; break; case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: case ARG_STRING: case ARG_ENUM: if (opt->type_str) type_str = opt->type_str; else type_str = arg_names[opt->type]; if (opt->short_opt) usage << "-" << opt->short_opt << type_str << "|"; usage << "--" << opt->long_opt << "=" << type_str; break; default: fprintf (stderr, "gengetopt: bug found in %s:%d!!\n", __FILE__, __LINE__); abort (); } if (!opt->required) usage << "]"; } const string CmdlineParserCreator::generate_usage_string(bool use_config_package) { FIX_UNUSED (use_config_package); // if specified by the programmer, the usage string has the precedence if (gengetopt_usage) { string wrapped_usage; wrap_cstr(wrapped_usage, 0, 0, gengetopt_usage); return wrapped_usage; } struct gengetopt_option * opt; ostringstream usage; // otherwise the config.h package constant will be used if (gengetopt_package) usage << gengetopt_package; if ( long_help ) { // we first generate usage strings of required options // handle mode options separately foropt if (opt->required && !opt->hidden && !opt->mode_value) { generate_option_usage_string(opt, usage); } foropt if (!opt->required && !opt->hidden && !opt->mode_value) { generate_option_usage_string(opt, usage); } } else { /* if not long help we generate it as GNU standards */ usage << " [OPTIONS]..."; } string wrapped; if ( unamed_options ) usage << " [" << unamed_options << "]..."; wrap_cstr ( wrapped, strlen("Usage: "), 2, usage.str() ); // now deal with modes if (has_modes && long_help) { const ModeOptMap &modeoptmap = getModeOptMap(); for (ModeOptMap::const_iterator map_it = modeoptmap.begin(); map_it != modeoptmap.end(); ++map_it) { string mode_line; // a mode alternative in the usage string gengetopt_option_list::const_iterator opt_it; usage.str(""); // reset the usage string buffer // otherwise the config.h package constant will be used if (gengetopt_package) usage << gengetopt_package; for (opt_it = map_it->second.begin(); opt_it != map_it->second.end(); ++opt_it) { if (((*opt_it)->required) && !((*opt_it)->hidden)) { generate_option_usage_string(*opt_it, usage); } } for (opt_it = map_it->second.begin(); opt_it != map_it->second.end(); ++opt_it) { if (!((*opt_it)->required) && !((*opt_it)->hidden)) { generate_option_usage_string(*opt_it, usage); } } wrap_cstr ( mode_line, strlen(" or : "), 2, usage.str() ); wrapped += "\\n or : "; wrapped += mode_line; } } return wrapped; } static void generate_help_desc_print(ostream &stream, unsigned int desc_column, const char *descript, const char *defval, const string &values, const string &show_required_string) { string desc; string desc_with_default = descript; if (defval || values.size()) { desc_with_default += " ("; if (values.size()) { desc_with_default += "possible values="; desc_with_default += values; if (defval) desc_with_default += " "; } if (defval) { desc_with_default += "default="; desc_with_default += defval; } desc_with_default += ")"; } if (show_required_string != "") desc_with_default += " " + show_required_string; wrap_cstr ( desc, desc_column, 2, desc_with_default ); stream << desc; } void CmdlineParserCreator::generate_help_option_print_from_lists(ostream &stream, unsigned int indentation, OptionHelpList *full_option_list, OptionHelpList *option_list, const std::string &target_array, const std::string &source_array) { print_help_string_gen_class print_gen; // the index into the help arrays int i = 0, full_i = 0; // num of help strings int help_num = 0; print_gen.set_target(target_array); print_gen.set_from(source_array); print_gen.set_shared(true); print_gen.set_last(false); OptionHelpList::const_iterator it = option_list->begin(); OptionHelpList::const_iterator it2 = full_option_list->begin(); // the second list is surely longer so we scan that one for (; it != option_list->end() && it2 != full_option_list->end(); ++it2) { if (*it == *it2) { // when the two strings are the same it means that's a non-hidden // option, so we share it with the full help array ostringstream converted_int; converted_int << i; // the index into the help array print_gen.set_index(converted_int.str()); converted_int.str(""); converted_int << full_i; // the index into the full help array print_gen.set_full_index(converted_int.str()); print_gen.generate_print_help_string(stream, indentation); ++help_num; ++i; ++it; } ++full_i; } ostringstream converted_int; converted_int << help_num; // the final 0 print_gen.set_last(true); print_gen.set_index(converted_int.str()); print_gen.generate_print_help_string(stream, indentation); // we increment it to store the final 0 converted_int.str(""); converted_int << ++help_num; set_help_string_num(converted_int.str()); } void CmdlineParserCreator::generate_help_option_print(ostream &stream, unsigned int indentation) { OptionHelpList *option_list = generate_help_option_list(); if (!c_source_gen_class::has_hidden && !c_source_gen_class::has_details) { print_help_string_gen_class print_gen; print_gen.set_shared(false); // simple help generation for (OptionHelpList::const_iterator it = option_list->begin(); it != option_list->end(); ++it) { print_gen.set_helpstring(*it); print_gen.generate_print_help_string(stream, indentation); } } else { // in order to avoid generating the same help string twice, and thus // to save memory, in case of hidden options (or details), we try to share most // of the strings with the full help array OptionHelpList *full_option_list = generate_help_option_list(true, true); generate_help_option_print_from_lists (stream, indentation, full_option_list, option_list, c_source_gen_class::args_info + "_help", (c_source_gen_class::has_details ? c_source_gen_class::args_info + "_detailed_help" : c_source_gen_class::args_info + "_full_help")); delete full_option_list; } delete option_list; } void CmdlineParserCreator::generate_full_help_option_print(ostream &stream, unsigned int indentation) { // generate also hidden options OptionHelpList *option_list = generate_help_option_list(true); if (!c_source_gen_class::has_details) { print_help_string_gen_class print_gen; print_gen.set_shared(false); for (OptionHelpList::const_iterator it = option_list->begin(); it != option_list->end(); ++it) { print_gen.set_helpstring(*it); print_gen.generate_print_help_string(stream, indentation); } } else { // in order to avoid generating the same help string twice, and thus // to save memory, in case of options with details, we try to share most // of the strings with the full help array OptionHelpList *full_option_list = generate_help_option_list(true, true); generate_help_option_print_from_lists (stream, indentation, full_option_list, option_list, c_source_gen_class::args_info + "_full_help", c_source_gen_class::args_info + "_detailed_help"); delete full_option_list; } delete option_list; } void CmdlineParserCreator::generate_detailed_help_option_print(ostream &stream, unsigned int indentation) { // generate also hidden options and details OptionHelpList *option_list = generate_help_option_list(true, true); print_help_string_gen_class print_gen; print_gen.set_shared(false); for (OptionHelpList::const_iterator it = option_list->begin(); it != option_list->end(); ++it) { print_gen.set_helpstring(*it); print_gen.generate_print_help_string(stream, indentation); } delete option_list; } void CmdlineParserCreator::generate_init_args_info(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; init_args_info_gen_class init_args_info_gen; int i = 0; ostringstream index; string help_string = c_source_gen_class::args_info; if (c_source_gen_class::has_details) { help_string += "_detailed_help"; } else if (c_source_gen_class::has_hidden) { help_string += "_full_help"; } else { help_string += "_help"; } init_args_info_gen.set_help_strings(help_string); const char *current_section = 0, *current_group = 0, *current_mode = 0; // we have to skip section description references (that appear in the help vector) foropt { index.str(""); if (opt->section) { if (!current_section || (strcmp(current_section, opt->section) != 0)) { // a different section reference, skip it current_section = opt->section; ++i; if (opt->section_desc) { // section description takes another line, thus we have to skip this too ++i; } } } // skip group desc if (opt->group_value) { if (!current_group || strcmp(current_group, opt->group_value) != 0) { current_group = opt->group_value; ++i; } } // skip mode desc if (opt->mode_value) { if (!current_mode || strcmp(current_mode, opt->mode_value) != 0) { current_mode = opt->mode_value; ++i; } } // also skip the text before if (opt->text_before) ++i; index << i++; init_args_info_gen.set_var_arg(opt->var_arg); init_args_info_gen.set_num(index.str()); if (opt->multiple) { init_args_info_gen.set_multiple(true); init_args_info_gen.set_min(opt->multiple_min); init_args_info_gen.set_max(opt->multiple_max); } else { init_args_info_gen.set_multiple(false); } init_args_info_gen.generate_init_args_info(stream, indentation); // skip the details if (opt->details) ++i; // skip the text after if (opt->text_after) ++i; } } void CmdlineParserCreator::generate_custom_getopt(ostream &stream, unsigned int indentation) { custom_getopt_gen_gen_class customgetopt; customgetopt.generate_custom_getopt_gen (stream, indentation); } const string CmdlineParserCreator::generate_purpose() { string wrapped_purpose; if (gengetopt_purpose != NULL) { wrap_cstr(wrapped_purpose, 0, 0, gengetopt_purpose); } return wrapped_purpose; } const string CmdlineParserCreator::generate_versiontext() { string wrapped_versiontext; if (gengetopt_versiontext != NULL) { wrap_cstr(wrapped_versiontext, 0, 0, gengetopt_versiontext); } return wrapped_versiontext; } const string CmdlineParserCreator::generate_description() { string wrapped_description; if (gengetopt_description != NULL) { wrap_cstr(wrapped_description, 0, 0, gengetopt_description); } return wrapped_description; } OptionHelpList * CmdlineParserCreator::generate_help_option_list(bool generate_hidden, bool generate_details) { OptionHelpList *option_list = new OptionHelpList; unsigned long desc_col; struct gengetopt_option * opt; int type_len; const char *type_str; ostringstream stream; // if we want to generate details then we will also generate hidden options if (strict_hidden) generate_hidden = false; else if (generate_details) generate_hidden = true; /* calculate columns */ desc_col = 0; foropt { // if (opt->hidden && !generate_hidden) // continue; // when computing columns, we also consider hidden_options, so that // the --help and --full-help will be aligned just the same // IMPORTANT: this is also crucial due to how the help string array // is built starting from the full-help string array: // we iterate over the two lists of options and check whether the // corresponding strings are the same; thus, the help strings must // have the same space alignments, otherwise they're not equal unsigned int width = 2 + 4 + 2; // ws + "-a, " + ws width += strlen (opt->long_opt) + 2; // "--" if ((opt->type != ARG_FLAG) && (opt->type != ARG_NO)) { if (opt->type_str) type_str = opt->type_str; else type_str = arg_names[opt->type]; type_len = strlen(type_str); width += type_len + 1; // "=" if (opt->arg_is_optional) width += 2; // "[" and "]" } if (width > desc_col) desc_col = width; } if (desc_col > MAX_STARTING_COLUMN) desc_col = MAX_STARTING_COLUMN; /* print justified options */ char *prev_group = 0; char *prev_mode = 0; char *curr_section = 0; bool first_option = true; foropt { // if the option is hidden and has no text, avoid printing a section // containing only hidden options if (opt->section && (!curr_section || strcmp (curr_section, opt->section)) && (!opt->hidden || generate_hidden || opt->text_before || opt->text_after)) { curr_section = opt->section; ostringstream sec_string; if (! first_option) sec_string << "\\n"; sec_string << opt->section << ":" ; string wrapped_def; wrap_cstr(wrapped_def, 0, 0, sec_string.str()); option_list->push_back(wrapped_def); if (opt->section_desc) { string wrapped_desc ( 2, ' '); wrap_cstr ( wrapped_desc, 2, 0, opt->section_desc ); option_list->push_back(wrapped_desc); } } if (opt->group_value && (! prev_group || strcmp (opt->group_value, prev_group) != 0)) { string group_string = "\\n Group: "; string wrapped_desc; if (opt->group_desc && strlen (opt->group_desc)) { wrapped_desc = "\\n "; wrap_cstr (wrapped_desc, 2, 0, opt->group_desc); } group_string += opt->group_value + wrapped_desc; option_list->push_back (group_string); prev_group = opt->group_value; } if (opt->mode_value && (! prev_mode || strcmp (opt->mode_value, prev_mode) != 0)) { string mode_string = "\\n Mode: "; string wrapped_desc; if (opt->mode_desc && strlen (opt->mode_desc)) { wrapped_desc = "\\n "; wrap_cstr (wrapped_desc, 2, 0, opt->mode_desc); } mode_string += opt->mode_value + wrapped_desc; option_list->push_back (mode_string); prev_mode = opt->mode_value; } // a possible description to be printed before this option if (opt->text_before) { string wrapped_desc; wrap_cstr ( wrapped_desc, 0, 0, opt->text_before); option_list->push_back(wrapped_desc); } if (!opt->hidden || generate_hidden) { first_option = false; const char * def_val = NULL; string def_str = "`"; ostringstream option_stream; if (opt->type == ARG_FLAG || opt->type == ARG_NO) { def_val = NULL; if (opt->short_opt) option_stream << " -" << opt->short_opt << ", "; else option_stream << " "; option_stream << "--" << opt->long_opt; if (opt->type == ARG_FLAG) def_val = opt->flagstat ? "on" : "off"; } else { def_val = NULL; if (opt->type_str) type_str = opt->type_str; else type_str = arg_names[opt->type]; type_len = strlen(type_str); if (opt->short_opt) { option_stream << " -" << opt->short_opt << ", "; } else { option_stream << " "; } bool arg_optional = opt->arg_is_optional; option_stream << "--" << opt->long_opt << (arg_optional ? "[" : "") << "=" << type_str << (arg_optional ? "]" : ""); if (opt->default_string) { def_str += opt->default_string; def_str += "'"; def_val = def_str.c_str(); } } const string &option_string = option_stream.str(); stream << option_string; const char *opt_desc = opt->desc; if ((option_string.size() >= MAX_STARTING_COLUMN) || (desc_col <= option_string.size())) { string indentation (MAX_STARTING_COLUMN, ' '); stream << "\\n" << indentation; } else { string indentation (desc_col - option_string.size(), ' '); stream << indentation; } generate_help_desc_print(stream, desc_col, opt_desc, def_val, (opt->acceptedvalues ? opt->acceptedvalues->toString() : ""), (opt->required && show_required_string != "" ? show_required_string : "")); option_list->push_back(stream.str()); stream.str(""); } // before the text, we generate details if we need to and the option isn't hidden if (opt->details && generate_details && (!opt->hidden || generate_hidden)) { string wrapped_desc ( 2, ' '); // details are indented wrap_cstr ( wrapped_desc, 2, 0, opt->details); option_list->push_back(wrapped_desc); } // a possible description to be printed after this option if (opt->text_after) { string wrapped_desc; wrap_cstr ( wrapped_desc, 0, 0, opt->text_after); option_list->push_back(wrapped_desc); } } return option_list; } template void generate_counter_init(const Collection &collection, const string &name, ostream &stream, unsigned int indentation) { string indent_str (indentation, ' '); typename Collection::const_iterator end = collection.end(); for ( typename Collection::const_iterator idx = collection.begin(); idx != end; ++idx) { stream << indent_str; stream << ARGS_STRUCT << "->" << canonize_name (idx->first) << "_" << name << "_counter = 0 ;"; stream << endl; } } void CmdlineParserCreator::generate_given_init(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; string indent_str (indentation, ' '); clear_given_gen_class clear_given; clear_given.set_arg_struct(ARGS_STRUCT); /* now we initialize "given" fields */ foropt { stream << indent_str; clear_given.set_var_arg(opt->var_arg); clear_given.set_group(opt->multiple && opt->group_value); clear_given.generate_clear_given(stream); } // for group counter initialization generate_counter_init(gengetopt_groups, "group", stream, indentation); // for mode counter initialization generate_counter_init(gengetopt_modes, "mode", stream, indentation); } void CmdlineParserCreator::generate_reset_groups(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; string indent_str (indentation, ' '); ostringstream body; reset_group_gen_class reset_group; clear_given_gen_class clear_given; clear_given.set_arg_struct(ARGS_STRUCT); reset_group.set_args_info (c_source_gen_class::args_info); groups_collection_t::const_iterator end = gengetopt_groups.end(); for ( groups_collection_t::const_iterator idx = gengetopt_groups.begin(); idx != end; ++idx) { body.str (""); bool found_option = false; foropt { if (opt->group_value && strcmp(opt->group_value, idx->first.c_str()) == 0) { /* now we reset "given" fields */ stream << indent_str; clear_given.set_var_arg(opt->var_arg); clear_given.set_group(opt->multiple && opt->group_value); clear_given.generate_clear_given(body); free_option (opt, body, indentation); found_option = true; } } if (found_option) { reset_group.set_name (canonize_name (idx->first)); reset_group.set_body (body.str ()); reset_group.generate_reset_group (stream); } } } void CmdlineParserCreator::free_option(struct gengetopt_option *opt, ostream &stream, unsigned int indentation) { if (opt->type == ARG_NO) return; if (opt->type != ARG_FLAG) { if (opt->multiple) { free_multiple_gen_class free_multiple; free_multiple.set_has_string_type(opt->type == ARG_STRING); free_multiple.set_structure (ARGS_STRUCT); free_multiple.set_opt_var (opt->var_arg); free_multiple.generate_free_multiple (stream, indentation); } else { free_string_gen_class free_string; free_string.set_has_string_type(opt->type == ARG_STRING); free_string.set_structure (ARGS_STRUCT); free_string.set_opt_var (opt->var_arg); free_string.generate_free_string (stream, indentation); } } } void CmdlineParserCreator::generate_list_def(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; string indent_str (indentation, ' '); multiple_opt_list_gen_class multiple_opt_list; /* define linked-list structs for multiple options */ foropt { if (opt->multiple) { if (opt->type) { stream << indent_str; multiple_opt_list.set_arg_name (opt->var_arg); multiple_opt_list.generate_multiple_opt_list (stream, indentation); stream << endl; } } } } void CmdlineParserCreator::generate_multiple_fill_array(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; string indent_str (indentation, ' '); multiple_fill_array_gen_class filler; /* copy linked list into the array */ foropt { if (opt->multiple && opt->type) { stream << indent_str; filler.set_option_var_name (opt->var_arg); filler.set_arg_type(arg_type_constants[opt->type]); filler.set_type (arg_types_names[opt->type]); string default_string = "0"; if (opt->default_string) { if (opt->type == ARG_STRING) default_string = string("\"") + opt->default_string + "\""; else if (opt->type == ARG_ENUM) default_string = from_value_to_enum(opt->var_arg, opt->default_string); else default_string = opt->default_string; } filler.set_default_value (default_string); filler.generate_multiple_fill_array (stream, indentation); stream << endl; } } } void CmdlineParserCreator::generate_update_multiple_given(ostream &stream, unsigned int indentation) { if (! has_multiple_options()) return; string indent_str (indentation, ' '); stream << endl; stream << indent_str; update_given_gen_class update_given_gen; struct gengetopt_option * opt; foropt { if (opt->multiple) { update_given_gen.set_option_var_name (opt->var_arg); update_given_gen.generate_update_given (stream, indentation); } } } void CmdlineParserCreator::generate_check_modes(ostream &stream, unsigned int indentation) { // no need to check for conflict if there's only one mode if (gengetopt_modes.size() < 2) return; string indent_str (indentation, ' '); stream << endl; stream << indent_str; const ModeOptionMap &modeoptionmap = getModeOptionMap(); check_modes_gen_class check_modes_gen; // now we check each mode options against every other mode options: // the first one with the other n-1, the second one with the other n-2, etc. ModeOptionMap::const_iterator map_it1, map_it2; for (ModeOptionMap::const_iterator map_it = modeoptionmap.begin(); map_it != modeoptionmap.end(); ++map_it) { map_it1 = map_it; ++map_it; if (map_it == modeoptionmap.end()) break; for (map_it2 = map_it; map_it2 != modeoptionmap.end(); ++map_it2) { const string mode1 = canonize_name(map_it1->first); const string mode2 = canonize_name(map_it2->first); check_modes_gen.set_mode1_name(mode1); check_modes_gen.set_mode2_name(mode2); ostringstream mode1_given, mode2_given, mode1_options, mode2_options; std::for_each(map_it1->second.begin(), map_it1->second.end(), pair_print_f(mode1_given, mode1_options)); std::for_each(map_it2->second.begin(), map_it2->second.end(), pair_print_f(mode2_given, mode2_options)); check_modes_gen.set_mode1_given_fields(mode1_given.str()); check_modes_gen.set_mode1_options(mode1_options.str()); check_modes_gen.set_mode2_given_fields(mode2_given.str()); check_modes_gen.set_mode2_options(mode2_options.str()); check_modes_gen.generate_check_modes(stream, indentation); } map_it = map_it1; } } void CmdlineParserCreator::generate_clear_arg(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; clear_arg_gen_class cleararg; /* now we initialize value fields */ foropt { if (opt->type == ARG_NO) continue; cleararg.set_name(opt->var_arg); cleararg.set_suffix("arg"); cleararg.set_value("NULL"); cleararg.set_has_orig(opt->type != ARG_FLAG); cleararg.set_has_arg(false); if (opt->multiple && opt->type) { cleararg.set_has_arg(true); } else if (opt->type == ARG_STRING) { cleararg.set_has_arg(true); if (opt->default_given) cleararg.set_value ("gengetopt_strdup (\"" + string(opt->default_string) + "\")"); } else if (opt->type == ARG_FLAG) { cleararg.set_has_arg(true); cleararg.set_suffix("flag"); cleararg.set_value(opt->flagstat ? "1" : "0"); } else if (opt->type == ARG_ENUM) { // initialize enum arguments to -1 (unless they have a default) cleararg.set_has_arg(true); if (opt->default_given) cleararg.set_value(from_value_to_enum(opt->var_arg, opt->default_string)); else cleararg.set_value(string(opt->var_arg) + "__NULL"); } else if (opt->default_given) { cleararg.set_has_arg(true); cleararg.set_value(opt->default_string); } cleararg.generate_clear_arg(stream, indentation); } } void CmdlineParserCreator::generate_long_option_struct(ostream &stream, unsigned int indentation) { string indent_str (indentation, ' '); struct gengetopt_option * opt; foropt { stream << indent_str; stream << "{ \"" << opt->long_opt << "\",\t" << (opt->type == ARG_NO || opt->type == ARG_FLAG ? 0 : (opt->arg_is_optional ? 2 : 1)) << ", NULL, "; if (opt->short_opt) stream << "\'" << opt->short_opt << "\'"; else stream << "0"; stream << " }," << endl; } } string CmdlineParserCreator::generate_getopt_string() { struct gengetopt_option * opt; ostringstream built_getopt_string; foropt if (opt->short_opt) { built_getopt_string << opt->short_opt << (opt->type == ARG_NO || opt->type == ARG_FLAG ? "" : ":"); built_getopt_string << (opt->arg_is_optional ? ":" : ""); } return built_getopt_string.str (); } void CmdlineParserCreator::generate_handle_no_short_option(ostream &stream, unsigned int indentation) { handle_options(stream, indentation, false); } void CmdlineParserCreator::generate_handle_option(ostream &stream, unsigned int indentation) { handle_options(stream, indentation, true); } void CmdlineParserCreator::handle_options(ostream &stream, unsigned int indentation, bool has_short) { struct gengetopt_option * opt; generic_option_gen_class option_gen; string indent_str (indentation, ' '); bool first = true; option_gen.set_has_short_option (has_short); // by default we handle '?' case in the switch // unless the user defined a short option as ? set_handle_question_mark(true); foropt { if (opt->short_opt == '?') set_handle_question_mark(false); if ((has_short && opt->short_opt) || (!has_short && !opt->short_opt)) { if (has_short || first) stream << indent_str; option_gen.set_option_comment (opt->desc); option_gen.set_long_option (opt->long_opt); option_gen.set_short_option(opt->short_opt ? string (1, opt->short_opt) : "-"); option_gen.set_option_var_name (opt->var_arg); option_gen.set_final_instructions(""); if (!no_help && ((opt->short_opt == HELP_SHORT_OPT && strcmp(opt->long_opt, HELP_LONG_OPT) == 0) || strcmp(opt->long_opt, HELP_LONG_OPT) == 0 || strcmp(opt->long_opt, FULL_HELP_LONG_OPT) == 0 || strcmp(opt->long_opt, DETAILED_HELP_LONG_OPT) == 0)) { bool full_help = (strcmp(opt->long_opt, FULL_HELP_LONG_OPT) == 0); bool detailed_help = (strcmp(opt->long_opt, DETAILED_HELP_LONG_OPT) == 0); if (no_handle_help) { // we use the final_instructions parameter to call the free function // and to return 0 const string final_instructions = parser_function_name + string("_free (&local_args_info);\nreturn 0;"); option_gen.set_final_instructions(final_instructions); if (full_help) { option_gen.set_long_option (FULL_HELP_LONG_OPT); option_gen.set_option_comment (FULL_HELP_OPT_DESCR); } else if (detailed_help) { option_gen.set_long_option (DETAILED_HELP_LONG_OPT); option_gen.set_option_comment (DETAILED_HELP_OPT_DESCR); } else { option_gen.set_long_option (HELP_LONG_OPT); option_gen.set_short_option (HELP_SHORT_OPT_STR); option_gen.set_option_comment (HELP_OPT_DESCR); } //option_gen.set_has_short_option (!full_help); } else { handle_help_gen_class help_gen; help_gen.set_parser_name (parser_function_name); help_gen.set_full_help(full_help); help_gen.set_detailed_help(detailed_help); help_gen.set_short_opt(opt->short_opt == HELP_SHORT_OPT); help_gen.generate_handle_help (stream, indentation); stream << endl; stream << endl; continue; } } if (!no_version && ((opt->short_opt == VERSION_SHORT_OPT && strcmp(opt->long_opt, VERSION_LONG_OPT) == 0) || strcmp(opt->long_opt, VERSION_LONG_OPT) == 0)) { if (no_handle_version) { option_gen.set_long_option (VERSION_LONG_OPT); option_gen.set_short_option (VERSION_SHORT_OPT_STR); option_gen.set_option_comment (VERSION_OPT_DESCR); //option_gen.set_has_short_option (true); // we use the final_instrauctions parameter to call the free function // and to return 0 const string final_instructions = parser_function_name + string("_free (&local_args_info);\nreturn 0;"); option_gen.set_final_instructions(final_instructions); } else { handle_version_gen_class version_gen; version_gen.set_parser_name (parser_function_name); version_gen.set_short_opt (opt->short_opt == VERSION_SHORT_OPT); version_gen.generate_handle_version (stream, indentation); stream << endl; stream << endl; continue; } } if (opt->acceptedvalues != 0) option_gen.set_possible_values (OPTION_VALUES_NAME(opt->var_arg)); else option_gen.set_possible_values ("0"); string default_string = "0"; if (opt->default_string) default_string = string("\"") + opt->default_string + "\""; option_gen.set_default_value (default_string); option_gen.set_arg_type(arg_type_constants[opt->type]); if (opt->group_value) { option_gen.set_group_var_name (canonize_name (opt->group_value)); option_gen.set_option_has_group(true); } else option_gen.set_option_has_group(false); if (opt->mode_value) { // we reuse the variable group_var_name also for modes option_gen.set_group_var_name (canonize_name (opt->mode_value)); option_gen.set_option_has_mode(true); } else option_gen.set_option_has_mode(false); option_gen.set_option_has_type(opt->type != 0); if (opt->multiple) { option_gen.set_multiple(true); option_gen.set_structure (string (opt->var_arg) + "_list"); } else { option_gen.set_multiple(false); option_gen.set_structure (ARGS_STRUCT); } option_gen.generate_generic_option (stream, indentation); if (has_short) { stream << endl; } if (first && !has_short) { first = false; option_gen.set_gen_else ("else "); } } } if (! first && !has_short) // something has been generated { generateBreak(stream, indentation); stream << endl; } } #define GROUP_REQUIRED_COMPARISON "!=" #define GROUP_NOT_REQUIRED_COMPARISON ">" #define GROUP_REQUIRED_MESSAGE "One" #define GROUP_NOT_REQUIRED_MESSAGE "At most one" void CmdlineParserCreator::generate_handle_group(ostream &stream, unsigned int indentation) { group_option_gen_class opt_gen; string indent_str (indentation, ' '); opt_gen.set_package_var_name (EXE_NAME); opt_gen.set_Comparison_rule(GROUP_NOT_REQUIRED_COMPARISON " 1"); groups_collection_t::const_iterator end = gengetopt_groups.end(); for ( groups_collection_t::const_iterator idx = gengetopt_groups.begin(); idx != end; ++idx) { stream << indent_str; opt_gen.set_group_name (idx->first); opt_gen.set_group_var_name (canonize_name (idx->first)); if (idx->second.required) { opt_gen.set_number_required(GROUP_REQUIRED_MESSAGE); } else { opt_gen.set_number_required(GROUP_NOT_REQUIRED_MESSAGE); } opt_gen.generate_group_option (stream, indentation); stream << endl; } } void CmdlineParserCreator::generate_handle_required(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; required_option_gen_class opt_gen; opt_gen.set_package_var_name ("prog_name"); /* write test for required options or for multiple options (occurrence number check) */ foropt if ( opt->required || opt->multiple ) { if (opt->mode_value) { opt_gen.set_mode_condition("args_info->" + canonize_name(opt->mode_value) + "_mode_counter && "); } else { opt_gen.set_mode_condition(""); } // build the option command line representation ostringstream req_opt; req_opt << "'--" << opt->long_opt << "'"; if (opt->short_opt) req_opt << " ('-" << opt->short_opt << "')"; opt_gen.set_option_var_name (opt->var_arg); opt_gen.set_option_descr (req_opt.str ()); // if the option is required this is the standard check if (opt->required) { opt_gen.set_checkrange(false); opt_gen.generate_required_option (stream, indentation); } // if the option is multiple we generate also the // occurrence range check if (opt->multiple) { opt_gen.set_checkrange(true); opt_gen.generate_required_option (stream, indentation); } // notice that the above ifs are not mutually exclusive: // a multiple option can have a range check without being // required. } // now generate the checks for required group options group_option_gen_class group_opt_gen; group_opt_gen.set_package_var_name ("prog_name"); group_opt_gen.set_Comparison_rule("== 0"); group_opt_gen.set_number_required(GROUP_REQUIRED_MESSAGE); groups_collection_t::const_iterator end = gengetopt_groups.end(); for ( groups_collection_t::const_iterator idx = gengetopt_groups.begin(); idx != end; ++idx) { if (idx->second.required) { group_opt_gen.set_group_name (idx->first); group_opt_gen.set_group_var_name (canonize_name (idx->first)); group_opt_gen.generate_group_option (stream, indentation); stream << endl; } } } void CmdlineParserCreator::generate_handle_dependencies(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; dependant_option_gen_class opt_gen; opt_gen.set_package_var_name ("prog_name"); string indent_str (indentation, ' '); /* write test for required options */ foropt if ( opt->dependon ) { stream << indent_str; ostringstream req_opt; req_opt << "'--" << opt->long_opt << "'"; if (opt->short_opt) req_opt << " ('-" << opt->short_opt << "')"; opt_gen.set_option_var_name (opt->var_arg); opt_gen.set_dep_option (canonize_name(opt->dependon)); opt_gen.set_option_descr (req_opt.str ()); opt_gen.set_dep_option_descr (opt->dependon); opt_gen.generate_dependant_option (stream, indentation); stream << endl; } } template void generate_counters(const Collection &collection, const string &name, ostream &stream, unsigned int indentation) { group_counter_gen_class counter_gen; string indent_str (indentation, ' '); counter_gen.set_name(name); typename Collection::const_iterator end = collection.end(); for ( typename Collection::const_iterator idx = collection.begin(); idx != end; ++idx) { stream << indent_str; counter_gen.set_group_name (canonize_name (idx->first)); counter_gen.generate_group_counter (stream, indentation); stream << endl; } } void CmdlineParserCreator::generate_group_counters(ostream &stream, unsigned int indentation) { generate_counters(gengetopt_groups, "group", stream, indentation); } void CmdlineParserCreator::generate_mode_counters(ostream &stream, unsigned int indentation) { // we can reuse group counter gen class also for modes generate_counters(gengetopt_modes, "mode", stream, indentation); } int CmdlineParserCreator::generate_source () { /* ****************************************************** */ /* ********************************************** C FILE */ /* ****************************************************** */ set_usage_string (generate_usage_string ()); set_getopt_string (generate_getopt_string ()); string output_source = c_filename; if (src_output_dir.size()) output_source = src_output_dir + "/" + output_source; else if (output_dir.size()) output_source = output_dir + "/" + output_source; ofstream *output_file = open_fstream (output_source.c_str()); generate_c_source (*output_file); output_file->close (); delete output_file; return 0; } void CmdlineParserCreator::generate_free(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; foropt { free_option (opt, stream, indentation); } } void CmdlineParserCreator::generate_list_free(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; if (! has_multiple_options()) return; free_list_gen_class free_list; foropt { if (opt->multiple && opt->type) { free_list.set_list_name(opt->var_arg); free_list.set_string_list(opt->type == ARG_STRING); free_list.generate_free_list(stream, indentation); } } } void CmdlineParserCreator::generate_file_save_loop(ostream &stream, unsigned int indentation) { struct gengetopt_option * opt; file_save_multiple_gen_class file_save_multiple; file_save_gen_class file_save; const string suffix = "_orig"; const string suffix_given = "_given"; foropt { if (opt->multiple) { file_save_multiple.set_has_arg(opt->type != ARG_NO); file_save_multiple.set_opt_var(opt->var_arg); file_save_multiple.set_opt_name(opt->long_opt); file_save_multiple.set_values ((opt->acceptedvalues ? OPTION_VALUES_NAME(opt->var_arg) : "0")); file_save_multiple.generate_file_save_multiple(stream, indentation); } else { file_save.set_opt_name(opt->long_opt); file_save.set_given(opt->var_arg + suffix_given); file_save.set_values ((opt->acceptedvalues ? OPTION_VALUES_NAME(opt->var_arg) : "0")); if (opt->type != ARG_NO && opt->type != ARG_FLAG) { file_save.set_arg(opt->var_arg + suffix + (opt->multiple ? " [i]" : "")); } else { file_save.set_arg(""); } file_save.generate_file_save(stream, indentation); } } } gengetopt-2.22.6/src/gm.h0000664000175000017500000001544312045003074012067 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GM_H #define _GM_H #include "skels/header.h" #include "skels/c_source.h" #include #include #define TAB_LEN 2 struct gengetopt_option; typedef std::list OptionHelpList; class CmdlineParserCreator : public header_gen_class, public c_source_gen_class { protected: char *parser_function_name; char *filename; char *args_info_name; char *header_filename; char *c_filename; string output_dir; string header_output_dir; string src_output_dir; string comment; char *unamed_options; string show_required_string; bool long_help; bool no_handle_help; bool no_help; bool no_handle_version; bool no_version; bool no_handle_error; bool strict_hidden; bool conf_parser; bool string_parser; bool gen_gengetopt_version; bool gen_strdup; unsigned int tab_indentation ; /* tab indentation level */ void inc_indent() { tab_indentation += TAB_LEN ; } void dec_indent() { tab_indentation -= TAB_LEN ; } void indent() { unsigned int i ; for ( i = 1 ; i <= tab_indentation ; ++i ) printf (" "); } void free_option(struct gengetopt_option *opt, ostream &stream, unsigned int indent); int generate_header_file(); int generate_source(); string generate_getopt_string(); // to be implemented in header_gen_class virtual void generate_enum_types(ostream &stream, unsigned int indent); virtual void generate_option_arg(ostream &stream, unsigned int indent); virtual void generate_option_given(ostream &stream, unsigned int indent); virtual void generate_option_values_decl(ostream &stream, unsigned int indent); // to be implemented in c_source_gen_class virtual void generate_clear_arg(ostream &stream, unsigned int indent); virtual void generate_given_init(ostream &stream, unsigned int indent); virtual void generate_option_values(ostream &stream, unsigned int indent); virtual void generate_handle_no_short_option(ostream &stream, unsigned int indent); virtual void generate_handle_option(ostream &stream, unsigned int indent); virtual void generate_handle_required(ostream &stream, unsigned int indent); virtual void generate_handle_dependencies(ostream &stream, unsigned int indent); virtual void generate_handle_group(ostream &stream, unsigned int indent); virtual void generate_group_counters(ostream &stream, unsigned int indent); virtual void generate_mode_counters(ostream &stream, unsigned int indent); virtual void generate_help_option_print(ostream &stream, unsigned int indent); virtual void generate_full_help_option_print(ostream &stream, unsigned int indent); virtual void generate_detailed_help_option_print(ostream &stream, unsigned int indent); virtual void generate_long_option_struct(ostream &stream, unsigned int indent); virtual void generate_reset_groups(ostream &stream, unsigned int indent); virtual void generate_free(ostream &stream, unsigned int indent); virtual void generate_list_free(ostream &stream, unsigned int indent); virtual void generate_file_save_loop(ostream &stream, unsigned int indent); virtual void generate_init_args_info(ostream &stream, unsigned int indent); virtual void generate_custom_getopt(ostream &stream, unsigned int indent); void generateBreak(ostream &stream, unsigned int indent = 0); void handle_options(ostream &, unsigned int, bool has_short); public: CmdlineParserCreator (char *function_name, char *struct_name, char *unamed_options, char *filename, char *header_ext, char *c_ext, bool long_help, bool no_handle_help, bool no_help, bool no_handle_version, bool no_version, bool no_handle_error, bool strict_hidden, bool conf_parser, bool string_parser, bool gen_version, bool gen_getopt, bool no_options, const string &comment, const string &outdir, const string &header_outdir, const string &src_outdir, const string &show_required); int generate(); virtual void generate_list_def(ostream &stream, unsigned int indent); virtual void generate_multiple_fill_array(ostream &stream, unsigned int indent); virtual void generate_update_multiple_given(ostream &stream, unsigned int indent); virtual void generate_check_modes(ostream &stream, unsigned int indent); const string generate_purpose(); const string generate_versiontext(); const string generate_description(); const string generate_usage_string(bool use_config_package = true); /** * generate a list of option descriptions that will be printed in the * help output * * @param generate_hidden if true, include also the hidden options * @param generate_details if true, include also the hidden options and * details for options that have them. */ OptionHelpList *generate_help_option_list(bool generate_hidden = false, bool generate_details = false); /** * generate the sharing between a list of help string, using the * complete_list as the list with all the strings (both for hidden * options and details, e.g.) and the smaller_list as the list * with less strings * * @param target_array the name of the array to copy to * @param source_array the name of the array to copy from */ void generate_help_option_print_from_lists(ostream &stream, unsigned int indent, OptionHelpList *complete_list, OptionHelpList *smaller_list, const std::string &target_array, const std::string &source_array); /** * Sets the has_arg_XXX by inspecting all the options types */ void set_has_arg_types(); }; #endif /* _GM_H */ gengetopt-2.22.6/src/skels/0000775000175000017500000000000012046541043012511 500000000000000gengetopt-2.22.6/src/skels/c_source.h0000664000175000017500000004002312046536545014416 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef C_SOURCE_GEN_CLASS_H #define C_SOURCE_GEN_CLASS_H #include #include using std::string; using std::ostream; class c_source_gen_class { protected: string args_info; string check_modes; bool check_possible_values; bool check_required_options; string clear_arg; bool cmd_list; string command_line; bool conf_parser; string custom_getopt; string description; string detailed_help_option_print; bool do_generate_strdup; string file_save_loop; string final_exit; string free; string full_help_option_print; bool generate_string_parser; string generator_version; string getopt_string; string given_init; string handle_dependencies; string handle_group; string handle_no_short_option; string handle_option; bool handle_question_mark; string handle_required; bool handle_unamed; bool has_arg_double; bool has_arg_enum; bool has_arg_flag; bool has_arg_float; bool has_arg_int; bool has_arg_long; bool has_arg_longdouble; bool has_arg_longlong; bool has_arg_short; bool has_arg_string; bool has_details; bool has_hidden; bool has_modes; bool has_typed_options; string header_file_ext; string help_option_print; string help_string_num; bool include_getopt; string init_args_info; string list_def; string list_free; string long_option_struct; string multiple_fill_array; bool multiple_options; bool multiple_options_all_string; bool multiple_options_string; bool multiple_options_with_default; bool multiple_token_functions; bool no_options; bool no_package; string option_values; string package_var_name; string parser_name; string purpose; string reset_groups; string source_name; string update_multiple_given; string usage_string; string version_var_name; string versiontext; public: c_source_gen_class() : check_possible_values (false), check_required_options (false), cmd_list (false), conf_parser (false), do_generate_strdup (false), generate_string_parser (false), handle_question_mark (false), handle_unamed (false), has_arg_double (false), has_arg_enum (false), has_arg_flag (false), has_arg_float (false), has_arg_int (false), has_arg_long (false), has_arg_longdouble (false), has_arg_longlong (false), has_arg_short (false), has_arg_string (false), has_details (false), has_hidden (false), has_modes (false), has_typed_options (false), include_getopt (false), multiple_options (false), multiple_options_all_string (false), multiple_options_string (false), multiple_options_with_default (false), multiple_token_functions (false), no_options (false), no_package (false) { } c_source_gen_class(const string &_args_info, const string &_check_modes, bool _check_possible_values, bool _check_required_options, const string &_clear_arg, bool _cmd_list, const string &_command_line, bool _conf_parser, const string &_custom_getopt, const string &_description, const string &_detailed_help_option_print, bool _do_generate_strdup, const string &_file_save_loop, const string &_final_exit, const string &_free, const string &_full_help_option_print, bool _generate_string_parser, const string &_generator_version, const string &_getopt_string, const string &_given_init, const string &_handle_dependencies, const string &_handle_group, const string &_handle_no_short_option, const string &_handle_option, bool _handle_question_mark, const string &_handle_required, bool _handle_unamed, bool _has_arg_double, bool _has_arg_enum, bool _has_arg_flag, bool _has_arg_float, bool _has_arg_int, bool _has_arg_long, bool _has_arg_longdouble, bool _has_arg_longlong, bool _has_arg_short, bool _has_arg_string, bool _has_details, bool _has_hidden, bool _has_modes, bool _has_typed_options, const string &_header_file_ext, const string &_help_option_print, const string &_help_string_num, bool _include_getopt, const string &_init_args_info, const string &_list_def, const string &_list_free, const string &_long_option_struct, const string &_multiple_fill_array, bool _multiple_options, bool _multiple_options_all_string, bool _multiple_options_string, bool _multiple_options_with_default, bool _multiple_token_functions, bool _no_options, bool _no_package, const string &_option_values, const string &_package_var_name, const string &_parser_name, const string &_purpose, const string &_reset_groups, const string &_source_name, const string &_update_multiple_given, const string &_usage_string, const string &_version_var_name, const string &_versiontext) : args_info (_args_info), check_modes (_check_modes), check_possible_values (_check_possible_values), check_required_options (_check_required_options), clear_arg (_clear_arg), cmd_list (_cmd_list), command_line (_command_line), conf_parser (_conf_parser), custom_getopt (_custom_getopt), description (_description), detailed_help_option_print (_detailed_help_option_print), do_generate_strdup (_do_generate_strdup), file_save_loop (_file_save_loop), final_exit (_final_exit), free (_free), full_help_option_print (_full_help_option_print), generate_string_parser (_generate_string_parser), generator_version (_generator_version), getopt_string (_getopt_string), given_init (_given_init), handle_dependencies (_handle_dependencies), handle_group (_handle_group), handle_no_short_option (_handle_no_short_option), handle_option (_handle_option), handle_question_mark (_handle_question_mark), handle_required (_handle_required), handle_unamed (_handle_unamed), has_arg_double (_has_arg_double), has_arg_enum (_has_arg_enum), has_arg_flag (_has_arg_flag), has_arg_float (_has_arg_float), has_arg_int (_has_arg_int), has_arg_long (_has_arg_long), has_arg_longdouble (_has_arg_longdouble), has_arg_longlong (_has_arg_longlong), has_arg_short (_has_arg_short), has_arg_string (_has_arg_string), has_details (_has_details), has_hidden (_has_hidden), has_modes (_has_modes), has_typed_options (_has_typed_options), header_file_ext (_header_file_ext), help_option_print (_help_option_print), help_string_num (_help_string_num), include_getopt (_include_getopt), init_args_info (_init_args_info), list_def (_list_def), list_free (_list_free), long_option_struct (_long_option_struct), multiple_fill_array (_multiple_fill_array), multiple_options (_multiple_options), multiple_options_all_string (_multiple_options_all_string), multiple_options_string (_multiple_options_string), multiple_options_with_default (_multiple_options_with_default), multiple_token_functions (_multiple_token_functions), no_options (_no_options), no_package (_no_package), option_values (_option_values), package_var_name (_package_var_name), parser_name (_parser_name), purpose (_purpose), reset_groups (_reset_groups), source_name (_source_name), update_multiple_given (_update_multiple_given), usage_string (_usage_string), version_var_name (_version_var_name), versiontext (_versiontext) { } virtual ~c_source_gen_class() { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_args_info(const string &_args_info) { args_info = _args_info; } virtual void generate_check_modes(ostream &stream, unsigned int indent) = 0; void set_check_modes(const string &_check_modes) { check_modes = _check_modes; } void set_check_possible_values(bool _check_possible_values) { check_possible_values = _check_possible_values; } void set_check_required_options(bool _check_required_options) { check_required_options = _check_required_options; } virtual void generate_clear_arg(ostream &stream, unsigned int indent) = 0; void set_clear_arg(const string &_clear_arg) { clear_arg = _clear_arg; } void set_cmd_list(bool _cmd_list) { cmd_list = _cmd_list; } void set_command_line(const string &_command_line) { command_line = _command_line; } void set_conf_parser(bool _conf_parser) { conf_parser = _conf_parser; } virtual void generate_custom_getopt(ostream &stream, unsigned int indent) = 0; void set_custom_getopt(const string &_custom_getopt) { custom_getopt = _custom_getopt; } void set_description(const string &_description) { description = _description; } virtual void generate_detailed_help_option_print(ostream &stream, unsigned int indent) = 0; void set_detailed_help_option_print(const string &_detailed_help_option_print) { detailed_help_option_print = _detailed_help_option_print; } void set_do_generate_strdup(bool _do_generate_strdup) { do_generate_strdup = _do_generate_strdup; } virtual void generate_file_save_loop(ostream &stream, unsigned int indent) = 0; void set_file_save_loop(const string &_file_save_loop) { file_save_loop = _file_save_loop; } void set_final_exit(const string &_final_exit) { final_exit = _final_exit; } virtual void generate_free(ostream &stream, unsigned int indent) = 0; void set_free(const string &_free) { free = _free; } virtual void generate_full_help_option_print(ostream &stream, unsigned int indent) = 0; void set_full_help_option_print(const string &_full_help_option_print) { full_help_option_print = _full_help_option_print; } void set_generate_string_parser(bool _generate_string_parser) { generate_string_parser = _generate_string_parser; } void set_generator_version(const string &_generator_version) { generator_version = _generator_version; } void set_getopt_string(const string &_getopt_string) { getopt_string = _getopt_string; } virtual void generate_given_init(ostream &stream, unsigned int indent) = 0; void set_given_init(const string &_given_init) { given_init = _given_init; } virtual void generate_handle_dependencies(ostream &stream, unsigned int indent) = 0; void set_handle_dependencies(const string &_handle_dependencies) { handle_dependencies = _handle_dependencies; } virtual void generate_handle_group(ostream &stream, unsigned int indent) = 0; void set_handle_group(const string &_handle_group) { handle_group = _handle_group; } virtual void generate_handle_no_short_option(ostream &stream, unsigned int indent) = 0; void set_handle_no_short_option(const string &_handle_no_short_option) { handle_no_short_option = _handle_no_short_option; } virtual void generate_handle_option(ostream &stream, unsigned int indent) = 0; void set_handle_option(const string &_handle_option) { handle_option = _handle_option; } void set_handle_question_mark(bool _handle_question_mark) { handle_question_mark = _handle_question_mark; } virtual void generate_handle_required(ostream &stream, unsigned int indent) = 0; void set_handle_required(const string &_handle_required) { handle_required = _handle_required; } void set_handle_unamed(bool _handle_unamed) { handle_unamed = _handle_unamed; } void set_has_arg_double(bool _has_arg_double) { has_arg_double = _has_arg_double; } void set_has_arg_enum(bool _has_arg_enum) { has_arg_enum = _has_arg_enum; } void set_has_arg_flag(bool _has_arg_flag) { has_arg_flag = _has_arg_flag; } void set_has_arg_float(bool _has_arg_float) { has_arg_float = _has_arg_float; } void set_has_arg_int(bool _has_arg_int) { has_arg_int = _has_arg_int; } void set_has_arg_long(bool _has_arg_long) { has_arg_long = _has_arg_long; } void set_has_arg_longdouble(bool _has_arg_longdouble) { has_arg_longdouble = _has_arg_longdouble; } void set_has_arg_longlong(bool _has_arg_longlong) { has_arg_longlong = _has_arg_longlong; } void set_has_arg_short(bool _has_arg_short) { has_arg_short = _has_arg_short; } void set_has_arg_string(bool _has_arg_string) { has_arg_string = _has_arg_string; } void set_has_details(bool _has_details) { has_details = _has_details; } void set_has_hidden(bool _has_hidden) { has_hidden = _has_hidden; } void set_has_modes(bool _has_modes) { has_modes = _has_modes; } void set_has_typed_options(bool _has_typed_options) { has_typed_options = _has_typed_options; } void set_header_file_ext(const string &_header_file_ext) { header_file_ext = _header_file_ext; } virtual void generate_help_option_print(ostream &stream, unsigned int indent) = 0; void set_help_option_print(const string &_help_option_print) { help_option_print = _help_option_print; } void set_help_string_num(const string &_help_string_num) { help_string_num = _help_string_num; } void set_include_getopt(bool _include_getopt) { include_getopt = _include_getopt; } virtual void generate_init_args_info(ostream &stream, unsigned int indent) = 0; void set_init_args_info(const string &_init_args_info) { init_args_info = _init_args_info; } virtual void generate_list_def(ostream &stream, unsigned int indent) = 0; void set_list_def(const string &_list_def) { list_def = _list_def; } virtual void generate_list_free(ostream &stream, unsigned int indent) = 0; void set_list_free(const string &_list_free) { list_free = _list_free; } virtual void generate_long_option_struct(ostream &stream, unsigned int indent) = 0; void set_long_option_struct(const string &_long_option_struct) { long_option_struct = _long_option_struct; } virtual void generate_multiple_fill_array(ostream &stream, unsigned int indent) = 0; void set_multiple_fill_array(const string &_multiple_fill_array) { multiple_fill_array = _multiple_fill_array; } void set_multiple_options(bool _multiple_options) { multiple_options = _multiple_options; } void set_multiple_options_all_string(bool _multiple_options_all_string) { multiple_options_all_string = _multiple_options_all_string; } void set_multiple_options_string(bool _multiple_options_string) { multiple_options_string = _multiple_options_string; } void set_multiple_options_with_default(bool _multiple_options_with_default) { multiple_options_with_default = _multiple_options_with_default; } void set_multiple_token_functions(bool _multiple_token_functions) { multiple_token_functions = _multiple_token_functions; } void set_no_options(bool _no_options) { no_options = _no_options; } void set_no_package(bool _no_package) { no_package = _no_package; } virtual void generate_option_values(ostream &stream, unsigned int indent) = 0; void set_option_values(const string &_option_values) { option_values = _option_values; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void set_parser_name(const string &_parser_name) { parser_name = _parser_name; } void set_purpose(const string &_purpose) { purpose = _purpose; } virtual void generate_reset_groups(ostream &stream, unsigned int indent) = 0; void set_reset_groups(const string &_reset_groups) { reset_groups = _reset_groups; } void set_source_name(const string &_source_name) { source_name = _source_name; } virtual void generate_update_multiple_given(ostream &stream, unsigned int indent) = 0; void set_update_multiple_given(const string &_update_multiple_given) { update_multiple_given = _update_multiple_given; } void set_usage_string(const string &_usage_string) { usage_string = _usage_string; } void set_version_var_name(const string &_version_var_name) { version_var_name = _version_var_name; } void set_versiontext(const string &_versiontext) { versiontext = _versiontext; } void generate_c_source(ostream &stream, unsigned int indent = 0); }; #endif // C_SOURCE_GEN_CLASS_H gengetopt-2.22.6/src/skels/clear_arg.h_skel0000664000175000017500000000017512044745036015550 00000000000000@IF@ has_arg @THEN@ args_info->@name@_@suffix@ = @value@; @ENDIF@ @IF@ has_orig @THEN@ args_info->@name@_orig = NULL; @ENDIF@gengetopt-2.22.6/src/skels/free_multiple.h_skel0000664000175000017500000000047712044745036016472 00000000000000@IF@ has_string_type @THEN@ free_multiple_string_field (@structure@->@opt_var@_given, &(@structure@->@opt_var@_arg), &(@structure@->@opt_var@_orig)); @ELSE@ free_multiple_field (@structure@->@opt_var@_given, (void *)(@structure@->@opt_var@_arg), &(@structure@->@opt_var@_orig)); @structure@->@opt_var@_arg = 0; @ENDIF@ gengetopt-2.22.6/src/skels/handle_help.h_skel0000664000175000017500000000105612044745036016073 00000000000000@IF@ detailed_help @THEN@ if (strcmp (long_options[option_index].name, "detailed-help") == 0) { @parser_name@_print_detailed_help (); @ELSEIF@ full_help @THEN@ if (strcmp (long_options[option_index].name, "full-help") == 0) { @parser_name@_print_full_help (); @ELSE@ @IF@ short_opt @THEN@ case 'h': /* Print help and exit. */ @ELSE@ if (strcmp (long_options[option_index].name, "help") == 0) { @ENDIF@ @parser_name@_print_help (); @ENDIF@ @parser_name@_free (&local_args_info); exit (EXIT_SUCCESS);@IF@ full_help or (not short_opt) @then@ }@ENDIF@gengetopt-2.22.6/src/skels/option_arg.cc0000664000175000017500000001411612045003074015100 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "option_arg.h" void option_arg_gen_class::generate_option_arg(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (long_long_arg) { stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; generate_string (type, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_arg; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); if (has_default) { stream << " (default="; generate_string (default_value, stream, indent + indent_str.length ()); stream << ")"; } stream << ". */"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; generate_string (longtype, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_arg; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); if (has_default) { stream << " (default="; generate_string (default_value, stream, indent + indent_str.length ()); stream << ")"; } stream << ". */"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; generate_string (origtype, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_orig; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << " original value given at command line. */"; stream << "\n"; stream << indent_str; } else { if (flag_arg) { generate_string (type, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_flag; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << " (default="; if (default_on) { stream << "on"; } else { stream << "off"; } stream << "). */"; stream << "\n"; stream << indent_str; } else { if (has_arg) { if (has_enum) { stream << "enum enum_"; generate_string (name, stream, indent + indent_str.length ()); stream << " "; if (multiple) { stream << "*"; } generate_string (name, stream, indent + indent_str.length ()); stream << "_arg; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); if (has_default) { stream << " (default='"; generate_string (default_value, stream, indent + indent_str.length ()); stream << "')"; } stream << ". */"; stream << "\n"; stream << indent_str; } else { generate_string (type, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_arg; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); if (has_default) { stream << " (default='"; generate_string (default_value, stream, indent + indent_str.length ()); stream << "')"; } stream << ". */"; stream << "\n"; stream << indent_str; } generate_string (origtype, stream, indent + indent_str.length ()); stream << " "; generate_string (name, stream, indent + indent_str.length ()); stream << "_orig; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << " original value given at command line. */"; stream << "\n"; stream << indent_str; } } } if (multiple) { stream << "unsigned int "; generate_string (name, stream, indent + indent_str.length ()); stream << "_min; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << "'s minimum occurreces */"; stream << "\n"; stream << indent_str; stream << "unsigned int "; generate_string (name, stream, indent + indent_str.length ()); stream << "_max; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << "'s maximum occurreces */"; stream << "\n"; stream << indent_str; } stream << "const char *"; generate_string (name, stream, indent + indent_str.length ()); stream << "_help; /**< "; stream << "@"; stream << "brief "; generate_string (desc, stream, indent + indent_str.length ()); stream << " help description. */"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/generic_option.h_skel0000664000175000017500000000410712044745036016634 00000000000000@IF@ has_short_option @THEN@ case '@short_option@': /* @option_comment@. */ @IF@ short_option:string = "?" @then@ if (optopt) /* '?' represents an unrecognized option */ goto failure; @ENDIF@ @ELSE@ /* @option_comment@. */ @gen_else@if (strcmp (long_options[option_index].name, "@long_option@") == 0) { @ENDIF@ @IF@ option_has_mode @THEN@ args_info->@group_var_name@_mode_counter += 1; @endif@ @IF@ multiple @THEN@ @IF@ option_has_type @THEN@ if (update_multiple_arg_temp(&@structure@, &(local_args_info.@option_var_name@_given), optarg, @possible_values@, @default_value@, @arg_type@, "@long_option@", '@short_option@', additional_error)) goto failure; @ELSE@ local_args_info.@option_var_name@_given++; @ENDIF@ @IF@ option_has_group @THEN@ if (!args_info->@option_var_name@_group) { args_info->@option_var_name@_group = 1; args_info->@group_var_name@_group_counter += 1; } @ENDIF@ @ELSE@ @IF@ option_has_group @THEN@ if (args_info->@group_var_name@_group_counter && override) reset_group_@group_var_name@ (args_info); args_info->@group_var_name@_group_counter += 1; @endif@ @IF@ arg_type:string = "ARG_FLAG" @THEN@ if (update_arg((void *)&(args_info->@option_var_name@_flag), 0, &(args_info->@option_var_name@_given), &(local_args_info.@option_var_name@_given), optarg, 0, 0, @arg_type@, check_ambiguity, override, 1, 0, "@long_option@", '@short_option@', additional_error)) goto failure; @ELSE@ if (update_arg(@if@ arg_type:string = "ARG_NO" @then@ 0 @else@ (void *)&(args_info->@option_var_name@_arg)@endif@, @if@ arg_type:string = "ARG_NO" @then@ 0 @else@ &(args_info->@option_var_name@_orig)@endif@, &(args_info->@option_var_name@_given), &(local_args_info.@option_var_name@_given), optarg, @possible_values@, @default_value@, @arg_type@, check_ambiguity, override, 0, 0, "@long_option@", '@short_option@', additional_error)) goto failure; @ENDIF@ @IF@ final_instructions:string != "" @THEN@ @final_instructions@ @ENDIF@ @ENDIF@ @IF@ has_short_option @then@ break;@else@ } @ENDIF@gengetopt-2.22.6/src/skels/dependant_option.cc0000664000175000017500000000224512045003074016271 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "dependant_option.h" void dependant_option_gen_class::generate_dependant_option(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "if (args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given && ! args_info->"; generate_string (dep_option, stream, indent + indent_str.length ()); stream << "_given)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: "; generate_string (option_descr, stream, indent + indent_str.length ()); stream << " option depends on option '"; generate_string (dep_option_descr, stream, indent + indent_str.length ()); stream << "'%s\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; } gengetopt-2.22.6/src/skels/free_multiple.cc0000664000175000017500000000366312044745036015612 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "free_multiple.h" void free_multiple_gen_class::generate_free_multiple(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (has_string_type) { stream << "free_multiple_string_field ("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_given, &("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_arg), &("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_orig));"; stream << "\n"; stream << indent_str; } else { stream << "free_multiple_field ("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_given, (void *)("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_arg), &("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_orig));"; stream << "\n"; stream << indent_str; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_arg = 0;"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/clear_given.h0000664000175000017500000000271112044745036015067 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef CLEAR_GIVEN_GEN_CLASS_H #define CLEAR_GIVEN_GEN_CLASS_H #include #include using std::string; using std::ostream; class clear_given_gen_class { protected: string arg_struct; bool group; string var_arg; public: clear_given_gen_class() : group (false) { } clear_given_gen_class(const string &_arg_struct, bool _group, const string &_var_arg) : arg_struct (_arg_struct), group (_group), var_arg (_var_arg) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg_struct(const string &_arg_struct) { arg_struct = _arg_struct; } void set_group(bool _group) { group = _group; } void set_var_arg(const string &_var_arg) { var_arg = _var_arg; } void generate_clear_given(ostream &stream, unsigned int indent = 0); }; #endif // CLEAR_GIVEN_GEN_CLASS_H gengetopt-2.22.6/src/skels/free_list.h0000664000175000017500000000253712044745036014573 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef FREE_LIST_GEN_CLASS_H #define FREE_LIST_GEN_CLASS_H #include #include using std::string; using std::ostream; class free_list_gen_class { protected: string list_name; bool string_list; public: free_list_gen_class() : string_list (false) { } free_list_gen_class(const string &_list_name, bool _string_list) : list_name (_list_name), string_list (_string_list) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_list_name(const string &_list_name) { list_name = _list_name; } void set_string_list(bool _string_list) { string_list = _string_list; } void generate_free_list(ostream &stream, unsigned int indent = 0); }; #endif // FREE_LIST_GEN_CLASS_H gengetopt-2.22.6/src/skels/copyright.cc0000664000175000017500000000203712044745036014760 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "copyright.h" void copyright_gen_class::generate_copyright(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "Copyright (C) "; generate_string (year, stream, indent + indent_str.length ()); stream << " Free Software Foundation Inc."; stream << "\n"; stream << indent_str; stream << "This program comes with ABSOLUTELY NO WARRANTY; for details"; stream << "\n"; stream << indent_str; stream << "please see the file 'COPYING' supplied with the source code."; stream << "\n"; stream << indent_str; stream << "This is free software, and you are welcome to redistribute it"; stream << "\n"; stream << indent_str; stream << "under certain conditions; again, see 'COPYING' for details."; stream << "\n"; stream << indent_str; stream << "This program is released under the GNU General Public License."; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/given_field.h0000664000175000017500000000270112044745036015063 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef GIVEN_FIELD_GEN_CLASS_H #define GIVEN_FIELD_GEN_CLASS_H #include #include using std::string; using std::ostream; class given_field_gen_class { protected: string arg_name; bool group; string long_opt; public: given_field_gen_class() : group (false) { } given_field_gen_class(const string &_arg_name, bool _group, const string &_long_opt) : arg_name (_arg_name), group (_group), long_opt (_long_opt) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg_name(const string &_arg_name) { arg_name = _arg_name; } void set_group(bool _group) { group = _group; } void set_long_opt(const string &_long_opt) { long_opt = _long_opt; } void generate_given_field(ostream &stream, unsigned int indent = 0); }; #endif // GIVEN_FIELD_GEN_CLASS_H gengetopt-2.22.6/src/skels/file_save_multiple.h0000664000175000017500000000317612044745036016467 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef FILE_SAVE_MULTIPLE_GEN_CLASS_H #define FILE_SAVE_MULTIPLE_GEN_CLASS_H #include #include using std::string; using std::ostream; class file_save_multiple_gen_class { protected: bool has_arg; string opt_name; string opt_var; string values; public: file_save_multiple_gen_class() : has_arg (false) { } file_save_multiple_gen_class(bool _has_arg, const string &_opt_name, const string &_opt_var, const string &_values) : has_arg (_has_arg), opt_name (_opt_name), opt_var (_opt_var), values (_values) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_has_arg(bool _has_arg) { has_arg = _has_arg; } void set_opt_name(const string &_opt_name) { opt_name = _opt_name; } void set_opt_var(const string &_opt_var) { opt_var = _opt_var; } void set_values(const string &_values) { values = _values; } void generate_file_save_multiple(ostream &stream, unsigned int indent = 0); }; #endif // FILE_SAVE_MULTIPLE_GEN_CLASS_H gengetopt-2.22.6/src/skels/handle_help.cc0000664000175000017500000000406412044745036015215 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "handle_help.h" void handle_help_gen_class::generate_handle_help(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (detailed_help) { stream << "if (strcmp (long_options[option_index].name, \"detailed-help\") == 0) {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_detailed_help ();"; indent = 0; stream << "\n"; stream << indent_str; } else { if (full_help) { stream << "if (strcmp (long_options[option_index].name, \"full-help\") == 0) {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_full_help ();"; indent = 0; stream << "\n"; stream << indent_str; } else { if (short_opt) { stream << "case 'h': /* Print help and exit. */"; stream << "\n"; stream << indent_str; } else { stream << "if (strcmp (long_options[option_index].name, \"help\") == 0) {"; stream << "\n"; stream << indent_str; } stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_help ();"; stream << "\n"; stream << indent_str; } } stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_free (&local_args_info);"; stream << "\n"; stream << indent_str; stream << " exit (EXIT_SUCCESS);"; if (( full_help || ( ! short_opt ) )) { stream << "\n"; stream << indent_str; stream << "}"; } } gengetopt-2.22.6/src/skels/enum_decl.cc0000664000175000017500000000115512044745036014703 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "enum_decl.h" void enum_decl_gen_class::generate_enum_decl(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "enum enum_"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << " { "; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "__NULL = -1"; generate_string (enum_values, stream, indent + indent_str.length ()); stream << " };"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/file_save_multiple.cc0000664000175000017500000000224612044745036016622 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "file_save_multiple.h" void file_save_multiple_gen_class::generate_file_save_multiple(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (has_arg) { stream << "write_multiple_into_file(outfile, args_info->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_given, \""; generate_string (opt_name, stream, indent + indent_str.length ()); stream << "\", args_info->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_orig, "; generate_string (values, stream, indent + indent_str.length ()); stream << ");"; stream << "\n"; stream << indent_str; } else { stream << "write_multiple_into_file(outfile, args_info->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_given, \""; generate_string (opt_name, stream, indent + indent_str.length ()); stream << "\", 0, 0);"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/free_list.h_skel0000664000175000017500000000011212044745036015574 00000000000000free_list (@list_name@_list, @IF@ string_list @THEN@ 1 @ELSE@ 0 @ENDIF@); gengetopt-2.22.6/src/skels/reset_group.cc0000664000175000017500000000262212044745036015306 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "reset_group.h" void reset_group_gen_class::generate_reset_group(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "static void"; stream << "\n"; stream << indent_str; stream << "reset_group_"; generate_string (name, stream, indent + indent_str.length ()); stream << "(struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " if (! args_info->"; generate_string (name, stream, indent + indent_str.length ()); stream << "_group_counter)"; stream << "\n"; stream << indent_str; stream << " return;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (body, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << " args_info->"; generate_string (name, stream, indent + indent_str.length ()); stream << "_group_counter = 0;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/required_option.cc0000664000175000017500000000423512045003074016150 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "required_option.h" void required_option_gen_class::generate_required_option(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (checkrange) { stream << "if ("; generate_string (mode_condition, stream, indent + indent_str.length ()); stream << "check_multiple_option_occurrences("; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given, args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_min, args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_max, \""; generate_string (option_descr, stream, indent + indent_str.length ()); stream << "\"))"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } else { stream << "if ("; generate_string (mode_condition, stream, indent + indent_str.length ()); stream << "! args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: "; generate_string (option_descr, stream, indent + indent_str.length ()); stream << " option required%s\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/Makefile.in0000664000175000017500000007000012046536525014504 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2008 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # if gengen is not installed we simply ignore the changes VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/skels DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libgen_la_LIBADD = am__objects_1 = header.lo c_source.lo handle_help.lo handle_version.lo \ generic_option.lo required_option.lo dependant_option.lo \ group_counter.lo group_option.lo print_help_string.lo \ multiple_opt_list.lo multiple_fill_array.lo copyright.lo \ free_string.lo free_multiple.lo reset_group.lo exit_failure.lo \ update_given.lo option_arg.lo given_field.lo clear_given.lo \ clear_arg.lo free_list.lo file_save.lo file_save_multiple.lo \ init_args_info.lo custom_getopt_gen.lo check_modes.lo \ enum_decl.lo am_libgen_la_OBJECTS = $(am__objects_1) libgen_la_OBJECTS = $(am_libgen_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libgen_la_SOURCES) DIST_SOURCES = $(libgen_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUFFIXES = .h_skel #.h_skel.cc: # echo "Not regenerating $@ since gengen is not installed" # better not to use touch, otherwise we will create an empty file in # the build directory # touch $@ @NO_GENGEN_FALSE@GENERATE = $(GENGEN) INCLUDES = -I@top_srcdir@/src noinst_LTLIBRARIES = libgen.la libgen_la_SOURCES = $(BUILT_SOURCES) BUILT_SOURCES = header.h header.cc c_source.h c_source.cc \ handle_help.h handle_version.h handle_help.cc handle_version.cc \ generic_option.h required_option.h dependant_option.h \ generic_option.cc required_option.cc dependant_option.cc \ group_counter.h group_option.h \ group_counter.cc group_option.cc \ print_help_string.h print_help_string.cc \ multiple_opt_list.cc multiple_opt_list.h \ multiple_fill_array.cc multiple_fill_array.h \ copyright.cc copyright.h \ free_string.cc free_string.h \ free_multiple.cc free_multiple.h \ reset_group.cc reset_group.h \ exit_failure.cc exit_failure.h \ update_given.cc update_given.h \ option_arg.cc option_arg.h \ given_field.cc given_field.h \ clear_given.cc clear_given.h \ clear_arg.cc clear_arg.h \ free_list.cc free_list.h \ file_save.cc file_save.h \ file_save_multiple.cc file_save_multiple.h \ init_args_info.cc init_args_info.h \ custom_getopt_gen.cc custom_getopt_gen.h \ check_modes.cc check_modes.h \ enum_decl.cc enum_decl.h EXTRA_DIST = header.h_skel c_source.h_skel handle_help.h_skel \ handle_version.h_skel generic_option.h_skel \ required_option.h_skel dependant_option.h_skel \ group_counter.h_skel group_option.h_skel \ print_help_string.h_skel \ multiple_opt_list.h_skel \ multiple_fill_array.h_skel \ copyright.h_skel free_string.h_skel \ free_multiple.h_skel \ reset_group.h_skel \ exit_failure.h_skel \ update_given.h_skel \ option_arg.h_skel \ given_field.h_skel \ clear_given.h_skel \ clear_arg.h_skel \ free_list.h_skel \ file_save.h_skel \ file_save_multiple.h_skel \ init_args_info.h_skel \ custom_getopt_gen.h_skel \ check_modes.h_skel \ enum_decl.h_skel \ $(BUILT_SOURCES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .h_skel .cc .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/skels/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/skels/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgen.la: $(libgen_la_OBJECTS) $(libgen_la_DEPENDENCIES) $(EXTRA_libgen_la_DEPENDENCIES) $(CXXLINK) $(libgen_la_OBJECTS) $(libgen_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_source.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_modes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear_arg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clear_given.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copyright.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/custom_getopt_gen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dependant_option.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum_decl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit_failure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_save.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_save_multiple.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_multiple.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free_string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic_option.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/given_field.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_counter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_option.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handle_help.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handle_version.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init_args_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multiple_fill_array.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multiple_opt_list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/option_arg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_help_string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/required_option.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reset_group.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update_given.Plo@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am @NO_GENGEN_FALSE@.h_skel.cc: @NO_GENGEN_FALSE@ name="`echo $* | sed 's/^.*\///g'`"; \ @NO_GENGEN_FALSE@ echo "$$name"; \ @NO_GENGEN_FALSE@ $(GENERATE) -i $< -F $*.h -f $$name --separate-files --expand-tabs --output-dir=$(srcdir) --force built-clean: cd @srcdir@ && rm -f $(BUILT_SOURCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/src/skels/group_option.h0000664000175000017500000000376412044757000015340 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef GROUP_OPTION_GEN_CLASS_H #define GROUP_OPTION_GEN_CLASS_H #include #include using std::string; using std::ostream; class group_option_gen_class { protected: string Comparison_rule; string group_name; string group_var_name; string number_required; string package_var_name; public: group_option_gen_class() { } group_option_gen_class(const string &_Comparison_rule, const string &_group_name, const string &_group_var_name, const string &_number_required, const string &_package_var_name) : Comparison_rule (_Comparison_rule), group_name (_group_name), group_var_name (_group_var_name), number_required (_number_required), package_var_name (_package_var_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_Comparison_rule(const string &_Comparison_rule) { Comparison_rule = _Comparison_rule; } void set_group_name(const string &_group_name) { group_name = _group_name; } void set_group_var_name(const string &_group_var_name) { group_var_name = _group_var_name; } void set_number_required(const string &_number_required) { number_required = _number_required; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void generate_group_option(ostream &stream, unsigned int indent = 0); }; #endif // GROUP_OPTION_GEN_CLASS_H gengetopt-2.22.6/src/skels/group_counter.cc0000664000175000017500000000131712044745036015643 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "group_counter.h" void group_counter_gen_class::generate_group_counter(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "int "; generate_string (group_name, stream, indent + indent_str.length ()); stream << "_"; generate_string (name, stream, indent + indent_str.length ()); stream << "_counter; /**< "; stream << "@"; stream << "brief Counter for "; generate_string (name, stream, indent + indent_str.length ()); stream << " "; generate_string (group_name, stream, indent + indent_str.length ()); stream << " */"; } gengetopt-2.22.6/src/skels/multiple_opt_list.cc0000664000175000017500000000067012044745036016521 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "multiple_opt_list.h" void multiple_opt_list_gen_class::generate_multiple_opt_list(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "struct generic_list * "; generate_string (arg_name, stream, indent + indent_str.length ()); stream << "_list = NULL;"; } gengetopt-2.22.6/src/skels/file_save.cc0000664000175000017500000000160312044745036014703 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "file_save.h" void file_save_gen_class::generate_file_save(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "if (args_info->"; generate_string (given, stream, indent + indent_str.length ()); stream << ")"; stream << "\n"; stream << indent_str; stream << " write_into_file(outfile, \""; generate_string (opt_name, stream, indent + indent_str.length ()); stream << "\", "; if (( arg == "" )) { stream << "0, 0 "; } else { stream << "args_info->"; generate_string (arg, stream, indent + indent_str.length ()); stream << ", "; generate_string (values, stream, indent + indent_str.length ()); } stream << ");"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/update_given.h0000664000175000017500000000236412044745036015267 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef UPDATE_GIVEN_GEN_CLASS_H #define UPDATE_GIVEN_GEN_CLASS_H #include #include using std::string; using std::ostream; class update_given_gen_class { protected: string option_var_name; public: update_given_gen_class() { } update_given_gen_class(const string &_option_var_name) : option_var_name (_option_var_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void generate_update_given(ostream &stream, unsigned int indent = 0); }; #endif // UPDATE_GIVEN_GEN_CLASS_H gengetopt-2.22.6/src/skels/free_string.h_skel0000664000175000017500000000021312044745036016131 00000000000000@IF@ has_string_type @THEN@ free_string_field (&(@structure@->@opt_var@_arg)); @ENDIF@ free_string_field (&(@structure@->@opt_var@_orig)); gengetopt-2.22.6/src/skels/clear_given.h_skel0000664000175000017500000000014212044745036016101 00000000000000@arg_struct@->@var_arg@_given = 0 ;@IF@ group @THEN@ @arg_struct@->@var_arg@_group = 0 ;@ENDIF@ gengetopt-2.22.6/src/skels/handle_help.h0000664000175000017500000000330112044745036015050 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef HANDLE_HELP_GEN_CLASS_H #define HANDLE_HELP_GEN_CLASS_H #include #include using std::string; using std::ostream; class handle_help_gen_class { protected: bool detailed_help; bool full_help; string parser_name; bool short_opt; public: handle_help_gen_class() : detailed_help (false), full_help (false), short_opt (false) { } handle_help_gen_class(bool _detailed_help, bool _full_help, const string &_parser_name, bool _short_opt) : detailed_help (_detailed_help), full_help (_full_help), parser_name (_parser_name), short_opt (_short_opt) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_detailed_help(bool _detailed_help) { detailed_help = _detailed_help; } void set_full_help(bool _full_help) { full_help = _full_help; } void set_parser_name(const string &_parser_name) { parser_name = _parser_name; } void set_short_opt(bool _short_opt) { short_opt = _short_opt; } void generate_handle_help(ostream &stream, unsigned int indent = 0); }; #endif // HANDLE_HELP_GEN_CLASS_H gengetopt-2.22.6/src/skels/handle_version.cc0000664000175000017500000000211312044745036015743 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "handle_version.h" void handle_version_gen_class::generate_handle_version(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (short_opt) { stream << "case 'V': /* Print version and exit. */"; stream << "\n"; stream << indent_str; } else { stream << "if (strcmp (long_options[option_index].name, \"version\") == 0) {"; stream << "\n"; stream << indent_str; } stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_version ();"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_free (&local_args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << " exit (EXIT_SUCCESS);"; if (( ! short_opt )) { stream << "\n"; stream << indent_str; stream << "}"; } } gengetopt-2.22.6/src/skels/print_help_string.h_skel0000664000175000017500000000017612044745036017364 00000000000000@IF@ shared @THEN@ @target@[@index@] = @IF@ last @THEN@ 0; @ELSE@ @from@[@full_index@];@endif@ @ELSE@ "@helpstring@", @ENDIF@ gengetopt-2.22.6/src/skels/init_args_info.h0000664000175000017500000000350712044745036015607 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef INIT_ARGS_INFO_GEN_CLASS_H #define INIT_ARGS_INFO_GEN_CLASS_H #include #include using std::string; using std::ostream; class init_args_info_gen_class { protected: string help_strings; string max; string min; bool multiple; string num; string var_arg; public: init_args_info_gen_class() : multiple (false) { } init_args_info_gen_class(const string &_help_strings, const string &_max, const string &_min, bool _multiple, const string &_num, const string &_var_arg) : help_strings (_help_strings), max (_max), min (_min), multiple (_multiple), num (_num), var_arg (_var_arg) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_help_strings(const string &_help_strings) { help_strings = _help_strings; } void set_max(const string &_max) { max = _max; } void set_min(const string &_min) { min = _min; } void set_multiple(bool _multiple) { multiple = _multiple; } void set_num(const string &_num) { num = _num; } void set_var_arg(const string &_var_arg) { var_arg = _var_arg; } void generate_init_args_info(ostream &stream, unsigned int indent = 0); }; #endif // INIT_ARGS_INFO_GEN_CLASS_H gengetopt-2.22.6/src/skels/init_args_info.cc0000664000175000017500000000225312044745036015742 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "init_args_info.h" void init_args_info_gen_class::generate_init_args_info(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "args_info->"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "_help = "; generate_string (help_strings, stream, indent + indent_str.length ()); stream << "["; generate_string (num, stream, indent + indent_str.length ()); stream << "] ;"; stream << "\n"; stream << indent_str; if (multiple) { stream << "args_info->"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "_min = "; generate_string (min, stream, indent + indent_str.length ()); stream << ";"; stream << "\n"; stream << indent_str; stream << "args_info->"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "_max = "; generate_string (max, stream, indent + indent_str.length ()); stream << ";"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/group_option.cc0000664000175000017500000000247612045003074015471 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "group_option.h" void group_option_gen_class::generate_group_option(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "if (args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_group_counter "; generate_string (Comparison_rule, stream, indent + indent_str.length ()); stream << ")"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %d options of group "; generate_string (group_name, stream, indent + indent_str.length ()); stream << " were given. "; generate_string (number_required, stream, indent + indent_str.length ()); stream << " is required%s.\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_group_counter, (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/update_given.cc0000664000175000017500000000136012044745036015420 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "update_given.h" void update_given_gen_class::generate_update_given(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given += local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given;"; stream << "\n"; stream << indent_str; stream << "local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given = 0;"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/generic_option.h0000664000175000017500000000775112044745036015626 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef GENERIC_OPTION_GEN_CLASS_H #define GENERIC_OPTION_GEN_CLASS_H #include #include using std::string; using std::ostream; class generic_option_gen_class { protected: string arg_type; string default_value; string final_instructions; string gen_else; string group_var_name; bool has_short_option; string long_option; bool multiple; string option_comment; bool option_has_group; bool option_has_mode; bool option_has_type; string option_var_name; string possible_values; string short_option; string structure; public: generic_option_gen_class() : has_short_option (false), multiple (false), option_has_group (false), option_has_mode (false), option_has_type (false) { } generic_option_gen_class(const string &_arg_type, const string &_default_value, const string &_final_instructions, const string &_gen_else, const string &_group_var_name, bool _has_short_option, const string &_long_option, bool _multiple, const string &_option_comment, bool _option_has_group, bool _option_has_mode, bool _option_has_type, const string &_option_var_name, const string &_possible_values, const string &_short_option, const string &_structure) : arg_type (_arg_type), default_value (_default_value), final_instructions (_final_instructions), gen_else (_gen_else), group_var_name (_group_var_name), has_short_option (_has_short_option), long_option (_long_option), multiple (_multiple), option_comment (_option_comment), option_has_group (_option_has_group), option_has_mode (_option_has_mode), option_has_type (_option_has_type), option_var_name (_option_var_name), possible_values (_possible_values), short_option (_short_option), structure (_structure) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg_type(const string &_arg_type) { arg_type = _arg_type; } void set_default_value(const string &_default_value) { default_value = _default_value; } void set_final_instructions(const string &_final_instructions) { final_instructions = _final_instructions; } void set_gen_else(const string &_gen_else) { gen_else = _gen_else; } void set_group_var_name(const string &_group_var_name) { group_var_name = _group_var_name; } void set_has_short_option(bool _has_short_option) { has_short_option = _has_short_option; } void set_long_option(const string &_long_option) { long_option = _long_option; } void set_multiple(bool _multiple) { multiple = _multiple; } void set_option_comment(const string &_option_comment) { option_comment = _option_comment; } void set_option_has_group(bool _option_has_group) { option_has_group = _option_has_group; } void set_option_has_mode(bool _option_has_mode) { option_has_mode = _option_has_mode; } void set_option_has_type(bool _option_has_type) { option_has_type = _option_has_type; } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void set_possible_values(const string &_possible_values) { possible_values = _possible_values; } void set_short_option(const string &_short_option) { short_option = _short_option; } void set_structure(const string &_structure) { structure = _structure; } void generate_generic_option(ostream &stream, unsigned int indent = 0); }; #endif // GENERIC_OPTION_GEN_CLASS_H gengetopt-2.22.6/src/skels/free_list.cc0000664000175000017500000000105212044745036014720 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "free_list.h" void free_list_gen_class::generate_free_list(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "free_list ("; generate_string (list_name, stream, indent + indent_str.length ()); stream << "_list, "; if (string_list) { stream << "1 "; } else { stream << "0 "; } stream << ");"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/custom_getopt_gen.cc0000664000175000017500000014705512044745036016507 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "custom_getopt_gen.h" void custom_getopt_gen_gen_class::generate_custom_getopt_gen(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Extracted from the glibc source tree, version 2.3.6"; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Licensed under the GPL as per the whole glibc source tree."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * This file was modified so that getopt_long can be called"; stream << "\n"; stream << indent_str; stream << " * many times without risking previous memory to be spoiled."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Modified by Andre Noll and Lorenzo Bettini for use in"; stream << "\n"; stream << indent_str; stream << " * GNU gengetopt generated files."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* "; stream << "\n"; stream << indent_str; stream << " * we must include anything we need since this file is not thought to be"; stream << "\n"; stream << indent_str; stream << " * inserted in a file already using getopt.h"; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Lorenzo"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "struct option"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " const char *name;"; stream << "\n"; stream << indent_str; stream << " /* has_arg can't be an enum because some compilers complain about"; stream << "\n"; stream << indent_str; stream << " type mismatches in all the code that assumes it is an int. */"; stream << "\n"; stream << indent_str; stream << " int has_arg;"; stream << "\n"; stream << indent_str; stream << " int *flag;"; stream << "\n"; stream << indent_str; stream << " int val;"; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* This version of `getopt' appears to the caller like standard Unix `getopt'"; stream << "\n"; stream << indent_str; stream << " but it behaves differently for the user, since it allows the user"; stream << "\n"; stream << indent_str; stream << " to intersperse the options with the other arguments."; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " As `getopt' works, it permutes the elements of ARGV so that,"; stream << "\n"; stream << indent_str; stream << " when it is done, all the options precede everything else. Thus"; stream << "\n"; stream << indent_str; stream << " all application programs are extended to handle flexible argument order."; stream << "\n"; stream << indent_str; stream << "*/"; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " If the field `flag' is not NULL, it points to a variable that is set"; stream << "\n"; stream << indent_str; stream << " to the value given in the field `val' when the option is found, but"; stream << "\n"; stream << indent_str; stream << " left unchanged if the option is not found."; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " To have a long-named option do something other than set an `int' to"; stream << "\n"; stream << indent_str; stream << " a compiled-in constant, such as set a value from `custom_optarg', set the"; stream << "\n"; stream << indent_str; stream << " option's `flag' field to zero and its `val' field to a nonzero"; stream << "\n"; stream << indent_str; stream << " value (the equivalent single-letter option character, if there is"; stream << "\n"; stream << indent_str; stream << " one). For long options that have a zero `flag' field, `getopt'"; stream << "\n"; stream << indent_str; stream << " returns the contents of the `val' field. */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* Names for the values of the `has_arg' field of `struct option'. */"; stream << "\n"; stream << indent_str; stream << "#ifndef no_argument"; stream << "\n"; stream << indent_str; stream << "#define no_argument 0"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef required_argument"; stream << "\n"; stream << indent_str; stream << "#define required_argument 1"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef optional_argument"; stream << "\n"; stream << indent_str; stream << "#define optional_argument 2"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "struct custom_getopt_data {"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * These have exactly the same meaning as the corresponding global variables,"; stream << "\n"; stream << indent_str; stream << " * except that they are used for the reentrant versions of getopt."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " int custom_optind;"; stream << "\n"; stream << indent_str; stream << " int custom_opterr;"; stream << "\n"; stream << indent_str; stream << " int custom_optopt;"; stream << "\n"; stream << indent_str; stream << " char *custom_optarg;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* True if the internal members have been initialized. */"; stream << "\n"; stream << indent_str; stream << " int initialized;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * The next char to be scanned in the option-element in which the last option"; stream << "\n"; stream << indent_str; stream << " * character we returned was found. This allows us to pick up the scan where"; stream << "\n"; stream << indent_str; stream << " * we left off. If this is zero, or a null string, it means resume the scan by"; stream << "\n"; stream << indent_str; stream << " * advancing to the next ARGV-element."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " char *nextchar;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Describe the part of ARGV that contains non-options that have been skipped."; stream << "\n"; stream << indent_str; stream << " * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is"; stream << "\n"; stream << indent_str; stream << " * the index after the last of them."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " int first_nonopt;"; stream << "\n"; stream << indent_str; stream << " int last_nonopt;"; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * the variables optarg, optind, opterr and optopt are renamed with"; stream << "\n"; stream << indent_str; stream << " * the custom_ prefix so that they don't interfere with getopt ones."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Moreover they're static so they are visible only from within the"; stream << "\n"; stream << indent_str; stream << " * file where this very file will be included."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an"; stream << "\n"; stream << indent_str; stream << " * option that takes an argument, the argument value is returned here."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static char *custom_optarg;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Index in ARGV of the next element to be scanned. This is used for"; stream << "\n"; stream << indent_str; stream << " * communication to and from the caller and for communication between"; stream << "\n"; stream << indent_str; stream << " * successive calls to `custom_getopt'."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * On entry to `custom_getopt', 1 means this is the first call; initialize."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * When `custom_getopt' returns -1, this is the index of the first of the non-option"; stream << "\n"; stream << indent_str; stream << " * elements that the caller should itself scan."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV"; stream << "\n"; stream << indent_str; stream << " * has been scanned so far."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * 1003.2 says this must be 1 before any call."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static int custom_optind = 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Callers store zero here to inhibit the error message for unrecognized"; stream << "\n"; stream << indent_str; stream << " * options."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static int custom_opterr = 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Set to an option character which was unrecognized. This must be initialized"; stream << "\n"; stream << indent_str; stream << " * on some systems to avoid linking in the system's own getopt implementation."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static int custom_optopt = '?';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Exchange two adjacent subsequences of ARGV. One subsequence is elements"; stream << "\n"; stream << indent_str; stream << " * [first_nonopt,last_nonopt) which contains all the non-options that have been"; stream << "\n"; stream << indent_str; stream << " * skipped so far. The other is elements [last_nonopt,custom_optind), which contains"; stream << "\n"; stream << indent_str; stream << " * all the options processed since those non-options were skipped."; stream << "\n"; stream << indent_str; stream << " * `first_nonopt' and `last_nonopt' are relocated so that they describe the new"; stream << "\n"; stream << indent_str; stream << " * indices of the non-options in ARGV after they are moved."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static void exchange(char **argv, struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int bottom = d->first_nonopt;"; stream << "\n"; stream << indent_str; stream << " int middle = d->last_nonopt;"; stream << "\n"; stream << indent_str; stream << " int top = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " char *tem;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Exchange the shorter segment with the far end of the longer segment."; stream << "\n"; stream << indent_str; stream << " * That puts the shorter segment into the right place. It leaves the"; stream << "\n"; stream << indent_str; stream << " * longer segment in the right place overall, but it consists of two"; stream << "\n"; stream << indent_str; stream << " * parts that need to be swapped next."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " while (top > middle && middle > bottom) {"; stream << "\n"; stream << indent_str; stream << " if (top - middle > middle - bottom) {"; stream << "\n"; stream << indent_str; stream << " /* Bottom segment is the short one. */"; stream << "\n"; stream << indent_str; stream << " int len = middle - bottom;"; stream << "\n"; stream << indent_str; stream << " int i;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* Swap it with the top part of the top segment. */"; stream << "\n"; stream << indent_str; stream << " for (i = 0; i < len; i++) {"; stream << "\n"; stream << indent_str; stream << " tem = argv[bottom + i];"; stream << "\n"; stream << indent_str; stream << " argv[bottom + i] ="; stream << "\n"; stream << indent_str; stream << " argv[top - (middle - bottom) + i];"; stream << "\n"; stream << indent_str; stream << " argv[top - (middle - bottom) + i] = tem;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /* Exclude the moved bottom segment from further swapping. */"; stream << "\n"; stream << indent_str; stream << " top -= len;"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " /* Top segment is the short one. */"; stream << "\n"; stream << indent_str; stream << " int len = top - middle;"; stream << "\n"; stream << indent_str; stream << " int i;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* Swap it with the bottom part of the bottom segment. */"; stream << "\n"; stream << indent_str; stream << " for (i = 0; i < len; i++) {"; stream << "\n"; stream << indent_str; stream << " tem = argv[bottom + i];"; stream << "\n"; stream << indent_str; stream << " argv[bottom + i] = argv[middle + i];"; stream << "\n"; stream << indent_str; stream << " argv[middle + i] = tem;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /* Exclude the moved top segment from further swapping. */"; stream << "\n"; stream << indent_str; stream << " bottom += len;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /* Update records for the slots the non-options now occupy. */"; stream << "\n"; stream << indent_str; stream << " d->first_nonopt += (d->custom_optind - d->last_nonopt);"; stream << "\n"; stream << indent_str; stream << " d->last_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* Initialize the internal data when the first call is made. */"; stream << "\n"; stream << indent_str; stream << "static void custom_getopt_initialize(struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Start processing options with ARGV-element 1 (since ARGV-element 0"; stream << "\n"; stream << indent_str; stream << " * is the program name); the sequence of previously skipped non-option"; stream << "\n"; stream << indent_str; stream << " * ARGV-elements is empty."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " d->first_nonopt = d->last_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " d->nextchar = NULL;"; stream << "\n"; stream << indent_str; stream << " d->initialized = 1;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\\0')"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* return: zero: continue, nonzero: return given value to user */"; stream << "\n"; stream << indent_str; stream << "static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,"; stream << "\n"; stream << indent_str; stream << " struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been"; stream << "\n"; stream << indent_str; stream << " * moved back by the user (who may also have changed the arguments)."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->last_nonopt > d->custom_optind)"; stream << "\n"; stream << indent_str; stream << " d->last_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " if (d->first_nonopt > d->custom_optind)"; stream << "\n"; stream << indent_str; stream << " d->first_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * If we have just processed some options following some"; stream << "\n"; stream << indent_str; stream << " * non-options, exchange them so that the options come first."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->first_nonopt != d->last_nonopt &&"; stream << "\n"; stream << indent_str; stream << " d->last_nonopt != d->custom_optind)"; stream << "\n"; stream << indent_str; stream << " exchange((char **) argv, d);"; stream << "\n"; stream << indent_str; stream << " else if (d->last_nonopt != d->custom_optind)"; stream << "\n"; stream << indent_str; stream << " d->first_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Skip any additional non-options and extend the range of"; stream << "\n"; stream << indent_str; stream << " * non-options previously skipped."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " while (d->custom_optind < argc && NONOPTION_P)"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " d->last_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * The special ARGV-element `--' means premature end of options. Skip"; stream << "\n"; stream << indent_str; stream << " * it like a null option, then exchange with previous non-options as if"; stream << "\n"; stream << indent_str; stream << " * it were an option, then skip everything else like a non-option."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], \"--\")) {"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " if (d->first_nonopt != d->last_nonopt"; stream << "\n"; stream << indent_str; stream << " && d->last_nonopt != d->custom_optind)"; stream << "\n"; stream << indent_str; stream << " exchange((char **) argv, d);"; stream << "\n"; stream << indent_str; stream << " else if (d->first_nonopt == d->last_nonopt)"; stream << "\n"; stream << indent_str; stream << " d->first_nonopt = d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " d->last_nonopt = argc;"; stream << "\n"; stream << indent_str; stream << " d->custom_optind = argc;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * If we have done all the ARGV-elements, stop the scan and back over"; stream << "\n"; stream << indent_str; stream << " * any non-options that we skipped and permuted."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->custom_optind == argc) {"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Set the next-arg-index to point at the non-options that we"; stream << "\n"; stream << indent_str; stream << " * previously skipped, so the caller will digest them."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->first_nonopt != d->last_nonopt)"; stream << "\n"; stream << indent_str; stream << " d->custom_optind = d->first_nonopt;"; stream << "\n"; stream << indent_str; stream << " return -1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * If we have come to a non-option and did not permute it, either stop"; stream << "\n"; stream << indent_str; stream << " * the scan or describe it to the caller and pass it by."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (NONOPTION_P) {"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = argv[d->custom_optind++];"; stream << "\n"; stream << indent_str; stream << " return 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * We have found another option-ARGV-element. Skip the initial"; stream << "\n"; stream << indent_str; stream << " * punctuation."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Check whether the ARGV-element is a long option."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If there's a long option \"fubar\" and the ARGV-element is \"-fu\", consider"; stream << "\n"; stream << indent_str; stream << " * that an abbreviation of the long option, just like \"--fu\", and not \"-f\" with"; stream << "\n"; stream << indent_str; stream << " * arg \"u\"."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * This distinction seems to be the most useful approach."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static int check_long_opt(int argc, char *const *argv, const char *optstring,"; stream << "\n"; stream << indent_str; stream << " const struct option *longopts, int *longind,"; stream << "\n"; stream << indent_str; stream << " int print_errors, struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char *nameend;"; stream << "\n"; stream << indent_str; stream << " const struct option *p;"; stream << "\n"; stream << indent_str; stream << " const struct option *pfound = NULL;"; stream << "\n"; stream << indent_str; stream << " int exact = 0;"; stream << "\n"; stream << indent_str; stream << " int ambig = 0;"; stream << "\n"; stream << indent_str; stream << " int indfound = -1;"; stream << "\n"; stream << indent_str; stream << " int option_index;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)"; stream << "\n"; stream << indent_str; stream << " /* Do nothing. */ ;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* Test all long options for either exact match or abbreviated matches */"; stream << "\n"; stream << indent_str; stream << " for (p = longopts, option_index = 0; p->name; p++, option_index++)"; stream << "\n"; stream << indent_str; stream << " if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {"; stream << "\n"; stream << indent_str; stream << " if ((unsigned int) (nameend - d->nextchar)"; stream << "\n"; stream << indent_str; stream << " == (unsigned int) strlen(p->name)) {"; stream << "\n"; stream << indent_str; stream << " /* Exact match found. */"; stream << "\n"; stream << indent_str; stream << " pfound = p;"; stream << "\n"; stream << indent_str; stream << " indfound = option_index;"; stream << "\n"; stream << indent_str; stream << " exact = 1;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " } else if (pfound == NULL) {"; stream << "\n"; stream << indent_str; stream << " /* First nonexact match found. */"; stream << "\n"; stream << indent_str; stream << " pfound = p;"; stream << "\n"; stream << indent_str; stream << " indfound = option_index;"; stream << "\n"; stream << indent_str; stream << " } else if (pfound->has_arg != p->has_arg"; stream << "\n"; stream << indent_str; stream << " || pfound->flag != p->flag"; stream << "\n"; stream << indent_str; stream << " || pfound->val != p->val)"; stream << "\n"; stream << indent_str; stream << " /* Second or later nonexact match found. */"; stream << "\n"; stream << indent_str; stream << " ambig = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (ambig && !exact) {"; stream << "\n"; stream << indent_str; stream << " if (print_errors) {"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s: option `%s' is ambiguous\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], argv[d->custom_optind]);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->nextchar += strlen(d->nextchar);"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = 0;"; stream << "\n"; stream << indent_str; stream << " return '?';"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (pfound) {"; stream << "\n"; stream << indent_str; stream << " option_index = indfound;"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " if (*nameend) {"; stream << "\n"; stream << indent_str; stream << " if (pfound->has_arg != no_argument)"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = nameend + 1;"; stream << "\n"; stream << indent_str; stream << " else {"; stream << "\n"; stream << indent_str; stream << " if (print_errors) {"; stream << "\n"; stream << indent_str; stream << " if (argv[d->custom_optind - 1][1] == '-') {"; stream << "\n"; stream << indent_str; stream << " /* --option */"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s: option `--%s' doesn't allow an argument\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], pfound->name);"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " /* +option or -option */"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s: option `%c%s' doesn't allow an argument\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], argv[d->custom_optind - 1][0], pfound->name);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->nextchar += strlen(d->nextchar);"; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = pfound->val;"; stream << "\n"; stream << indent_str; stream << " return '?';"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " } else if (pfound->has_arg == required_argument) {"; stream << "\n"; stream << indent_str; stream << " if (d->custom_optind < argc)"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = argv[d->custom_optind++];"; stream << "\n"; stream << indent_str; stream << " else {"; stream << "\n"; stream << indent_str; stream << " if (print_errors) {"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s: option `%s' requires an argument\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0],"; stream << "\n"; stream << indent_str; stream << " argv[d->custom_optind - 1]);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->nextchar += strlen(d->nextchar);"; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = pfound->val;"; stream << "\n"; stream << indent_str; stream << " return optstring[0] == ':' ? ':' : '?';"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->nextchar += strlen(d->nextchar);"; stream << "\n"; stream << indent_str; stream << " if (longind != NULL)"; stream << "\n"; stream << indent_str; stream << " *longind = option_index;"; stream << "\n"; stream << indent_str; stream << " if (pfound->flag) {"; stream << "\n"; stream << indent_str; stream << " *(pfound->flag) = pfound->val;"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " return pfound->val;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * Can't find it as a long option. If this is not getopt_long_only, or"; stream << "\n"; stream << indent_str; stream << " * the option starts with '--' or is not a valid short option, then"; stream << "\n"; stream << indent_str; stream << " * it's an error. Otherwise interpret it as a short option."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (print_errors) {"; stream << "\n"; stream << indent_str; stream << " if (argv[d->custom_optind][1] == '-') {"; stream << "\n"; stream << indent_str; stream << " /* --option */"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s: unrecognized option `--%s'\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], d->nextchar);"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " /* +option or -option */"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s: unrecognized option `%c%s'\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], argv[d->custom_optind][0],"; stream << "\n"; stream << indent_str; stream << " d->nextchar);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->nextchar = (char *) \"\";"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = 0;"; stream << "\n"; stream << indent_str; stream << " return '?';"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int check_short_opt(int argc, char *const *argv, const char *optstring,"; stream << "\n"; stream << indent_str; stream << " int print_errors, struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char c = *d->nextchar++;"; stream << "\n"; stream << indent_str; stream << " const char *temp = strchr(optstring, c);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* Increment `custom_optind' when we start to process its last character. */"; stream << "\n"; stream << indent_str; stream << " if (*d->nextchar == '\\0')"; stream << "\n"; stream << indent_str; stream << " ++d->custom_optind;"; stream << "\n"; stream << indent_str; stream << " if (!temp || c == ':') {"; stream << "\n"; stream << indent_str; stream << " if (print_errors)"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s: invalid option -- %c\\n\", argv[0], c);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = c;"; stream << "\n"; stream << indent_str; stream << " return '?';"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (temp[1] == ':') {"; stream << "\n"; stream << indent_str; stream << " if (temp[2] == ':') {"; stream << "\n"; stream << indent_str; stream << " /* This is an option that accepts an argument optionally. */"; stream << "\n"; stream << indent_str; stream << " if (*d->nextchar != '\\0') {"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = d->nextchar;"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " } else"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = NULL;"; stream << "\n"; stream << indent_str; stream << " d->nextchar = NULL;"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " /* This is an option that requires an argument. */"; stream << "\n"; stream << indent_str; stream << " if (*d->nextchar != '\\0') {"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = d->nextchar;"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * If we end this ARGV-element by taking the"; stream << "\n"; stream << indent_str; stream << " * rest as an arg, we must advance to the next"; stream << "\n"; stream << indent_str; stream << " * element now."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " d->custom_optind++;"; stream << "\n"; stream << indent_str; stream << " } else if (d->custom_optind == argc) {"; stream << "\n"; stream << indent_str; stream << " if (print_errors) {"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s: option requires an argument -- %c\\n\","; stream << "\n"; stream << indent_str; stream << " argv[0], c);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " d->custom_optopt = c;"; stream << "\n"; stream << indent_str; stream << " if (optstring[0] == ':')"; stream << "\n"; stream << indent_str; stream << " c = ':';"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " c = '?';"; stream << "\n"; stream << indent_str; stream << " } else"; stream << "\n"; stream << indent_str; stream << " /*"; stream << "\n"; stream << indent_str; stream << " * We already incremented `custom_optind' once;"; stream << "\n"; stream << indent_str; stream << " * increment it again when taking next ARGV-elt"; stream << "\n"; stream << indent_str; stream << " * as argument."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = argv[d->custom_optind++];"; stream << "\n"; stream << indent_str; stream << " d->nextchar = NULL;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " return c;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/*"; stream << "\n"; stream << indent_str; stream << " * Scan elements of ARGV for option characters given in OPTSTRING."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If an element of ARGV starts with '-', and is not exactly \"-\" or \"--\","; stream << "\n"; stream << indent_str; stream << " * then it is an option element. The characters of this element"; stream << "\n"; stream << indent_str; stream << " * (aside from the initial '-') are option characters. If `getopt'"; stream << "\n"; stream << indent_str; stream << " * is called repeatedly, it returns successively each of the option characters"; stream << "\n"; stream << indent_str; stream << " * from each of the option elements."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If `getopt' finds another option character, it returns that character,"; stream << "\n"; stream << indent_str; stream << " * updating `custom_optind' and `nextchar' so that the next call to `getopt' can"; stream << "\n"; stream << indent_str; stream << " * resume the scan with the following option character or ARGV-element."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If there are no more option characters, `getopt' returns -1."; stream << "\n"; stream << indent_str; stream << " * Then `custom_optind' is the index in ARGV of the first ARGV-element"; stream << "\n"; stream << indent_str; stream << " * that is not an option. (The ARGV-elements have been permuted"; stream << "\n"; stream << indent_str; stream << " * so that those that are not options now come last.)"; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * OPTSTRING is a string containing the legitimate option characters."; stream << "\n"; stream << indent_str; stream << " * If an option character is seen that is not listed in OPTSTRING,"; stream << "\n"; stream << indent_str; stream << " * return '?' after printing an error message. If you set `custom_opterr' to"; stream << "\n"; stream << indent_str; stream << " * zero, the error message is suppressed but we still return '?'."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If a char in OPTSTRING is followed by a colon, that means it wants an arg,"; stream << "\n"; stream << indent_str; stream << " * so the following text in the same ARGV-element, or the text of the following"; stream << "\n"; stream << indent_str; stream << " * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that"; stream << "\n"; stream << indent_str; stream << " * wants an optional arg; if there is text in the current ARGV-element,"; stream << "\n"; stream << indent_str; stream << " * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If OPTSTRING starts with `-' or `+', it requests different methods of"; stream << "\n"; stream << indent_str; stream << " * handling the non-option ARGV-elements."; stream << "\n"; stream << indent_str; stream << " * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Long-named options begin with `--' instead of `-'."; stream << "\n"; stream << indent_str; stream << " * Their names may be abbreviated as long as the abbreviation is unique"; stream << "\n"; stream << indent_str; stream << " * or is an exact match for some defined option. If they have an"; stream << "\n"; stream << indent_str; stream << " * argument, it follows the option name in the same ARGV-element, separated"; stream << "\n"; stream << indent_str; stream << " * from the option name by a `=', or else the in next ARGV-element."; stream << "\n"; stream << indent_str; stream << " * When `getopt' finds a long-named option, it returns 0 if that option's"; stream << "\n"; stream << indent_str; stream << " * `flag' field is nonzero, the value of the option's `val' field"; stream << "\n"; stream << indent_str; stream << " * if the `flag' field is zero."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * The elements of ARGV aren't really const, because we permute them."; stream << "\n"; stream << indent_str; stream << " * But we pretend they're const in the prototype to be compatible"; stream << "\n"; stream << indent_str; stream << " * with other systems."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * LONGOPTS is a vector of `struct option' terminated by an"; stream << "\n"; stream << indent_str; stream << " * element containing a name which is zero."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * LONGIND returns the index in LONGOPT of the long-named option found."; stream << "\n"; stream << indent_str; stream << " * It is only valid when a long-named option has been found by the most"; stream << "\n"; stream << indent_str; stream << " * recent call."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * Return the option character from OPTS just read. Return -1 when there are"; stream << "\n"; stream << indent_str; stream << " * no more options. For unrecognized options, or options missing arguments,"; stream << "\n"; stream << indent_str; stream << " * `custom_optopt' is set to the option letter, and '?' is returned."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * The OPTS string is a list of characters which are recognized option letters,"; stream << "\n"; stream << indent_str; stream << " * optionally followed by colons, specifying that that letter takes an"; stream << "\n"; stream << indent_str; stream << " * argument, to be placed in `custom_optarg'."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * If a letter in OPTS is followed by two colons, its argument is optional."; stream << "\n"; stream << indent_str; stream << " * This behavior is specific to the GNU `getopt'."; stream << "\n"; stream << indent_str; stream << " *"; stream << "\n"; stream << indent_str; stream << " * The argument `--' causes premature termination of argument scanning,"; stream << "\n"; stream << indent_str; stream << " * explicitly telling `getopt' that there are no more options. If OPTS begins"; stream << "\n"; stream << indent_str; stream << " * with `--', then non-option arguments are treated as arguments to the option"; stream << "\n"; stream << indent_str; stream << " * '\\0'. This behavior is specific to the GNU `getopt'."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int getopt_internal_r(int argc, char *const *argv, const char *optstring,"; stream << "\n"; stream << indent_str; stream << " const struct option *longopts, int *longind,"; stream << "\n"; stream << indent_str; stream << " struct custom_getopt_data *d)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int ret, print_errors = d->custom_opterr;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (optstring[0] == ':')"; stream << "\n"; stream << indent_str; stream << " print_errors = 0;"; stream << "\n"; stream << indent_str; stream << " if (argc < 1)"; stream << "\n"; stream << indent_str; stream << " return -1;"; stream << "\n"; stream << indent_str; stream << " d->custom_optarg = NULL;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* "; stream << "\n"; stream << indent_str; stream << " * This is a big difference with GNU getopt, since optind == 0"; stream << "\n"; stream << indent_str; stream << " * means initialization while here 1 means first call."; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << " if (d->custom_optind == 0 || !d->initialized) {"; stream << "\n"; stream << indent_str; stream << " if (d->custom_optind == 0)"; stream << "\n"; stream << indent_str; stream << " d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */"; stream << "\n"; stream << indent_str; stream << " custom_getopt_initialize(d);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (d->nextchar == NULL || *d->nextchar == '\\0') {"; stream << "\n"; stream << indent_str; stream << " ret = shuffle_argv(argc, argv, longopts, d);"; stream << "\n"; stream << indent_str; stream << " if (ret)"; stream << "\n"; stream << indent_str; stream << " return ret;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (longopts && (argv[d->custom_optind][1] == '-' ))"; stream << "\n"; stream << indent_str; stream << " return check_long_opt(argc, argv, optstring, longopts,"; stream << "\n"; stream << indent_str; stream << " longind, print_errors, d);"; stream << "\n"; stream << indent_str; stream << " return check_short_opt(argc, argv, optstring, print_errors, d);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,"; stream << "\n"; stream << indent_str; stream << " const struct option *longopts, int *longind)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int result;"; stream << "\n"; stream << indent_str; stream << " /* Keep a global copy of all internal members of d */"; stream << "\n"; stream << indent_str; stream << " static struct custom_getopt_data d;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " d.custom_optind = custom_optind;"; stream << "\n"; stream << indent_str; stream << " d.custom_opterr = custom_opterr;"; stream << "\n"; stream << indent_str; stream << " result = getopt_internal_r(argc, argv, optstring, longopts,"; stream << "\n"; stream << indent_str; stream << " longind, &d);"; stream << "\n"; stream << indent_str; stream << " custom_optind = d.custom_optind;"; stream << "\n"; stream << indent_str; stream << " custom_optarg = d.custom_optarg;"; stream << "\n"; stream << indent_str; stream << " custom_optopt = d.custom_optopt;"; stream << "\n"; stream << indent_str; stream << " return result;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int custom_getopt_long (int argc, char *const *argv, const char *options,"; stream << "\n"; stream << indent_str; stream << " const struct option *long_options, int *opt_index)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " return custom_getopt_internal(argc, argv, options, long_options,"; stream << "\n"; stream << indent_str; stream << " opt_index);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/exit_failure.h_skel0000664000175000017500000000022112044745036016301 00000000000000@IF@ handle_error @THEN@ if (result == EXIT_FAILURE) { @parser_name@_free (args_info); exit (EXIT_FAILURE); } @ENDIF@ return result;gengetopt-2.22.6/src/skels/file_save.h0000664000175000017500000000301512044745036014544 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef FILE_SAVE_GEN_CLASS_H #define FILE_SAVE_GEN_CLASS_H #include #include using std::string; using std::ostream; class file_save_gen_class { protected: string arg; string given; string opt_name; string values; public: file_save_gen_class() { } file_save_gen_class(const string &_arg, const string &_given, const string &_opt_name, const string &_values) : arg (_arg), given (_given), opt_name (_opt_name), values (_values) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg(const string &_arg) { arg = _arg; } void set_given(const string &_given) { given = _given; } void set_opt_name(const string &_opt_name) { opt_name = _opt_name; } void set_values(const string &_values) { values = _values; } void generate_file_save(ostream &stream, unsigned int indent = 0); }; #endif // FILE_SAVE_GEN_CLASS_H gengetopt-2.22.6/src/skels/enum_decl.h0000664000175000017500000000251112044745036014542 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef ENUM_DECL_GEN_CLASS_H #define ENUM_DECL_GEN_CLASS_H #include #include using std::string; using std::ostream; class enum_decl_gen_class { protected: string enum_values; string var_arg; public: enum_decl_gen_class() { } enum_decl_gen_class(const string &_enum_values, const string &_var_arg) : enum_values (_enum_values), var_arg (_var_arg) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_enum_values(const string &_enum_values) { enum_values = _enum_values; } void set_var_arg(const string &_var_arg) { var_arg = _var_arg; } void generate_enum_decl(ostream &stream, unsigned int indent = 0); }; #endif // ENUM_DECL_GEN_CLASS_H gengetopt-2.22.6/src/skels/custom_getopt_gen.h_skel0000664000175000017500000004562612044745036017370 00000000000000/* * Extracted from the glibc source tree, version 2.3.6 * * Licensed under the GPL as per the whole glibc source tree. * * This file was modified so that getopt_long can be called * many times without risking previous memory to be spoiled. * * Modified by Andre Noll and Lorenzo Bettini for use in * GNU gengetopt generated files. * */ /* * we must include anything we need since this file is not thought to be * inserted in a file already using getopt.h * * Lorenzo */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. */ /* If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `custom_optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ /* Names for the values of the `has_arg' field of `struct option'. */ #ifndef no_argument #define no_argument 0 #endif #ifndef required_argument #define required_argument 1 #endif #ifndef optional_argument #define optional_argument 2 #endif struct custom_getopt_data { /* * These have exactly the same meaning as the corresponding global variables, * except that they are used for the reentrant versions of getopt. */ int custom_optind; int custom_opterr; int custom_optopt; char *custom_optarg; /* True if the internal members have been initialized. */ int initialized; /* * The next char to be scanned in the option-element in which the last option * character we returned was found. This allows us to pick up the scan where * we left off. If this is zero, or a null string, it means resume the scan by * advancing to the next ARGV-element. */ char *nextchar; /* * Describe the part of ARGV that contains non-options that have been skipped. * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is * the index after the last of them. */ int first_nonopt; int last_nonopt; }; /* * the variables optarg, optind, opterr and optopt are renamed with * the custom_ prefix so that they don't interfere with getopt ones. * * Moreover they're static so they are visible only from within the * file where this very file will be included. */ /* * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an * option that takes an argument, the argument value is returned here. */ static char *custom_optarg; /* * Index in ARGV of the next element to be scanned. This is used for * communication to and from the caller and for communication between * successive calls to `custom_getopt'. * * On entry to `custom_getopt', 1 means this is the first call; initialize. * * When `custom_getopt' returns -1, this is the index of the first of the non-option * elements that the caller should itself scan. * * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV * has been scanned so far. * * 1003.2 says this must be 1 before any call. */ static int custom_optind = 1; /* * Callers store zero here to inhibit the error message for unrecognized * options. */ static int custom_opterr = 1; /* * Set to an option character which was unrecognized. This must be initialized * on some systems to avoid linking in the system's own getopt implementation. */ static int custom_optopt = '?'; /* * Exchange two adjacent subsequences of ARGV. One subsequence is elements * [first_nonopt,last_nonopt) which contains all the non-options that have been * skipped so far. The other is elements [last_nonopt,custom_optind), which contains * all the options processed since those non-options were skipped. * `first_nonopt' and `last_nonopt' are relocated so that they describe the new * indices of the non-options in ARGV after they are moved. */ static void exchange(char **argv, struct custom_getopt_data *d) { int bottom = d->first_nonopt; int middle = d->last_nonopt; int top = d->custom_optind; char *tem; /* * Exchange the shorter segment with the far end of the longer segment. * That puts the shorter segment into the right place. It leaves the * longer segment in the right place overall, but it consists of two * parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->first_nonopt += (d->custom_optind - d->last_nonopt); d->last_nonopt = d->custom_optind; } /* Initialize the internal data when the first call is made. */ static void custom_getopt_initialize(struct custom_getopt_data *d) { /* * Start processing options with ARGV-element 1 (since ARGV-element 0 * is the program name); the sequence of previously skipped non-option * ARGV-elements is empty. */ d->first_nonopt = d->last_nonopt = d->custom_optind; d->nextchar = NULL; d->initialized = 1; } #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0') /* return: zero: continue, nonzero: return given value to user */ static int shuffle_argv(int argc, char *const *argv,const struct option *longopts, struct custom_getopt_data *d) { /* * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been * moved back by the user (who may also have changed the arguments). */ if (d->last_nonopt > d->custom_optind) d->last_nonopt = d->custom_optind; if (d->first_nonopt > d->custom_optind) d->first_nonopt = d->custom_optind; /* * If we have just processed some options following some * non-options, exchange them so that the options come first. */ if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->last_nonopt != d->custom_optind) d->first_nonopt = d->custom_optind; /* * Skip any additional non-options and extend the range of * non-options previously skipped. */ while (d->custom_optind < argc && NONOPTION_P) d->custom_optind++; d->last_nonopt = d->custom_optind; /* * The special ARGV-element `--' means premature end of options. Skip * it like a null option, then exchange with previous non-options as if * it were an option, then skip everything else like a non-option. */ if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) { d->custom_optind++; if (d->first_nonopt != d->last_nonopt && d->last_nonopt != d->custom_optind) exchange((char **) argv, d); else if (d->first_nonopt == d->last_nonopt) d->first_nonopt = d->custom_optind; d->last_nonopt = argc; d->custom_optind = argc; } /* * If we have done all the ARGV-elements, stop the scan and back over * any non-options that we skipped and permuted. */ if (d->custom_optind == argc) { /* * Set the next-arg-index to point at the non-options that we * previously skipped, so the caller will digest them. */ if (d->first_nonopt != d->last_nonopt) d->custom_optind = d->first_nonopt; return -1; } /* * If we have come to a non-option and did not permute it, either stop * the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { d->custom_optarg = argv[d->custom_optind++]; return 1; } /* * We have found another option-ARGV-element. Skip the initial * punctuation. */ d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-')); return 0; } /* * Check whether the ARGV-element is a long option. * * If there's a long option "fubar" and the ARGV-element is "-fu", consider * that an abbreviation of the long option, just like "--fu", and not "-f" with * arg "u". * * This distinction seems to be the most useful approach. * */ static int check_long_opt(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int print_errors, struct custom_getopt_data *d) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) { if ((unsigned int) (nameend - d->nextchar) == (unsigned int) strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { fprintf(stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[d->custom_optind]); } d->nextchar += strlen(d->nextchar); d->custom_optind++; d->custom_optopt = 0; return '?'; } if (pfound) { option_index = indfound; d->custom_optind++; if (*nameend) { if (pfound->has_arg != no_argument) d->custom_optarg = nameend + 1; else { if (print_errors) { if (argv[d->custom_optind - 1][1] == '-') { /* --option */ fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); } else { /* +option or -option */ fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[d->custom_optind - 1][0], pfound->name); } } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return '?'; } } else if (pfound->has_arg == required_argument) { if (d->custom_optind < argc) d->custom_optarg = argv[d->custom_optind++]; else { if (print_errors) { fprintf(stderr, "%s: option `%s' requires an argument\n", argv[0], argv[d->custom_optind - 1]); } d->nextchar += strlen(d->nextchar); d->custom_optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->nextchar += strlen(d->nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* * Can't find it as a long option. If this is not getopt_long_only, or * the option starts with '--' or is not a valid short option, then * it's an error. Otherwise interpret it as a short option. */ if (print_errors) { if (argv[d->custom_optind][1] == '-') { /* --option */ fprintf(stderr, "%s: unrecognized option `--%s'\n", argv[0], d->nextchar); } else { /* +option or -option */ fprintf(stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[d->custom_optind][0], d->nextchar); } } d->nextchar = (char *) ""; d->custom_optind++; d->custom_optopt = 0; return '?'; } static int check_short_opt(int argc, char *const *argv, const char *optstring, int print_errors, struct custom_getopt_data *d) { char c = *d->nextchar++; const char *temp = strchr(optstring, c); /* Increment `custom_optind' when we start to process its last character. */ if (*d->nextchar == '\0') ++d->custom_optind; if (!temp || c == ':') { if (print_errors) fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); d->custom_optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; d->custom_optind++; } else d->custom_optarg = NULL; d->nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->nextchar != '\0') { d->custom_optarg = d->nextchar; /* * If we end this ARGV-element by taking the * rest as an arg, we must advance to the next * element now. */ d->custom_optind++; } else if (d->custom_optind == argc) { if (print_errors) { fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c); } d->custom_optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* * We already incremented `custom_optind' once; * increment it again when taking next ARGV-elt * as argument. */ d->custom_optarg = argv[d->custom_optind++]; d->nextchar = NULL; } } return c; } /* * Scan elements of ARGV for option characters given in OPTSTRING. * * If an element of ARGV starts with '-', and is not exactly "-" or "--", * then it is an option element. The characters of this element * (aside from the initial '-') are option characters. If `getopt' * is called repeatedly, it returns successively each of the option characters * from each of the option elements. * * If `getopt' finds another option character, it returns that character, * updating `custom_optind' and `nextchar' so that the next call to `getopt' can * resume the scan with the following option character or ARGV-element. * * If there are no more option characters, `getopt' returns -1. * Then `custom_optind' is the index in ARGV of the first ARGV-element * that is not an option. (The ARGV-elements have been permuted * so that those that are not options now come last.) * * OPTSTRING is a string containing the legitimate option characters. * If an option character is seen that is not listed in OPTSTRING, * return '?' after printing an error message. If you set `custom_opterr' to * zero, the error message is suppressed but we still return '?'. * * If a char in OPTSTRING is followed by a colon, that means it wants an arg, * so the following text in the same ARGV-element, or the text of the following * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that * wants an optional arg; if there is text in the current ARGV-element, * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero. * * If OPTSTRING starts with `-' or `+', it requests different methods of * handling the non-option ARGV-elements. * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. * * Long-named options begin with `--' instead of `-'. * Their names may be abbreviated as long as the abbreviation is unique * or is an exact match for some defined option. If they have an * argument, it follows the option name in the same ARGV-element, separated * from the option name by a `=', or else the in next ARGV-element. * When `getopt' finds a long-named option, it returns 0 if that option's * `flag' field is nonzero, the value of the option's `val' field * if the `flag' field is zero. * * The elements of ARGV aren't really const, because we permute them. * But we pretend they're const in the prototype to be compatible * with other systems. * * LONGOPTS is a vector of `struct option' terminated by an * element containing a name which is zero. * * LONGIND returns the index in LONGOPT of the long-named option found. * It is only valid when a long-named option has been found by the most * recent call. * * Return the option character from OPTS just read. Return -1 when there are * no more options. For unrecognized options, or options missing arguments, * `custom_optopt' is set to the option letter, and '?' is returned. * * The OPTS string is a list of characters which are recognized option letters, * optionally followed by colons, specifying that that letter takes an * argument, to be placed in `custom_optarg'. * * If a letter in OPTS is followed by two colons, its argument is optional. * This behavior is specific to the GNU `getopt'. * * The argument `--' causes premature termination of argument scanning, * explicitly telling `getopt' that there are no more options. If OPTS begins * with `--', then non-option arguments are treated as arguments to the option * '\0'. This behavior is specific to the GNU `getopt'. */ static int getopt_internal_r(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, struct custom_getopt_data *d) { int ret, print_errors = d->custom_opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->custom_optarg = NULL; /* * This is a big difference with GNU getopt, since optind == 0 * means initialization while here 1 means first call. */ if (d->custom_optind == 0 || !d->initialized) { if (d->custom_optind == 0) d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */ custom_getopt_initialize(d); } if (d->nextchar == NULL || *d->nextchar == '\0') { ret = shuffle_argv(argc, argv, longopts, d); if (ret) return ret; } if (longopts && (argv[d->custom_optind][1] == '-' )) return check_long_opt(argc, argv, optstring, longopts, longind, print_errors, d); return check_short_opt(argc, argv, optstring, print_errors, d); } static int custom_getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind) { int result; /* Keep a global copy of all internal members of d */ static struct custom_getopt_data d; d.custom_optind = custom_optind; d.custom_opterr = custom_opterr; result = getopt_internal_r(argc, argv, optstring, longopts, longind, &d); custom_optind = d.custom_optind; custom_optarg = d.custom_optarg; custom_optopt = d.custom_optopt; return result; } static int custom_getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return custom_getopt_internal(argc, argv, options, long_options, opt_index); } gengetopt-2.22.6/src/skels/dependant_option.h_skel0000664000175000017500000000041012045003074017141 00000000000000if (args_info->@option_var_name@_given && ! args_info->@dep_option@_given) { fprintf (stderr, "%s: @option_descr@ option depends on option '@dep_option_descr@'%s\n", @package_var_name@, (additional_error ? additional_error : "")); error_occurred = 1; }gengetopt-2.22.6/src/skels/header.h0000664000175000017500000001255012044745036014043 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef HEADER_GEN_CLASS_H #define HEADER_GEN_CLASS_H #include #include using std::string; using std::ostream; class header_gen_class { protected: string args_info; string enum_types; bool generate_config_parser; bool generate_string_parser; string generator_version; string group_counters; bool has_details; bool has_hidden; string header_file_ext; string header_file_name; string ifndefname; string mode_counters; string option_arg; string option_given; string option_values_decl; string package_var_name; string package_var_val; string parser_name; string version_var_name; string version_var_val; public: header_gen_class() : generate_config_parser (false), generate_string_parser (false), has_details (false), has_hidden (false) { } header_gen_class(const string &_args_info, const string &_enum_types, bool _generate_config_parser, bool _generate_string_parser, const string &_generator_version, const string &_group_counters, bool _has_details, bool _has_hidden, const string &_header_file_ext, const string &_header_file_name, const string &_ifndefname, const string &_mode_counters, const string &_option_arg, const string &_option_given, const string &_option_values_decl, const string &_package_var_name, const string &_package_var_val, const string &_parser_name, const string &_version_var_name, const string &_version_var_val) : args_info (_args_info), enum_types (_enum_types), generate_config_parser (_generate_config_parser), generate_string_parser (_generate_string_parser), generator_version (_generator_version), group_counters (_group_counters), has_details (_has_details), has_hidden (_has_hidden), header_file_ext (_header_file_ext), header_file_name (_header_file_name), ifndefname (_ifndefname), mode_counters (_mode_counters), option_arg (_option_arg), option_given (_option_given), option_values_decl (_option_values_decl), package_var_name (_package_var_name), package_var_val (_package_var_val), parser_name (_parser_name), version_var_name (_version_var_name), version_var_val (_version_var_val) { } virtual ~header_gen_class() { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_args_info(const string &_args_info) { args_info = _args_info; } virtual void generate_enum_types(ostream &stream, unsigned int indent) = 0; void set_enum_types(const string &_enum_types) { enum_types = _enum_types; } void set_generate_config_parser(bool _generate_config_parser) { generate_config_parser = _generate_config_parser; } void set_generate_string_parser(bool _generate_string_parser) { generate_string_parser = _generate_string_parser; } void set_generator_version(const string &_generator_version) { generator_version = _generator_version; } virtual void generate_group_counters(ostream &stream, unsigned int indent) = 0; void set_group_counters(const string &_group_counters) { group_counters = _group_counters; } void set_has_details(bool _has_details) { has_details = _has_details; } void set_has_hidden(bool _has_hidden) { has_hidden = _has_hidden; } void set_header_file_ext(const string &_header_file_ext) { header_file_ext = _header_file_ext; } void set_header_file_name(const string &_header_file_name) { header_file_name = _header_file_name; } void set_ifndefname(const string &_ifndefname) { ifndefname = _ifndefname; } virtual void generate_mode_counters(ostream &stream, unsigned int indent) = 0; void set_mode_counters(const string &_mode_counters) { mode_counters = _mode_counters; } virtual void generate_option_arg(ostream &stream, unsigned int indent) = 0; void set_option_arg(const string &_option_arg) { option_arg = _option_arg; } virtual void generate_option_given(ostream &stream, unsigned int indent) = 0; void set_option_given(const string &_option_given) { option_given = _option_given; } virtual void generate_option_values_decl(ostream &stream, unsigned int indent) = 0; void set_option_values_decl(const string &_option_values_decl) { option_values_decl = _option_values_decl; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void set_package_var_val(const string &_package_var_val) { package_var_val = _package_var_val; } void set_parser_name(const string &_parser_name) { parser_name = _parser_name; } void set_version_var_name(const string &_version_var_name) { version_var_name = _version_var_name; } void set_version_var_val(const string &_version_var_val) { version_var_val = _version_var_val; } void generate_header(ostream &stream, unsigned int indent = 0); }; #endif // HEADER_GEN_CLASS_H gengetopt-2.22.6/src/skels/copyright.h_skel0000664000175000017500000000054612044745036015643 00000000000000Copyright (C) @year@ Free Software Foundation Inc. This program comes with ABSOLUTELY NO WARRANTY; for details please see the file 'COPYING' supplied with the source code. This is free software, and you are welcome to redistribute it under certain conditions; again, see 'COPYING' for details. This program is released under the GNU General Public License. gengetopt-2.22.6/src/skels/copyright.h0000664000175000017500000000220712044745036014621 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef COPYRIGHT_GEN_CLASS_H #define COPYRIGHT_GEN_CLASS_H #include #include using std::string; using std::ostream; class copyright_gen_class { protected: string year; public: copyright_gen_class() { } copyright_gen_class(const string &_year) : year (_year) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_year(const string &_year) { year = _year; } void generate_copyright(ostream &stream, unsigned int indent = 0); }; #endif // COPYRIGHT_GEN_CLASS_H gengetopt-2.22.6/src/skels/required_option.h0000664000175000017500000000376612044757000016026 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef REQUIRED_OPTION_GEN_CLASS_H #define REQUIRED_OPTION_GEN_CLASS_H #include #include using std::string; using std::ostream; class required_option_gen_class { protected: bool checkrange; string mode_condition; string option_descr; string option_var_name; string package_var_name; public: required_option_gen_class() : checkrange (false) { } required_option_gen_class(bool _checkrange, const string &_mode_condition, const string &_option_descr, const string &_option_var_name, const string &_package_var_name) : checkrange (_checkrange), mode_condition (_mode_condition), option_descr (_option_descr), option_var_name (_option_var_name), package_var_name (_package_var_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_checkrange(bool _checkrange) { checkrange = _checkrange; } void set_mode_condition(const string &_mode_condition) { mode_condition = _mode_condition; } void set_option_descr(const string &_option_descr) { option_descr = _option_descr; } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void generate_required_option(ostream &stream, unsigned int indent = 0); }; #endif // REQUIRED_OPTION_GEN_CLASS_H gengetopt-2.22.6/src/skels/option_arg.h_skel0000664000175000017500000000216412045003074015760 00000000000000@IF@ long_long_arg @THEN@ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) @type@ @name@_arg; /**< @@brief @desc@@if@ has_default @then@ (default=@default_value@)@endif@. */ #else @longtype@ @name@_arg; /**< @@brief @desc@@if@ has_default @then@ (default=@default_value@)@endif@. */ #endif @origtype@ @name@_orig; /**< @@brief @desc@ original value given at command line. */ @ELSEIF@ flag_arg @THEN@ @type@ @name@_flag; /**< @@brief @desc@ (default=@if@ default_on @then@on@else@off@endif@). */ @ELSEIF@ has_arg @THEN@ @IF@ has_enum @THEN@ enum enum_@name@ @if@ multiple @THEN@ *@ENDIF@@name@_arg; /**< @@brief @desc@@if@ has_default @then@ (default='@default_value@')@endif@. */ @ELSE@ @type@ @name@_arg; /**< @@brief @desc@@if@ has_default @then@ (default='@default_value@')@endif@. */ @ENDIF@ @origtype@ @name@_orig; /**< @@brief @desc@ original value given at command line. */ @ENDIF@ @IF@ multiple @THEN@ unsigned int @name@_min; /**< @@brief @desc@'s minimum occurreces */ unsigned int @name@_max; /**< @@brief @desc@'s maximum occurreces */ @ENDIF@ const char *@name@_help; /**< @@brief @desc@ help description. */ gengetopt-2.22.6/src/skels/free_string.cc0000664000175000017500000000154212044745036015257 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "free_string.h" void free_string_gen_class::generate_free_string(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (has_string_type) { stream << "free_string_field (&("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_arg));"; stream << "\n"; stream << indent_str; } stream << "free_string_field (&("; generate_string (structure, stream, indent + indent_str.length ()); stream << "->"; generate_string (opt_var, stream, indent + indent_str.length ()); stream << "_orig));"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/exit_failure.h0000664000175000017500000000261512044745036015274 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef EXIT_FAILURE_GEN_CLASS_H #define EXIT_FAILURE_GEN_CLASS_H #include #include using std::string; using std::ostream; class exit_failure_gen_class { protected: bool handle_error; string parser_name; public: exit_failure_gen_class() : handle_error (false) { } exit_failure_gen_class(bool _handle_error, const string &_parser_name) : handle_error (_handle_error), parser_name (_parser_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_handle_error(bool _handle_error) { handle_error = _handle_error; } void set_parser_name(const string &_parser_name) { parser_name = _parser_name; } void generate_exit_failure(ostream &stream, unsigned int indent = 0); }; #endif // EXIT_FAILURE_GEN_CLASS_H gengetopt-2.22.6/src/skels/reset_group.h_skel0000664000175000017500000000025312044745036016164 00000000000000static void reset_group_@name@(struct @args_info@ *args_info) { if (! args_info->@name@_group_counter) return; @body@ args_info->@name@_group_counter = 0; } gengetopt-2.22.6/src/skels/c_source.h_skel0000664000175000017500000012400512045003074015420 00000000000000/* File autogenerated by gengetopt @generator_version@ generated with the following command: @command_line@ The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif @IF@ not include_getopt @THEN@ #include @ENDIF@ #include "@source_name@.@header_file_ext@" const char *@args_info@_purpose = "@purpose@"; const char *@args_info@_usage = "Usage: @if@ no_package @then@" @package_var_name@ "@endif@@usage_string@"; const char *@args_info@_versiontext = "@versiontext@"; const char *@args_info@_description = "@description@"; @IF@ has_hidden or has_details @THEN@ @IF@ has_details @THEN@ const char *@args_info@_detailed_help[] = { @detailed_help_option_print:method@ 0 }; @IF@ has_hidden @THEN@ static void init_full_help_array(void) { @full_help_option_print:method@ } const char *@args_info@_full_help[@help_string_num@]; @ENDIF@ @ELSEIF@ has_hidden @THEN@ const char *@args_info@_full_help[] = { @full_help_option_print:method@ 0 }; @ENDIF@ static void init_help_array(void) { @help_option_print:method@ } const char *@args_info@_help[@help_string_num@]; @ELSE@ const char *@args_info@_help[] = { @help_option_print:method@ 0 }; @ENDIF@ typedef enum {ARG_NO @IF@ has_arg_flag @THEN@ , ARG_FLAG @ENDIF@ @IF@ has_arg_string @THEN@ , ARG_STRING @ENDIF@ @IF@ has_arg_int @THEN@ , ARG_INT @ENDIF@ @IF@ has_arg_short @THEN@ , ARG_SHORT @ENDIF@ @IF@ has_arg_long @THEN@ , ARG_LONG @ENDIF@ @IF@ has_arg_float @THEN@ , ARG_FLOAT @ENDIF@ @IF@ has_arg_double @THEN@ , ARG_DOUBLE @ENDIF@ @IF@ has_arg_longdouble @THEN@ , ARG_LONGDOUBLE @ENDIF@ @IF@ has_arg_longlong @THEN@ , ARG_LONGLONG @ENDIF@ @IF@ has_arg_enum @THEN@ , ARG_ENUM @ENDIF@} @parser_name@_arg_type; static void clear_given (struct @args_info@ *args_info); static void clear_args (struct @args_info@ *args_info); static int @parser_name@_internal (int argc, char **argv, struct @args_info@ *args_info, struct @parser_name@_params *params, const char *additional_error); @IF@ check_required_options @THEN@ static int @parser_name@_required2 (struct @args_info@ *args_info, const char *prog_name, const char *additional_error); @ENDIF@ @IF@ cmd_list @THEN@ struct line_list { char * string_arg; struct line_list * next; }; static struct line_list *cmd_line_list = 0; static struct line_list *cmd_line_list_tmp = 0; static void free_cmd_list(void) { /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } } } @ENDIF@ @option_values:method{iteration=true}@ @IF@ do_generate_strdup @THEN@ static char * gengetopt_strdup (const char *s); @ENDIF@ static void clear_given (struct @args_info@ *args_info) { @given_init:method{iteration=true}@ } static void clear_args (struct @args_info@ *args_info) { FIX_UNUSED (args_info); @clear_arg:method@ } static void init_args_info(struct @args_info@ *args_info) { @IF@ has_hidden and has_details @then@ init_full_help_array(); @endif@ @IF@ has_hidden or has_details @then@ init_help_array(); @endif@ @init_args_info:method@ } void @parser_name@_print_version (void) { printf ("%s %s\n", (strlen(@package_var_name@_NAME) ? @package_var_name@_NAME : @package_var_name@), @version_var_name@); if (strlen(@args_info@_versiontext) > 0) printf("\n%s\n", @args_info@_versiontext); } static void print_help_common(void) { @parser_name@_print_version (); if (strlen(@args_info@_purpose) > 0) printf("\n%s\n", @args_info@_purpose); if (strlen(@args_info@_usage) > 0) printf("\n%s\n", @args_info@_usage); printf("\n"); if (strlen(@args_info@_description) > 0) printf("%s\n\n", @args_info@_description); } void @parser_name@_print_help (void) { int i = 0; print_help_common(); while (@args_info@_help[i]) printf("%s\n", @args_info@_help[i++]); } @IF@ has_hidden @THEN@ void @parser_name@_print_full_help (void) { int i = 0; print_help_common(); while (@args_info@_full_help[i]) printf("%s\n", @args_info@_full_help[i++]); } @ENDIF@ @IF@ has_details @THEN@ void @parser_name@_print_detailed_help (void) { int i = 0; print_help_common(); while (@args_info@_detailed_help[i]) printf("%s\n", @args_info@_detailed_help[i++]); } @ENDIF@ void @parser_name@_init (struct @args_info@ *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); @IF@ handle_unamed @THEN@ args_info->inputs = 0; args_info->inputs_num = 0; @ENDIF@ } void @parser_name@_params_init(struct @parser_name@_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct @parser_name@_params * @parser_name@_params_create(void) { struct @parser_name@_params *params = (struct @parser_name@_params *)malloc(sizeof(struct @parser_name@_params)); @parser_name@_params_init(params); return params; } @IF@ has_typed_options @THEN@ static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } @ENDIF@ @IF@ multiple_token_functions @THEN@ /** @@brief generic value variable */ union generic_value { @IF@ has_arg_int or has_arg_enum @THEN@ int int_arg; @ENDIF@ @IF@ has_arg_short @THEN@ short short_arg; @ENDIF@ @IF@ has_arg_long @THEN@ long long_arg; @ENDIF@ @IF@ has_arg_float @THEN@ float float_arg; @ENDIF@ @IF@ has_arg_double @THEN@ double double_arg; @ENDIF@ @IF@ has_arg_longdouble @THEN@ long double longdouble_arg; @ENDIF@ @IF@ has_arg_longlong @THEN@ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; #else long longlong_arg; #endif @ENDIF@ char *string_arg; const char *default_string_arg; }; /** @@brief holds temporary values for multiple options */ struct generic_list { union generic_value arg; char *orig; struct generic_list *next; }; /** * @@brief add a node at the head of the list */ static void add_node(struct generic_list **list) { struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list)); new_node->next = *list; *list = new_node; new_node->arg.string_arg = 0; new_node->orig = 0; } @IF@ (not multiple_options_all_string) and multiple_token_functions @THEN@ /** * The passed arg parameter is NOT set to 0 from this function */ static void free_multiple_field(unsigned int len, void *arg, char ***orig) { unsigned int i; if (arg) { for (i = 0; i < len; ++i) { free_string_field(&((*orig)[i])); } free (arg); free (*orig); *orig = 0; } } @ENDIF@ @IF@ multiple_options_string @THEN@ static void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) { unsigned int i; if (*arg) { for (i = 0; i < len; ++i) { free_string_field(&((*arg)[i])); free_string_field(&((*orig)[i])); } free_string_field(&((*arg)[0])); /* free default string */ free (*arg); *arg = 0; free (*orig); *orig = 0; } } @ENDIF@ @ENDIF@ static void @parser_name@_release (struct @args_info@ *args_info) { @IF@ handle_unamed @THEN@ unsigned int i;@ENDIF@ @free:method@ @IF@ handle_unamed @THEN@ for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); @ENDIF@ clear_given (args_info); } @IF@ check_possible_values @THEN@ /** * @@param val the value to check * @@param values the possible values * @@return the index of the matched value: * -1 if no value matched, * -2 if more than one value has matched */ static int check_possible_values(const char *val, const char *values[]) { int i, found, last; size_t len; if (!val) /* otherwise strlen() crashes below */ return -1; /* -1 means no argument for the option */ found = last = 0; for (i = 0, len = strlen(val); values[i]; ++i) { if (strncmp(val, values[i], len) == 0) { ++found; last = i; if (strlen(values[i]) == len) return i; /* exact macth no need to check more */ } } if (found == 1) /* one match: OK */ return last; return (found ? -2 : -1); /* return many values or none matched */ } @ENDIF@ static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { @IF@ check_possible_values @THEN@ int found = -1; @ELSE@ FIX_UNUSED (values); @ENDIF@ if (arg) { @IF@ check_possible_values @THEN@ if (values) { found = check_possible_values(arg, values); } if (found >= 0) fprintf(outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]); else fprintf(outfile, "%s=\"%s\"\n", opt, arg); @ELSE@ fprintf(outfile, "%s=\"%s\"\n", opt, arg); @ENDIF@ } else { fprintf(outfile, "%s\n", opt); } } @IF@ multiple_options @THEN@ static void write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[]) { int i; for (i = 0; i < len; ++i) write_into_file(outfile, opt, (arg ? arg[i] : 0), values); } @ENDIF@ int @parser_name@_dump(FILE *outfile, struct @args_info@ *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", @package_var_name@); return EXIT_FAILURE; } @file_save_loop:method@ i = EXIT_SUCCESS; return i; } int @parser_name@_file_save(const char *filename, struct @args_info@ *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", @package_var_name@, filename); return EXIT_FAILURE; } i = @parser_name@_dump(outfile, args_info); fclose (outfile); return i; } void @parser_name@_free (struct @args_info@ *args_info) { @parser_name@_release (args_info); } @IF@ do_generate_strdup @THEN@ /** @@brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } @ENDIF@ @IF@ multiple_token_functions @THEN@ static char * get_multiple_arg_token(const char *arg) { const char *tok; char *ret; size_t len, num_of_escape, i, j; if (!arg) return 0; tok = strchr (arg, ','); num_of_escape = 0; /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); ++num_of_escape; } else break; } if (tok) len = (size_t)(tok - arg + 1); else len = strlen (arg) + 1; len -= num_of_escape; ret = (char *) malloc (len); i = 0; j = 0; while (arg[i] && (j < len-1)) { if (arg[i] == '\\' && arg[ i + 1 ] && arg[ i + 1 ] == ',') ++i; ret[j++] = arg[i++]; } ret[len-1] = '\0'; return ret; } static const char * get_multiple_arg_token_next(const char *arg) { const char *tok; if (!arg) return 0; tok = strchr (arg, ','); /* make sure it is not escaped */ while (tok) { if (*(tok-1) == '\\') { /* find the next one */ tok = strchr (tok+1, ','); } else break; } if (! tok || strlen(tok) == 1) return 0; return tok+1; } @ENDIF@ @IF@ multiple_options @THEN@ static int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc); int check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc) { int error_occurred = 0; if (option_given && (min > 0 || max > 0)) { if (min > 0 && max > 0) { if (min == max) { /* specific occurrences */ if (option_given != (unsigned int) min) { fprintf (stderr, "%s: %s option occurrences must be %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (option_given < (unsigned int) min || option_given > (unsigned int) max) { /* range occurrences */ fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n", prog_name, option_desc, min, max); error_occurred = 1; } } else if (min > 0) { /* at least check */ if (option_given < min) { fprintf (stderr, "%s: %s option occurrences must be at least %d\n", prog_name, option_desc, min); error_occurred = 1; } } else if (max > 0) { /* at most check */ if (option_given > max) { fprintf (stderr, "%s: %s option occurrences must be at most %d\n", prog_name, option_desc, max); error_occurred = 1; } } } return error_occurred; } @ENDIF@ @reset_groups:method{iteration=true}@ int @parser_name@ (int argc, char **argv, struct @args_info@ *args_info) { return @parser_name@2 (argc, argv, args_info, 0, 1, 1); } int @parser_name@_ext (int argc, char **argv, struct @args_info@ *args_info, struct @parser_name@_params *params) { int result; result = @parser_name@_internal (argc, argv, args_info, params, 0); @final_exit@ } int @parser_name@2 (int argc, char **argv, struct @args_info@ *args_info, int override, int initialize, int check_required) { int result; struct @parser_name@_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = @parser_name@_internal (argc, argv, args_info, ¶ms, 0); @final_exit@ } int @parser_name@_required (struct @args_info@ *args_info, const char *prog_name) { @IF@ check_required_options @THEN@ int result = EXIT_SUCCESS; if (@parser_name@_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; @final_exit@ @ELSE@ FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; @ENDIF@ } @IF@ check_required_options @THEN@ int @parser_name@_required2 (struct @args_info@ *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ @handle_required:method@ /* checks for dependences among options */ @handle_dependencies:method{iteration=true}@ return error_occurred; } @ENDIF@ @IF@ include_getopt @THEN@ @custom_getopt:method@ @ENDIF@ static char *package_name = 0; @IF@ not no_options @THEN@ /** * @@brief updates an option * @@param field the generic pointer to the field to update * @@param orig_field the pointer to the orig field * @@param field_given the pointer to the number of occurrence of this option * @@param prev_given the pointer to the number of occurrence already seen * @@param value the argument for this option (if null no arg was specified) * @@param possible_values the possible values for this option (if specified) * @@param default_value the default value (in case the option only accepts fixed values) * @@param arg_type the type of this option * @@param check_ambiguity @@see @parser_name@_params.check_ambiguity * @@param override @@see @parser_name@_params.override * @@param no_free whether to free a possible previous value * @@param multiple_option whether this is a multiple option * @@param long_opt the corresponding long option * @@param short_opt the corresponding short option (or '-' if none) * @@param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, @parser_name@_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; @IF@ has_arg_string @THEN@ char **string_field; @ENDIF@ FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } @IF@ check_possible_values @THEN@ if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0) { if (short_opt != '-') fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } @ELSE@ FIX_UNUSED (default_value); @ENDIF@ if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { @IF@ has_arg_flag @THEN@ case ARG_FLAG: *((int *)field) = !*((int *)field); break; @ENDIF@ @IF@ has_arg_int @THEN@ case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; @ENDIF@ @IF@ has_arg_short @THEN@ case ARG_SHORT: if (val) *((short *)field) = (short)strtol (val, &stop_char, 0); break; @ENDIF@ @IF@ has_arg_long @THEN@ case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; @ENDIF@ @IF@ has_arg_float @THEN@ case ARG_FLOAT: if (val) *((float *)field) = (float)strtod (val, &stop_char); break; @ENDIF@ @IF@ has_arg_double @THEN@ case ARG_DOUBLE: if (val) *((double *)field) = strtod (val, &stop_char); break; @ENDIF@ @IF@ has_arg_longdouble @THEN@ case ARG_LONGDOUBLE: if (val) *((long double *)field) = (long double)strtod (val, &stop_char); break; @ENDIF@ @IF@ has_arg_longlong @THEN@ case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0); #else if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); #endif break; @ENDIF@ @IF@ has_arg_enum @THEN@ case ARG_ENUM: if (val) *((int *)field) = found; break; @ENDIF@ @IF@ has_arg_string @THEN@ case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; @ENDIF@ default: break; }; @IF@ has_arg_int or has_arg_short or has_arg_long or has_arg_float or has_arg_double or has_arg_longdouble or has_arg_longlong @THEN@ /* check numeric conversion */ switch(arg_type) { @IF@ has_arg_int @THEN@ case ARG_INT: @ENDIF@ @IF@ has_arg_short @THEN@ case ARG_SHORT: @ENDIF@ @IF@ has_arg_long @THEN@ case ARG_LONG: @ENDIF@ @IF@ has_arg_float @THEN@ case ARG_FLOAT: @ENDIF@ @IF@ has_arg_double @THEN@ case ARG_DOUBLE: @ENDIF@ @IF@ has_arg_longdouble @THEN@ case ARG_LONGDOUBLE: @ENDIF@ @IF@ has_arg_longlong @THEN@ case ARG_LONGLONG: @ENDIF@ if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; @ENDIF@ /* store the original value */ switch(arg_type) { case ARG_NO: @IF@ has_arg_flag @THEN@ case ARG_FLAG: @ENDIF@ break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } @ENDIF@ @IF@ multiple_token_functions @THEN@ /** * @@brief store information about a multiple option in a temporary list * @@param list where to (temporarily) store multiple options */ static int update_multiple_arg_temp(struct generic_list **list, unsigned int *prev_given, const char *val, const char *possible_values[], const char *default_value, @parser_name@_arg_type arg_type, const char *long_opt, char short_opt, const char *additional_error) { /* store single arguments */ char *multi_token; const char *multi_next; if (arg_type == ARG_NO) { (*prev_given)++; return 0; /* OK */ } multi_token = get_multiple_arg_token(val); multi_next = get_multiple_arg_token_next (val); while (1) { add_node (list); if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0, prev_given, multi_token, possible_values, default_value, arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) { if (multi_token) free(multi_token); return 1; /* failure */ } if (multi_next) { multi_token = get_multiple_arg_token(multi_next); multi_next = get_multiple_arg_token_next (multi_next); } else break; } return 0; /* OK */ } /** * @@brief free the passed list (including possible string argument) */ static void free_list(struct generic_list *list, short string_arg) { if (list) { struct generic_list *tmp; while (list) { tmp = list; if (string_arg && list->arg.string_arg) free (list->arg.string_arg); if (list->orig) free (list->orig); list = list->next; free (tmp); } } } /** * @@brief updates a multiple option starting from the passed list */ static void update_multiple_arg(void *field, char ***orig_field, unsigned int field_given, unsigned int prev_given, union generic_value *default_value, @parser_name@_arg_type arg_type, struct generic_list *list) { int i; struct generic_list *tmp; if (prev_given && list) { *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *)); switch(arg_type) { @IF@ has_arg_int or has_arg_enum @THEN@ @IF@ has_arg_int @THEN@ case ARG_INT: @ENDIF@ @IF@ has_arg_enum @THEN@ case ARG_ENUM: @ENDIF@ *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break; @ENDIF@ @IF@ has_arg_short @THEN@ case ARG_SHORT: *((short **)field) = (short *)realloc (*((short **)field), (field_given + prev_given) * sizeof (short)); break; @ENDIF@ @IF@ has_arg_long @THEN@ case ARG_LONG: *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; @ENDIF@ @IF@ has_arg_float @THEN@ case ARG_FLOAT: *((float **)field) = (float *)realloc (*((float **)field), (field_given + prev_given) * sizeof (float)); break; @ENDIF@ @IF@ has_arg_double @THEN@ case ARG_DOUBLE: *((double **)field) = (double *)realloc (*((double **)field), (field_given + prev_given) * sizeof (double)); break; @ENDIF@ @IF@ has_arg_longdouble @THEN@ case ARG_LONGDOUBLE: *((long double **)field) = (long double *)realloc (*((long double **)field), (field_given + prev_given) * sizeof (long double)); break; @ENDIF@ @IF@ has_arg_longlong @THEN@ case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) *((long long int **)field) = (long long int *)realloc (*((long long int **)field), (field_given + prev_given) * sizeof (long long int)); break; #else *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break; #endif @ENDIF@ @IF@ has_arg_string @THEN@ case ARG_STRING: *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break; @ENDIF@ default: break; }; for (i = (prev_given - 1); i >= 0; --i) { tmp = list; switch(arg_type) { @IF@ has_arg_int @THEN@ case ARG_INT: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; @ENDIF@ @IF@ has_arg_short @THEN@ case ARG_SHORT: (*((short **)field))[i + field_given] = tmp->arg.short_arg; break; @ENDIF@ @IF@ has_arg_long @THEN@ case ARG_LONG: (*((long **)field))[i + field_given] = tmp->arg.long_arg; break; @ENDIF@ @IF@ has_arg_float @THEN@ case ARG_FLOAT: (*((float **)field))[i + field_given] = tmp->arg.float_arg; break; @ENDIF@ @IF@ has_arg_double @THEN@ case ARG_DOUBLE: (*((double **)field))[i + field_given] = tmp->arg.double_arg; break; @ENDIF@ @IF@ has_arg_longdouble @THEN@ case ARG_LONGDOUBLE: (*((long double **)field))[i + field_given] = tmp->arg.longdouble_arg; break; @ENDIF@ @IF@ has_arg_longlong @THEN@ case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) (*((long long int **)field))[i + field_given] = tmp->arg.longlong_arg; break; #else (*((long **)field))[i + field_given] = tmp->arg.longlong_arg; break; #endif @ENDIF@ @IF@ has_arg_enum @THEN@ case ARG_ENUM: (*((int **)field))[i + field_given] = tmp->arg.int_arg; break; @ENDIF@ @IF@ has_arg_string @THEN@ case ARG_STRING: (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break; @ENDIF@ default: break; } (*orig_field) [i + field_given] = list->orig; list = list->next; free (tmp); } } else { /* set the default value */ if (default_value && ! field_given) { switch(arg_type) { @IF@ has_arg_int or has_arg_enum @THEN@ @IF@ has_arg_int @THEN@ case ARG_INT: @ENDIF@ @IF@ has_arg_enum @THEN@ case ARG_ENUM: @ENDIF@ if (! *((int **)field)) { *((int **)field) = (int *)malloc (sizeof (int)); (*((int **)field))[0] = default_value->int_arg; } break; @ENDIF@ @IF@ has_arg_short @THEN@ case ARG_SHORT: if (! *((short **)field)) { *((short **)field) = (short *)malloc (sizeof (short)); (*((short **)field))[0] = default_value->short_arg; } break; @ENDIF@ @IF@ has_arg_long @THEN@ case ARG_LONG: if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->long_arg; } break; @ENDIF@ @IF@ has_arg_float @THEN@ case ARG_FLOAT: if (! *((float **)field)) { *((float **)field) = (float *)malloc (sizeof (float)); (*((float **)field))[0] = default_value->float_arg; } break; @ENDIF@ @IF@ has_arg_double @THEN@ case ARG_DOUBLE: if (! *((double **)field)) { *((double **)field) = (double *)malloc (sizeof (double)); (*((double **)field))[0] = default_value->double_arg; } break; @ENDIF@ @IF@ has_arg_longdouble @THEN@ case ARG_LONGDOUBLE: if (! *((long double **)field)) { *((long double **)field) = (long double *)malloc (sizeof (long double)); (*((long double **)field))[0] = default_value->longdouble_arg; } break; @ENDIF@ @IF@ has_arg_longlong @THEN@ case ARG_LONGLONG: #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) if (! *((long long int **)field)) { *((long long int **)field) = (long long int *)malloc (sizeof (long long int)); (*((long long int **)field))[0] = default_value->longlong_arg; } #else if (! *((long **)field)) { *((long **)field) = (long *)malloc (sizeof (long)); (*((long **)field))[0] = default_value->longlong_arg; } #endif break; @ENDIF@ @IF@ has_arg_string @THEN@ case ARG_STRING: if (! *((char ***)field)) { *((char ***)field) = (char **)malloc (sizeof (char *)); (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg); } break; @ENDIF@ default: break; } if (!(*orig_field)) { *orig_field = (char **) malloc (sizeof (char *)); (*orig_field)[0] = 0; } } } } @ENDIF@ @IF@ has_modes @THEN@ static int check_modes( int given1[], const char *options1[], int given2[], const char *options2[]) { int i = 0, j = 0, errors = 0; while (given1[i] >= 0) { if (given1[i]) { while (given2[j] >= 0) { if (given2[j]) { ++errors; fprintf(stderr, "%s: option %s conflicts with option %s\n", package_name, options1[i], options2[j]); } ++j; } } ++i; } return errors; } @ENDIF@ int @parser_name@_internal ( int argc, char **argv, struct @args_info@ *args_info, struct @parser_name@_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ @IF@ multiple_options_with_default @THEN@ union generic_value multiple_default_value; @endif@ @list_def:method{iteration=true}@ int error_occurred = 0; struct @args_info@ local_args_info; int override; int initialize; int check_required; int check_ambiguity; @IF@ include_getopt @THEN@ char *optarg; int optind; int opterr; int optopt; @ENDIF@ package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) @parser_name@_init (args_info); @parser_name@_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { @long_option_struct:method{iteration=true}@ { 0, 0, 0, 0 } }; @IF@ include_getopt @THEN@ custom_optarg = optarg; custom_optind = optind; custom_opterr = opterr; custom_optopt = optopt; c = custom_getopt_long (argc, argv, "@getopt_string@", long_options, &option_index); optarg = custom_optarg; optind = custom_optind; opterr = custom_opterr; optopt = custom_optopt; @ELSE@ c = getopt_long (argc, argv, "@getopt_string@", long_options, &option_index); @ENDIF@ if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { @handle_option:method{iteration=true}@ case 0: /* Long option with no short option */ @handle_no_short_option:method{iteration=true}@ @IF@ handle_question_mark @THEN@ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; @ENDIF@ default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", @package_var_name@, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ @handle_group:method{iteration=true}@ @multiple_fill_array:method{iteration=true}@ @update_multiple_given:method{iteration=true}@ @check_modes:method{iteration=true}@ @IF@ check_required_options @THEN@ if (check_required) { error_occurred += @parser_name@_required2 (args_info, argv[0], additional_error); } @ENDIF@ @parser_name@_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); @IF@ handle_unamed @THEN@ if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ @IF@ include_getopt @THEN@ @ELSE@ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; @ENDIF@ args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) @IF@ include_getopt @THEN@ args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; @ELSE@ if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; @ENDIF@ } @ENDIF@ return 0; failure: @list_free:method@ @parser_name@_release (&local_args_info); return (EXIT_FAILURE); } @IF@ conf_parser @THEN@ #ifndef CONFIG_FILE_LINE_SIZE #define CONFIG_FILE_LINE_SIZE 2048 #endif #define ADDITIONAL_ERROR " in configuration file " #define CONFIG_FILE_LINE_BUFFER_SIZE (CONFIG_FILE_LINE_SIZE+3) /* 3 is for "--" and "=" */ static int _@parser_name@_configfile (const char *filename, int *my_argc) { FILE* file; char my_argv[CONFIG_FILE_LINE_BUFFER_SIZE+1]; char linebuf[CONFIG_FILE_LINE_SIZE]; int line_num = 0; int result = 0, equal; char *fopt, *farg; char *str_index; size_t len, next_token; char delimiter; if ((file = fopen(filename, "r")) == 0) { fprintf (stderr, "%s: Error opening configuration file '%s'\n", @package_var_name@, filename); return EXIT_FAILURE; } while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != 0) { ++line_num; my_argv[0] = '\0'; len = strlen(linebuf); if (len > (CONFIG_FILE_LINE_BUFFER_SIZE-1)) { fprintf (stderr, "%s:%s:%d: Line too long in configuration file\n", @package_var_name@, filename, line_num); result = EXIT_FAILURE; break; } /* find first non-whitespace character in the line */ next_token = strspn (linebuf, " \t\r\n"); str_index = linebuf + next_token; if ( str_index[0] == '\0' || str_index[0] == '#') continue; /* empty line or comment line is skipped */ fopt = str_index; /* truncate fopt at the end of the first non-valid character */ next_token = strcspn (fopt, " \t\r\n="); if (fopt[next_token] == '\0') /* the line is over */ { farg = 0; equal = 0; goto noarg; } /* remember if equal sign is present */ equal = (fopt[next_token] == '='); fopt[next_token++] = '\0'; /* advance pointers to the next token after the end of fopt */ next_token += strspn (fopt + next_token, " \t\r\n"); /* check for the presence of equal sign, and if so, skip it */ if ( !equal ) if ((equal = (fopt[next_token] == '='))) { next_token++; next_token += strspn (fopt + next_token, " \t\r\n"); } str_index += next_token; /* find argument */ farg = str_index; if ( farg[0] == '\"' || farg[0] == '\'' ) { /* quoted argument */ str_index = strchr (++farg, str_index[0] ); /* skip opening quote */ if (! str_index) { fprintf (stderr, "%s:%s:%d: unterminated string in configuration file\n", @package_var_name@, filename, line_num); result = EXIT_FAILURE; break; } } else { /* read up the remaining part up to a delimiter */ next_token = strcspn (farg, " \t\r\n#\'\""); str_index += next_token; } /* truncate farg at the delimiter and store it for further check */ delimiter = *str_index, *str_index++ = '\0'; /* everything but comment is illegal at the end of line */ if (delimiter != '\0' && delimiter != '#') { str_index += strspn(str_index, " \t\r\n"); if (*str_index != '\0' && *str_index != '#') { fprintf (stderr, "%s:%s:%d: malformed string in configuration file\n", @package_var_name@, filename, line_num); result = EXIT_FAILURE; break; } } noarg: if (!strcmp(fopt,"include")) { if (farg && *farg) { result = _@parser_name@_configfile(farg, my_argc); } else { fprintf(stderr, "%s:%s:%d: include requires a filename argument.\n", @package_var_name@, filename, line_num); } continue; } len = strlen(fopt); strcat (my_argv, len > 1 ? "--" : "-"); strcat (my_argv, fopt); if (len > 1 && ((farg && *farg) || equal)) strcat (my_argv, "="); if (farg && *farg) strcat (my_argv, farg); ++(*my_argc); cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup(my_argv); } /* while */ if (file) fclose(file); return result; } int @parser_name@_configfile ( const char *filename, struct @args_info@ *args_info, int override, int initialize, int check_required) { struct @parser_name@_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return @parser_name@_config_file (filename, args_info, ¶ms); } int @parser_name@_config_file (const char *filename, struct @args_info@ *args_info, struct @parser_name@_params *params) { int i, result; int my_argc = 1; char **my_argv_arg; char *additional_error; /* store the program name */ cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (@package_var_name@); result = _@parser_name@_configfile(filename, &my_argc); if (result != EXIT_FAILURE) { my_argv_arg = (char **) malloc((my_argc+1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = my_argc - 1; i >= 0; --i) { my_argv_arg[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } my_argv_arg[my_argc] = 0; additional_error = (char *)malloc(strlen(filename) + strlen(ADDITIONAL_ERROR) + 1); strcpy (additional_error, ADDITIONAL_ERROR); strcat (additional_error, filename); result = @parser_name@_internal (my_argc, my_argv_arg, args_info, params, additional_error); free (additional_error); free (my_argv_arg); } free_cmd_list(); @final_exit@ } @ENDIF@ @IF@ generate_string_parser @THEN@ static unsigned int @parser_name@_create_argv(const char *cmdline_, char ***argv_ptr, const char *prog_name) { char *cmdline, *p; size_t n = 0, j; int i; if (prog_name) { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (prog_name); ++n; } cmdline = gengetopt_strdup(cmdline_); p = cmdline; while (p && strlen(p)) { j = strcspn(p, " \t"); ++n; if (j && j < strlen(p)) { p[j] = '\0'; cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); p += (j+1); p += strspn(p, " \t"); } else { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); break; } } *argv_ptr = (char **) malloc((n + 1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = (n-1); i >= 0; --i) { (*argv_ptr)[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } (*argv_ptr)[n] = 0; free(cmdline); return n; } int @parser_name@_string(const char *cmdline, struct @args_info@ *args_info, const char *prog_name) { return @parser_name@_string2(cmdline, args_info, prog_name, 0, 1, 1); } int @parser_name@_string2(const char *cmdline, struct @args_info@ *args_info, const char *prog_name, int override, int initialize, int check_required) { struct @parser_name@_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return @parser_name@_string_ext(cmdline, args_info, prog_name, ¶ms); } int @parser_name@_string_ext(const char *cmdline, struct @args_info@ *args_info, const char *prog_name, struct @parser_name@_params *params) { char **argv_ptr = 0; int result; unsigned int argc; argc = @parser_name@_create_argv(cmdline, &argv_ptr, prog_name); result = @parser_name@_internal (argc, argv_ptr, args_info, params, 0); if (argv_ptr) { free (argv_ptr); } free_cmd_list(); @final_exit@ } @ENDIF@ gengetopt-2.22.6/src/skels/handle_version.h_skel0000664000175000017500000000042312044745036016625 00000000000000@IF@ short_opt @THEN@ case 'V': /* Print version and exit. */ @ELSE@ if (strcmp (long_options[option_index].name, "version") == 0) { @ENDIF@ @parser_name@_print_version (); @parser_name@_free (&local_args_info); exit (EXIT_SUCCESS);@IF@ (not short_opt) @then@ }@ENDIF@gengetopt-2.22.6/src/skels/option_arg.h0000664000175000017500000000562612044762311014755 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef OPTION_ARG_GEN_CLASS_H #define OPTION_ARG_GEN_CLASS_H #include #include using std::string; using std::ostream; class option_arg_gen_class { protected: bool default_on; string default_value; string desc; bool flag_arg; bool has_arg; bool has_default; bool has_enum; bool long_long_arg; string longtype; bool multiple; string name; string origtype; string type; public: option_arg_gen_class() : default_on (false), flag_arg (false), has_arg (false), has_default (false), has_enum (false), long_long_arg (false), multiple (false) { } option_arg_gen_class(bool _default_on, const string &_default_value, const string &_desc, bool _flag_arg, bool _has_arg, bool _has_default, bool _has_enum, bool _long_long_arg, const string &_longtype, bool _multiple, const string &_name, const string &_origtype, const string &_type) : default_on (_default_on), default_value (_default_value), desc (_desc), flag_arg (_flag_arg), has_arg (_has_arg), has_default (_has_default), has_enum (_has_enum), long_long_arg (_long_long_arg), longtype (_longtype), multiple (_multiple), name (_name), origtype (_origtype), type (_type) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_default_on(bool _default_on) { default_on = _default_on; } void set_default_value(const string &_default_value) { default_value = _default_value; } void set_desc(const string &_desc) { desc = _desc; } void set_flag_arg(bool _flag_arg) { flag_arg = _flag_arg; } void set_has_arg(bool _has_arg) { has_arg = _has_arg; } void set_has_default(bool _has_default) { has_default = _has_default; } void set_has_enum(bool _has_enum) { has_enum = _has_enum; } void set_long_long_arg(bool _long_long_arg) { long_long_arg = _long_long_arg; } void set_longtype(const string &_longtype) { longtype = _longtype; } void set_multiple(bool _multiple) { multiple = _multiple; } void set_name(const string &_name) { name = _name; } void set_origtype(const string &_origtype) { origtype = _origtype; } void set_type(const string &_type) { type = _type; } void generate_option_arg(ostream &stream, unsigned int indent = 0); }; #endif // OPTION_ARG_GEN_CLASS_H gengetopt-2.22.6/src/skels/reset_group.h0000664000175000017500000000264112044745036015151 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef RESET_GROUP_GEN_CLASS_H #define RESET_GROUP_GEN_CLASS_H #include #include using std::string; using std::ostream; class reset_group_gen_class { protected: string args_info; string body; string name; public: reset_group_gen_class() { } reset_group_gen_class(const string &_args_info, const string &_body, const string &_name) : args_info (_args_info), body (_body), name (_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_args_info(const string &_args_info) { args_info = _args_info; } void set_body(const string &_body) { body = _body; } void set_name(const string &_name) { name = _name; } void generate_reset_group(ostream &stream, unsigned int indent = 0); }; #endif // RESET_GROUP_GEN_CLASS_H gengetopt-2.22.6/src/skels/dependant_option.h0000664000175000017500000000401012044757000016127 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef DEPENDANT_OPTION_GEN_CLASS_H #define DEPENDANT_OPTION_GEN_CLASS_H #include #include using std::string; using std::ostream; class dependant_option_gen_class { protected: string dep_option; string dep_option_descr; string option_descr; string option_var_name; string package_var_name; public: dependant_option_gen_class() { } dependant_option_gen_class(const string &_dep_option, const string &_dep_option_descr, const string &_option_descr, const string &_option_var_name, const string &_package_var_name) : dep_option (_dep_option), dep_option_descr (_dep_option_descr), option_descr (_option_descr), option_var_name (_option_var_name), package_var_name (_package_var_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_dep_option(const string &_dep_option) { dep_option = _dep_option; } void set_dep_option_descr(const string &_dep_option_descr) { dep_option_descr = _dep_option_descr; } void set_option_descr(const string &_option_descr) { option_descr = _option_descr; } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void set_package_var_name(const string &_package_var_name) { package_var_name = _package_var_name; } void generate_dependant_option(ostream &stream, unsigned int indent = 0); }; #endif // DEPENDANT_OPTION_GEN_CLASS_H gengetopt-2.22.6/src/skels/multiple_fill_array.h_skel0000664000175000017500000000071412044745036017667 00000000000000@IF@ default_value:string != "0" @THEN@ multiple_default_value.@if@ arg_type:string = "ARG_STRING" @then@default_@endif@@type@_arg = @default_value@; @ENDIF@ update_multiple_arg((void *)&(args_info->@option_var_name@_arg), &(args_info->@option_var_name@_orig), args_info->@option_var_name@_given, local_args_info.@option_var_name@_given, @IF@ default_value:string != "0" @THEN@ &multiple_default_value@ELSE@ 0@ENDIF@, @arg_type@, @option_var_name@_list);gengetopt-2.22.6/src/skels/given_field.h_skel0000664000175000017500000000026412044745036016103 00000000000000unsigned int @arg_name@_given ; /**< @@brief Whether @long_opt@ was given. */ @IF@ group @THEN@ int @arg_name@_group ; /**< @@brief Whether @long_opt@'s was updated. */ @ENDIF@gengetopt-2.22.6/src/skels/generic_option.cc0000664000175000017500000002171112044745036015754 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "generic_option.h" void generic_option_gen_class::generate_generic_option(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (has_short_option) { stream << "case '"; generate_string (short_option, stream, indent + indent_str.length ()); stream << "': /* "; generate_string (option_comment, stream, indent + indent_str.length ()); stream << ". */"; stream << "\n"; stream << indent_str; if (( short_option == "?" )) { stream << "\n"; stream << indent_str; stream << " if (optopt) /* '?' represents an unrecognized option */"; stream << "\n"; stream << indent_str; stream << " goto failure;"; stream << "\n"; stream << indent_str; } } else { stream << "/* "; generate_string (option_comment, stream, indent + indent_str.length ()); stream << ". */"; stream << "\n"; stream << indent_str; generate_string (gen_else, stream, indent + indent_str.length ()); stream << "if (strcmp (long_options[option_index].name, \""; generate_string (long_option, stream, indent + indent_str.length ()); stream << "\") == 0)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; } if (option_has_mode) { stream << " args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_mode_counter += 1;"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (multiple) { if (option_has_type) { stream << " if (update_multiple_arg_temp(&"; generate_string (structure, stream, indent + indent_str.length ()); stream << ", "; stream << "\n"; stream << indent_str; stream << " &(local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given), optarg, "; generate_string (possible_values, stream, indent + indent_str.length ()); stream << ", "; generate_string (default_value, stream, indent + indent_str.length ()); stream << ", "; generate_string (arg_type, stream, indent + indent_str.length ()); stream << ","; stream << "\n"; stream << indent_str; stream << " \""; generate_string (long_option, stream, indent + indent_str.length ()); stream << "\", '"; generate_string (short_option, stream, indent + indent_str.length ()); stream << "',"; stream << "\n"; stream << indent_str; stream << " additional_error))"; stream << "\n"; stream << indent_str; stream << " goto failure;"; stream << "\n"; stream << indent_str; } else { stream << " local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given++;"; stream << "\n"; stream << indent_str; } if (option_has_group) { stream << " if (!args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_group)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_group = 1;"; stream << "\n"; stream << indent_str; stream << " args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_group_counter += 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; } } else { if (option_has_group) { stream << " if (args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_group_counter && override)"; stream << "\n"; stream << indent_str; stream << " reset_group_"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << " (args_info);"; stream << "\n"; stream << indent_str; stream << " args_info->"; generate_string (group_var_name, stream, indent + indent_str.length ()); stream << "_group_counter += 1;"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (( arg_type == "ARG_FLAG" )) { stream << " if (update_arg((void *)&(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_flag), 0, &(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given),"; stream << "\n"; stream << indent_str; stream << " &(local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given), optarg, 0, 0, "; generate_string (arg_type, stream, indent + indent_str.length ()); stream << ","; stream << "\n"; stream << indent_str; stream << " check_ambiguity, override, 1, 0, \""; generate_string (long_option, stream, indent + indent_str.length ()); stream << "\", '"; generate_string (short_option, stream, indent + indent_str.length ()); stream << "',"; stream << "\n"; stream << indent_str; stream << " additional_error))"; stream << "\n"; stream << indent_str; stream << " goto failure;"; stream << "\n"; stream << indent_str; } else { stream << " if (update_arg("; if (( arg_type == "ARG_NO" )) { stream << " 0 "; } else { stream << " (void *)&(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_arg)"; } stream << ", "; stream << "\n"; stream << indent_str; indent = 6; stream << " "; if (( arg_type == "ARG_NO" )) { stream << " 0 "; } else { stream << " &(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_orig)"; } stream << ", &(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given),"; indent = 0; stream << "\n"; stream << indent_str; stream << " &(local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given), optarg, "; generate_string (possible_values, stream, indent + indent_str.length ()); stream << ", "; generate_string (default_value, stream, indent + indent_str.length ()); stream << ", "; generate_string (arg_type, stream, indent + indent_str.length ()); stream << ","; stream << "\n"; stream << indent_str; stream << " check_ambiguity, override, 0, 0,"; stream << "\n"; stream << indent_str; stream << " \""; generate_string (long_option, stream, indent + indent_str.length ()); stream << "\", '"; generate_string (short_option, stream, indent + indent_str.length ()); stream << "',"; stream << "\n"; stream << indent_str; stream << " additional_error))"; stream << "\n"; stream << indent_str; stream << " goto failure;"; stream << "\n"; stream << indent_str; } if (( final_instructions != "" )) { indent = 2; stream << " "; generate_string (final_instructions, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; } } if (has_short_option) { stream << "\n"; stream << indent_str; stream << " break;"; } else { stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/file_save_multiple.h_skel0000664000175000017500000000034712044745036017502 00000000000000@IF@ has_arg @THEN@ write_multiple_into_file(outfile, args_info->@opt_var@_given, "@opt_name@", args_info->@opt_var@_orig, @values@); @ELSE@ write_multiple_into_file(outfile, args_info->@opt_var@_given, "@opt_name@", 0, 0); @ENDIF@gengetopt-2.22.6/src/skels/init_args_info.h_skel0000664000175000017500000000022512044745036016617 00000000000000args_info->@var_arg@_help = @help_strings@[@num@] ; @IF@ multiple @THEN@ args_info->@var_arg@_min = @min@; args_info->@var_arg@_max = @max@; @ENDIF@ gengetopt-2.22.6/src/skels/clear_arg.cc0000664000175000017500000000155212044745036014670 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "clear_arg.h" void clear_arg_gen_class::generate_clear_arg(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (has_arg) { stream << "args_info->"; generate_string (name, stream, indent + indent_str.length ()); stream << "_"; generate_string (suffix, stream, indent + indent_str.length ()); stream << " = "; generate_string (value, stream, indent + indent_str.length ()); stream << ";"; stream << "\n"; stream << indent_str; } if (has_orig) { stream << "args_info->"; generate_string (name, stream, indent + indent_str.length ()); stream << "_orig = NULL;"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/header.cc0000664000175000017500000010225212045003074014166 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "header.h" void header_gen_class::generate_header(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "/** "; stream << "@"; stream << "file "; generate_string (header_file_name, stream, indent + indent_str.length ()); stream << "."; generate_string (header_file_ext, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief The header file for the command line option parser"; stream << "\n"; stream << indent_str; stream << " * generated by GNU Gengetopt "; generate_string (generator_version, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << " * http://www.gnu.org/software/gengetopt."; stream << "\n"; stream << indent_str; stream << " * DO NOT modify this file, since it can be overwritten"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "author GNU Gengetopt by Lorenzo Bettini */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef "; generate_string (ifndefname, stream, indent + indent_str.length ()); stream << "_H"; stream << "\n"; stream << indent_str; stream << "#define "; generate_string (ifndefname, stream, indent + indent_str.length ()); stream << "_H"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* If we use autoconf. */"; stream << "\n"; stream << indent_str; stream << "#ifdef HAVE_CONFIG_H"; stream << "\n"; stream << indent_str; stream << "#include \"config.h\""; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#include /* for FILE */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifdef __cplusplus"; stream << "\n"; stream << indent_str; stream << "extern \"C\" {"; stream << "\n"; stream << indent_str; stream << "#endif /* __cplusplus */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the program name (used for printing errors) */"; stream << "\n"; stream << indent_str; stream << "#define "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << " "; generate_string (package_var_val, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME"; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the complete program name (used for help and version) */"; stream << "\n"; stream << indent_str; if (( package_var_val != "PACKAGE" )) { stream << "#define "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME "; generate_string (package_var_val, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; } else { stream << "#ifdef PACKAGE_NAME"; stream << "\n"; stream << indent_str; stream << "#define "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME PACKAGE_NAME"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << "#define "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME PACKAGE"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; } stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef "; generate_string (version_var_name, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the program version */"; stream << "\n"; stream << indent_str; stream << "#define "; generate_string (version_var_name, stream, indent + indent_str.length ()); stream << " "; generate_string (version_var_val, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; if (enum_types.size () > 0) generate_string (enum_types, stream, indent + indent_str.length ()); else generate_enum_types (stream, indent + indent_str.length ()); stream << indent_str; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief Where the command line options are stored */"; stream << "\n"; stream << indent_str; stream << "struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (option_arg.size () > 0) generate_string (option_arg, stream, indent + indent_str.length ()); else generate_option_arg (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (option_given.size () > 0) generate_string (option_given, stream, indent + indent_str.length ()); else generate_option_given (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; indent = 2; if (group_counters.size () > 0) generate_string (group_counters, stream, indent + indent_str.length ()); else generate_group_counters (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; indent = 2; if (mode_counters.size () > 0) generate_string (mode_counters, stream, indent + indent_str.length ()); else generate_mode_counters (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "} ;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief The additional parameters to pass to parser functions */"; stream << "\n"; stream << indent_str; stream << "struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int override; /**< "; stream << "@"; stream << "brief whether to override possibly already present options (default 0) */"; stream << "\n"; stream << indent_str; stream << " int initialize; /**< "; stream << "@"; stream << "brief whether to initialize the option structure "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " (default 1) */"; stream << "\n"; stream << indent_str; stream << " int check_required; /**< "; stream << "@"; stream << "brief whether to check that all required options were provided (default 1) */"; stream << "\n"; stream << indent_str; stream << " int check_ambiguity; /**< "; stream << "@"; stream << "brief whether to check for options already specified in the option structure "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " (default 0) */"; stream << "\n"; stream << indent_str; stream << " int print_errors; /**< "; stream << "@"; stream << "brief whether getopt_long should print an error message for a bad option (default 1) */"; stream << "\n"; stream << indent_str; stream << "} ;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the purpose string of the program */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_purpose;"; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the usage string of the program */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_usage;"; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief the description string of the program */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_description;"; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief all the lines making the help output */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_help[];"; stream << "\n"; stream << indent_str; if (has_hidden) { stream << "/** "; stream << "@"; stream << "brief all the lines making the full help output (including hidden options) */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_full_help[];"; stream << "\n"; stream << indent_str; } if (has_details) { stream << "/** "; stream << "@"; stream << "brief all the lines making the detailed help output (including hidden options and details) */"; stream << "\n"; stream << indent_str; stream << "extern const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_detailed_help[];"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The command line parser"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argc the number of command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argv the command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << " (int argc, char **argv,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The command line parser (version with additional parameters - deprecated)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argc the number of command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argv the command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param override whether to override possibly already present options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param initialize whether to initialize the option structure my_args_info"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param check_required whether to check that all required options were provided"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "deprecated use "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_ext() instead"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "2 (int argc, char **argv,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " int override, int initialize, int check_required);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The command line parser (version with additional parameters)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argc the number of command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param argv the command line options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param params additional parameters for the parser"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_ext (int argc, char **argv,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Save the contents of the option struct into an already open FILE stream."; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param outfile the stream where to dump options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the option struct to dump"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_dump(FILE *outfile,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Save the contents of the option struct into a (text) file."; stream << "\n"; stream << indent_str; stream << " * This file can be read by the config file parser (if generated by gengetopt)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param filename the file where to save"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the option struct to save"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_file_save(const char *filename,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Print the help"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_help(void);"; stream << "\n"; stream << indent_str; if (has_hidden) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Print the full help (including hidden options)"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_full_help(void);"; stream << "\n"; stream << indent_str; } if (has_details) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Print the detailed help (including hidden options and details)"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_detailed_help(void);"; stream << "\n"; stream << indent_str; } stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Print the version"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_version(void);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Initializes all the fields a "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params structure "; stream << "\n"; stream << indent_str; stream << " * to their default values"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param params the structure to initialize"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params_init(struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Allocates dynamically a "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params structure and initializes"; stream << "\n"; stream << indent_str; stream << " * all its fields to their default values"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return the created and initialized "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params structure"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *"; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params_create(void);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Initializes the passed "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " structure's fields"; stream << "\n"; stream << indent_str; stream << " * (also set default values for options that have a default)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure to initialize"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_init (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Deallocates the string fields of the "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " structure"; stream << "\n"; stream << indent_str; stream << " * (but does not deallocate the structure itself)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure to deallocate"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "void "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_free (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (generate_config_parser) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The config file parser (deprecated version)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param filename the name of the config file"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param override whether to override possibly already present options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param initialize whether to initialize the option structure my_args_info"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param check_required whether to check that all required options were provided"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "deprecated use "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_config_file() instead"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_configfile (const char *filename,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " int override, int initialize, int check_required);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The config file parser"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param filename the name of the config file"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param params additional parameters for the parser"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_config_file (const char *filename,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } if (generate_string_parser) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The string parser (interprets the passed string as a command line)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param cmdline the command line stirng"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param prog_name the name of the program that will be used to print"; stream << "\n"; stream << indent_str; stream << " * possible errors"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string (const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " const char *prog_name);"; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The string parser (version with additional parameters - deprecated)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param cmdline the command line stirng"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param prog_name the name of the program that will be used to print"; stream << "\n"; stream << indent_str; stream << " * possible errors"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param override whether to override possibly already present options"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param initialize whether to initialize the option structure my_args_info"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param check_required whether to check that all required options were provided"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "deprecated use "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string_ext() instead"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string2 (const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " const char *prog_name,"; stream << "\n"; stream << indent_str; stream << " int override, int initialize, int check_required);"; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The string parser (version with additional parameters)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param cmdline the command line stirng"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure where option information will be stored"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param prog_name the name of the program that will be used to print"; stream << "\n"; stream << indent_str; stream << " * possible errors"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param params additional parameters for the parser"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return 0 if everything went fine, NON 0 if an error took place"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string_ext (const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " const char *prog_name,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "/**"; stream << "\n"; stream << indent_str; stream << " * Checks that all the required options were specified"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param args_info the structure to check"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param prog_name the name of the program that will be used to print"; stream << "\n"; stream << indent_str; stream << " * possible errors"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "int "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " const char *prog_name);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (option_values_decl.size () > 0) generate_string (option_values_decl, stream, indent + indent_str.length ()); else generate_option_values_decl (stream, indent + indent_str.length ()); stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifdef __cplusplus"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "#endif /* __cplusplus */"; stream << "\n"; stream << indent_str; stream << "#endif /* "; generate_string (ifndefname, stream, indent + indent_str.length ()); stream << "_H */"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/check_modes.h0000664000175000017500000000423712044757616015071 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef CHECK_MODES_GEN_CLASS_H #define CHECK_MODES_GEN_CLASS_H #include #include using std::string; using std::ostream; class check_modes_gen_class { protected: string mode1_given_fields; string mode1_name; string mode1_options; string mode2_given_fields; string mode2_name; string mode2_options; public: check_modes_gen_class() { } check_modes_gen_class(const string &_mode1_given_fields, const string &_mode1_name, const string &_mode1_options, const string &_mode2_given_fields, const string &_mode2_name, const string &_mode2_options) : mode1_given_fields (_mode1_given_fields), mode1_name (_mode1_name), mode1_options (_mode1_options), mode2_given_fields (_mode2_given_fields), mode2_name (_mode2_name), mode2_options (_mode2_options) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_mode1_given_fields(const string &_mode1_given_fields) { mode1_given_fields = _mode1_given_fields; } void set_mode1_name(const string &_mode1_name) { mode1_name = _mode1_name; } void set_mode1_options(const string &_mode1_options) { mode1_options = _mode1_options; } void set_mode2_given_fields(const string &_mode2_given_fields) { mode2_given_fields = _mode2_given_fields; } void set_mode2_name(const string &_mode2_name) { mode2_name = _mode2_name; } void set_mode2_options(const string &_mode2_options) { mode2_options = _mode2_options; } void generate_check_modes(ostream &stream, unsigned int indent = 0); }; #endif // CHECK_MODES_GEN_CLASS_H gengetopt-2.22.6/src/skels/check_modes.cc0000664000175000017500000000415612045003074015206 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "check_modes.h" void check_modes_gen_class::generate_check_modes(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "if (args_info->"; generate_string (mode1_name, stream, indent + indent_str.length ()); stream << "_mode_counter && args_info->"; generate_string (mode2_name, stream, indent + indent_str.length ()); stream << "_mode_counter) {"; stream << "\n"; stream << indent_str; stream << " int "; generate_string (mode1_name, stream, indent + indent_str.length ()); stream << "_given[] = {"; generate_string (mode1_given_fields, stream, indent + indent_str.length ()); stream << " -1};"; stream << "\n"; stream << indent_str; stream << " const char *"; generate_string (mode1_name, stream, indent + indent_str.length ()); stream << "_desc[] = {"; generate_string (mode1_options, stream, indent + indent_str.length ()); stream << " 0};"; stream << "\n"; stream << indent_str; stream << " int "; generate_string (mode2_name, stream, indent + indent_str.length ()); stream << "_given[] = {"; generate_string (mode2_given_fields, stream, indent + indent_str.length ()); stream << " -1};"; stream << "\n"; stream << indent_str; stream << " const char *"; generate_string (mode2_name, stream, indent + indent_str.length ()); stream << "_desc[] = {"; generate_string (mode2_options, stream, indent + indent_str.length ()); stream << " 0};"; stream << "\n"; stream << indent_str; stream << " error_occurred += check_modes("; generate_string (mode1_name, stream, indent + indent_str.length ()); stream << "_given, "; generate_string (mode1_name, stream, indent + indent_str.length ()); stream << "_desc, "; generate_string (mode2_name, stream, indent + indent_str.length ()); stream << "_given, "; generate_string (mode2_name, stream, indent + indent_str.length ()); stream << "_desc);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/header.h_skel0000664000175000017500000002303312045003074015045 00000000000000/** @@file @header_file_name@.@header_file_ext@ * @@brief The header file for the command line option parser * generated by GNU Gengetopt @generator_version@ * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @@author GNU Gengetopt by Lorenzo Bettini */ #ifndef @ifndefname@_H #define @ifndefname@_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef @package_var_name@ /** @@brief the program name (used for printing errors) */ #define @package_var_name@ @package_var_val@ #endif #ifndef @package_var_name@_NAME /** @@brief the complete program name (used for help and version) */ @IF@ package_var_val:string != "PACKAGE" @THEN@ #define @package_var_name@_NAME @package_var_val@ @ELSE@ #ifdef PACKAGE_NAME #define @package_var_name@_NAME PACKAGE_NAME #else #define @package_var_name@_NAME PACKAGE #endif @ENDIF@ #endif #ifndef @version_var_name@ /** @@brief the program version */ #define @version_var_name@ @version_var_val@ #endif @enum_types:method{iteration=true}@ /** @@brief Where the command line options are stored */ struct @args_info@ { @option_arg:method@ @option_given:method@ @group_counters:method{iteration=true}@ @mode_counters:method{iteration=true}@ } ; /** @@brief The additional parameters to pass to parser functions */ struct @parser_name@_params { int override; /**< @@brief whether to override possibly already present options (default 0) */ int initialize; /**< @@brief whether to initialize the option structure @args_info@ (default 1) */ int check_required; /**< @@brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @@brief whether to check for options already specified in the option structure @args_info@ (default 0) */ int print_errors; /**< @@brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @@brief the purpose string of the program */ extern const char *@args_info@_purpose; /** @@brief the usage string of the program */ extern const char *@args_info@_usage; /** @@brief the description string of the program */ extern const char *@args_info@_description; /** @@brief all the lines making the help output */ extern const char *@args_info@_help[]; @IF@ has_hidden @THEN@ /** @@brief all the lines making the full help output (including hidden options) */ extern const char *@args_info@_full_help[]; @ENDIF@ @IF@ has_details @THEN@ /** @@brief all the lines making the detailed help output (including hidden options and details) */ extern const char *@args_info@_detailed_help[]; @ENDIF@ /** * The command line parser * @@param argc the number of command line options * @@param argv the command line options * @@param args_info the structure where option information will be stored * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@ (int argc, char **argv, struct @args_info@ *args_info); /** * The command line parser (version with additional parameters - deprecated) * @@param argc the number of command line options * @@param argv the command line options * @@param args_info the structure where option information will be stored * @@param override whether to override possibly already present options * @@param initialize whether to initialize the option structure my_args_info * @@param check_required whether to check that all required options were provided * @@return 0 if everything went fine, NON 0 if an error took place * @@deprecated use @parser_name@_ext() instead */ int @parser_name@2 (int argc, char **argv, struct @args_info@ *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @@param argc the number of command line options * @@param argv the command line options * @@param args_info the structure where option information will be stored * @@param params additional parameters for the parser * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_ext (int argc, char **argv, struct @args_info@ *args_info, struct @parser_name@_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @@param outfile the stream where to dump options * @@param args_info the option struct to dump * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_dump(FILE *outfile, struct @args_info@ *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @@param filename the file where to save * @@param args_info the option struct to save * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_file_save(const char *filename, struct @args_info@ *args_info); /** * Print the help */ void @parser_name@_print_help(void); @IF@ has_hidden @THEN@ /** * Print the full help (including hidden options) */ void @parser_name@_print_full_help(void); @ENDIF@ @IF@ has_details @THEN@ /** * Print the detailed help (including hidden options and details) */ void @parser_name@_print_detailed_help(void); @ENDIF@ /** * Print the version */ void @parser_name@_print_version(void); /** * Initializes all the fields a @parser_name@_params structure * to their default values * @@param params the structure to initialize */ void @parser_name@_params_init(struct @parser_name@_params *params); /** * Allocates dynamically a @parser_name@_params structure and initializes * all its fields to their default values * @@return the created and initialized @parser_name@_params structure */ struct @parser_name@_params *@parser_name@_params_create(void); /** * Initializes the passed @args_info@ structure's fields * (also set default values for options that have a default) * @@param args_info the structure to initialize */ void @parser_name@_init (struct @args_info@ *args_info); /** * Deallocates the string fields of the @args_info@ structure * (but does not deallocate the structure itself) * @@param args_info the structure to deallocate */ void @parser_name@_free (struct @args_info@ *args_info); @IF@ generate_config_parser @THEN@ /** * The config file parser (deprecated version) * @@param filename the name of the config file * @@param args_info the structure where option information will be stored * @@param override whether to override possibly already present options * @@param initialize whether to initialize the option structure my_args_info * @@param check_required whether to check that all required options were provided * @@return 0 if everything went fine, NON 0 if an error took place * @@deprecated use @parser_name@_config_file() instead */ int @parser_name@_configfile (const char *filename, struct @args_info@ *args_info, int override, int initialize, int check_required); /** * The config file parser * @@param filename the name of the config file * @@param args_info the structure where option information will be stored * @@param params additional parameters for the parser * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_config_file (const char *filename, struct @args_info@ *args_info, struct @parser_name@_params *params); @ENDIF@ @IF@ generate_string_parser @THEN@ /** * The string parser (interprets the passed string as a command line) * @@param cmdline the command line stirng * @@param args_info the structure where option information will be stored * @@param prog_name the name of the program that will be used to print * possible errors * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_string (const char *cmdline, struct @args_info@ *args_info, const char *prog_name); /** * The string parser (version with additional parameters - deprecated) * @@param cmdline the command line stirng * @@param args_info the structure where option information will be stored * @@param prog_name the name of the program that will be used to print * possible errors * @@param override whether to override possibly already present options * @@param initialize whether to initialize the option structure my_args_info * @@param check_required whether to check that all required options were provided * @@return 0 if everything went fine, NON 0 if an error took place * @@deprecated use @parser_name@_string_ext() instead */ int @parser_name@_string2 (const char *cmdline, struct @args_info@ *args_info, const char *prog_name, int override, int initialize, int check_required); /** * The string parser (version with additional parameters) * @@param cmdline the command line stirng * @@param args_info the structure where option information will be stored * @@param prog_name the name of the program that will be used to print * possible errors * @@param params additional parameters for the parser * @@return 0 if everything went fine, NON 0 if an error took place */ int @parser_name@_string_ext (const char *cmdline, struct @args_info@ *args_info, const char *prog_name, struct @parser_name@_params *params); @ENDIF@ /** * Checks that all the required options were specified * @@param args_info the structure to check * @@param prog_name the name of the program that will be used to print * possible errors * @@return */ int @parser_name@_required (struct @args_info@ *args_info, const char *prog_name); @option_values_decl:method{iteration=true}@ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* @ifndefname@_H */ gengetopt-2.22.6/src/skels/free_multiple.h0000664000175000017500000000305112044745036015443 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef FREE_MULTIPLE_GEN_CLASS_H #define FREE_MULTIPLE_GEN_CLASS_H #include #include using std::string; using std::ostream; class free_multiple_gen_class { protected: bool has_string_type; string opt_var; string structure; public: free_multiple_gen_class() : has_string_type (false) { } free_multiple_gen_class(bool _has_string_type, const string &_opt_var, const string &_structure) : has_string_type (_has_string_type), opt_var (_opt_var), structure (_structure) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_has_string_type(bool _has_string_type) { has_string_type = _has_string_type; } void set_opt_var(const string &_opt_var) { opt_var = _opt_var; } void set_structure(const string &_structure) { structure = _structure; } void generate_free_multiple(ostream &stream, unsigned int indent = 0); }; #endif // FREE_MULTIPLE_GEN_CLASS_H gengetopt-2.22.6/src/skels/multiple_opt_list.h0000664000175000017500000000233712044745036016365 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef MULTIPLE_OPT_LIST_GEN_CLASS_H #define MULTIPLE_OPT_LIST_GEN_CLASS_H #include #include using std::string; using std::ostream; class multiple_opt_list_gen_class { protected: string arg_name; public: multiple_opt_list_gen_class() { } multiple_opt_list_gen_class(const string &_arg_name) : arg_name (_arg_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg_name(const string &_arg_name) { arg_name = _arg_name; } void generate_multiple_opt_list(ostream &stream, unsigned int indent = 0); }; #endif // MULTIPLE_OPT_LIST_GEN_CLASS_H gengetopt-2.22.6/src/skels/exit_failure.cc0000664000175000017500000000170212044745036015426 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "exit_failure.h" void exit_failure_gen_class::generate_exit_failure(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (handle_error) { stream << "if (result == EXIT_FAILURE)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; indent = 4; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_free (args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << " exit (EXIT_FAILURE);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "return result;"; } gengetopt-2.22.6/src/skels/c_source.cc0000664000175000017500000046670712046536545014601 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "c_source.h" void c_source_gen_class::generate_c_source(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "/*"; stream << "\n"; stream << indent_str; stream << " File autogenerated by gengetopt "; generate_string (generator_version, stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; stream << " generated with the following command:"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (command_line, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " The developers of gengetopt consider the fixed text that goes in all"; stream << "\n"; stream << indent_str; stream << " gengetopt output files to be in the public domain:"; stream << "\n"; stream << indent_str; stream << " we make no copyright claims on it."; stream << "\n"; stream << indent_str; stream << "*/"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/* If we use autoconf. */"; stream << "\n"; stream << indent_str; stream << "#ifdef HAVE_CONFIG_H"; stream << "\n"; stream << indent_str; stream << "#include \"config.h\""; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#include "; stream << "\n"; stream << indent_str; stream << "#include "; stream << "\n"; stream << indent_str; stream << "#include "; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#ifndef FIX_UNUSED"; stream << "\n"; stream << indent_str; stream << "#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (( ! include_getopt )) { stream << "#include "; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "#include \""; generate_string (source_name, stream, indent + indent_str.length ()); stream << "."; generate_string (header_file_ext, stream, indent + indent_str.length ()); stream << "\""; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_purpose = \""; generate_string (purpose, stream, indent + indent_str.length ()); stream << "\";"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_usage = \"Usage: "; if (no_package) { stream << "\" "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << " \""; } generate_string (usage_string, stream, indent + indent_str.length ()); stream << "\";"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_versiontext = \""; generate_string (versiontext, stream, indent + indent_str.length ()); stream << "\";"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_description = \""; generate_string (description, stream, indent + indent_str.length ()); stream << "\";"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (( has_hidden || has_details )) { if (has_details) { stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_detailed_help[] = {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (detailed_help_option_print.size () > 0) generate_string (detailed_help_option_print, stream, indent + indent_str.length ()); else generate_detailed_help_option_print (stream, indent + indent_str.length ()); stream << " 0"; indent = 0; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; if (has_hidden) { stream << "static void"; stream << "\n"; stream << indent_str; stream << "init_full_help_array(void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (full_help_option_print.size () > 0) generate_string (full_help_option_print, stream, indent + indent_str.length ()); else generate_full_help_option_print (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_full_help["; generate_string (help_string_num, stream, indent + indent_str.length ()); stream << "];"; stream << "\n"; stream << indent_str; } } else { if (has_hidden) { stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_full_help[] = {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (full_help_option_print.size () > 0) generate_string (full_help_option_print, stream, indent + indent_str.length ()); else generate_full_help_option_print (stream, indent + indent_str.length ()); stream << " 0"; indent = 0; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; } } stream << "\n"; stream << indent_str; stream << "static void"; stream << "\n"; stream << indent_str; stream << "init_help_array(void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (help_option_print.size () > 0) generate_string (help_option_print, stream, indent + indent_str.length ()); else generate_help_option_print (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_help["; generate_string (help_string_num, stream, indent + indent_str.length ()); stream << "];"; stream << "\n"; stream << indent_str; } else { stream << "const char *"; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_help[] = {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (help_option_print.size () > 0) generate_string (help_option_print, stream, indent + indent_str.length ()); else generate_help_option_print (stream, indent + indent_str.length ()); stream << " 0"; indent = 0; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "typedef enum {ARG_NO"; stream << "\n"; stream << indent_str; if (has_arg_flag) { stream << " , ARG_FLAG"; stream << "\n"; stream << indent_str; } if (has_arg_string) { stream << " , ARG_STRING"; stream << "\n"; stream << indent_str; } if (has_arg_int) { stream << " , ARG_INT"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " , ARG_SHORT"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " , ARG_LONG"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " , ARG_FLOAT"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " , ARG_DOUBLE"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " , ARG_LONGDOUBLE"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " , ARG_LONGLONG"; stream << "\n"; stream << indent_str; } if (has_arg_enum) { stream << " , ARG_ENUM"; stream << "\n"; stream << indent_str; } stream << "} "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_arg_type;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void clear_given (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void clear_args (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal (int argc, char **argv, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params, const char *additional_error);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (check_required_options) { stream << "static int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required2 (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name, const char *additional_error);"; stream << "\n"; stream << indent_str; } if (cmd_list) { stream << "struct line_list"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char * string_arg;"; stream << "\n"; stream << indent_str; stream << " struct line_list * next;"; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static struct line_list *cmd_line_list = 0;"; stream << "\n"; stream << indent_str; stream << "static struct line_list *cmd_line_list_tmp = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static void"; stream << "\n"; stream << indent_str; stream << "free_cmd_list(void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " /* free the list of a previous call */"; stream << "\n"; stream << indent_str; stream << " if (cmd_line_list)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " while (cmd_line_list) {"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list->next;"; stream << "\n"; stream << indent_str; stream << " free (cmd_line_list_tmp->string_arg);"; stream << "\n"; stream << indent_str; stream << " free (cmd_line_list_tmp);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (option_values.size () > 0) generate_string (option_values, stream, indent + indent_str.length ()); else generate_option_values (stream, indent + indent_str.length ()); stream << indent_str; if (do_generate_strdup) { stream << "static char *"; stream << "\n"; stream << indent_str; stream << "gengetopt_strdup (const char *s);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "static"; stream << "\n"; stream << indent_str; stream << "void clear_given (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; indent = 2; if (given_init.size () > 0) generate_string (given_init, stream, indent + indent_str.length ()); else generate_given_init (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void clear_args (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " FIX_UNUSED (args_info);"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (clear_arg.size () > 0) generate_string (clear_arg, stream, indent + indent_str.length ()); else generate_clear_arg (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void init_args_info(struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; if (( has_hidden && has_details )) { stream << " init_full_help_array(); "; } stream << "\n"; stream << indent_str; if (( has_hidden || has_details )) { stream << " init_help_array(); "; } stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (init_args_info.size () > 0) generate_string (init_args_info, stream, indent + indent_str.length ()); else generate_init_args_info (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_version (void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " printf (\"%s %s\\n\","; stream << "\n"; stream << indent_str; stream << " (strlen("; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME) ? "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "_NAME : "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << "),"; stream << "\n"; stream << indent_str; indent = 5; stream << " "; generate_string (version_var_name, stream, indent + indent_str.length ()); stream << ");"; indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (strlen("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_versiontext) > 0)"; stream << "\n"; stream << indent_str; stream << " printf(\"\\n%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_versiontext);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static void print_help_common(void) {"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_version ();"; indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (strlen("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_purpose) > 0)"; stream << "\n"; stream << indent_str; stream << " printf(\"\\n%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_purpose);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (strlen("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_usage) > 0)"; stream << "\n"; stream << indent_str; stream << " printf(\"\\n%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_usage);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " printf(\"\\n\");"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (strlen("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_description) > 0)"; stream << "\n"; stream << indent_str; stream << " printf(\"%s\\n\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_description);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_help (void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i = 0;"; stream << "\n"; stream << indent_str; stream << " print_help_common();"; stream << "\n"; stream << indent_str; stream << " while ("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_help[i])"; stream << "\n"; stream << indent_str; stream << " printf(\"%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_help[i++]);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (has_hidden) { stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_full_help (void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i = 0;"; stream << "\n"; stream << indent_str; stream << " print_help_common();"; stream << "\n"; stream << indent_str; stream << " while ("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_full_help[i])"; stream << "\n"; stream << indent_str; stream << " printf(\"%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_full_help[i++]);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } if (has_details) { stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_print_detailed_help (void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i = 0;"; stream << "\n"; stream << indent_str; stream << " print_help_common();"; stream << "\n"; stream << indent_str; stream << " while ("; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_detailed_help[i])"; stream << "\n"; stream << indent_str; stream << " printf(\"%s\\n\", "; generate_string (args_info, stream, indent + indent_str.length ()); stream << "_detailed_help[i++]);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_init (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " clear_given (args_info);"; stream << "\n"; stream << indent_str; stream << " clear_args (args_info);"; stream << "\n"; stream << indent_str; stream << " init_args_info (args_info);"; stream << "\n"; stream << indent_str; if (handle_unamed) { stream << "\n"; stream << indent_str; stream << " args_info->inputs = 0;"; stream << "\n"; stream << indent_str; stream << " args_info->inputs_num = 0;"; stream << "\n"; stream << indent_str; } stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params_init(struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " if (params)"; stream << "\n"; stream << indent_str; stream << " { "; stream << "\n"; stream << indent_str; stream << " params->override = 0;"; stream << "\n"; stream << indent_str; stream << " params->initialize = 1;"; stream << "\n"; stream << indent_str; stream << " params->check_required = 1;"; stream << "\n"; stream << indent_str; stream << " params->check_ambiguity = 0;"; stream << "\n"; stream << indent_str; stream << " params->print_errors = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params_create(void)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params = "; stream << "\n"; stream << indent_str; stream << " (struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *)malloc(sizeof(struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params));"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params_init(params); "; indent = 0; stream << "\n"; stream << indent_str; stream << " return params;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (has_typed_options) { stream << "static void"; stream << "\n"; stream << indent_str; stream << "free_string_field (char **s)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " if (*s)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " free (*s);"; stream << "\n"; stream << indent_str; stream << " *s = 0;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (multiple_token_functions) { stream << "/** "; stream << "@"; stream << "brief generic value variable */"; stream << "\n"; stream << indent_str; stream << "union generic_value {"; stream << "\n"; stream << indent_str; if (( has_arg_int || has_arg_enum )) { stream << " int int_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " short short_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " long long_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " float float_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " double double_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " long double longdouble_arg;"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; stream << " long long int longlong_arg;"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << " long longlong_arg;"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; } stream << " char *string_arg;"; stream << "\n"; stream << indent_str; stream << " const char *default_string_arg;"; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/** "; stream << "@"; stream << "brief holds temporary values for multiple options */"; stream << "\n"; stream << indent_str; stream << "struct generic_list"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " union generic_value arg;"; stream << "\n"; stream << indent_str; stream << " char *orig;"; stream << "\n"; stream << indent_str; stream << " struct generic_list *next;"; stream << "\n"; stream << indent_str; stream << "};"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief add a node at the head of the list "; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static void add_node(struct generic_list **list) {"; stream << "\n"; stream << indent_str; stream << " struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list));"; stream << "\n"; stream << indent_str; stream << " new_node->next = *list;"; stream << "\n"; stream << indent_str; stream << " *list = new_node;"; stream << "\n"; stream << indent_str; stream << " new_node->arg.string_arg = 0;"; stream << "\n"; stream << indent_str; stream << " new_node->orig = 0;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (( ( ! multiple_options_all_string ) && multiple_token_functions )) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * The passed arg parameter is NOT set to 0 from this function"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static void"; stream << "\n"; stream << indent_str; stream << "free_multiple_field(unsigned int len, void *arg, char ***orig)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " unsigned int i;"; stream << "\n"; stream << indent_str; stream << " if (arg) {"; stream << "\n"; stream << indent_str; stream << " for (i = 0; i < len; ++i)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " free_string_field(&((*orig)[i]));"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free (arg);"; stream << "\n"; stream << indent_str; stream << " free (*orig);"; stream << "\n"; stream << indent_str; stream << " *orig = 0;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (multiple_options_string) { stream << "static void"; stream << "\n"; stream << indent_str; stream << "free_multiple_string_field(unsigned int len, char ***arg, char ***orig)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " unsigned int i;"; stream << "\n"; stream << indent_str; stream << " if (*arg) {"; stream << "\n"; stream << indent_str; stream << " for (i = 0; i < len; ++i)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " free_string_field(&((*arg)[i]));"; stream << "\n"; stream << indent_str; stream << " free_string_field(&((*orig)[i]));"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " free_string_field(&((*arg)[0])); /* free default string */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free (*arg);"; stream << "\n"; stream << indent_str; stream << " *arg = 0;"; stream << "\n"; stream << indent_str; stream << " free (*orig);"; stream << "\n"; stream << indent_str; stream << " *orig = 0;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } } stream << "\n"; stream << indent_str; stream << "static void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_release (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; if (handle_unamed) { stream << " unsigned int i;"; } stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (free.size () > 0) generate_string (free, stream, indent + indent_str.length ()); else generate_free (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; if (handle_unamed) { stream << " for (i = 0; i < args_info->inputs_num; ++i)"; stream << "\n"; stream << indent_str; stream << " free (args_info->inputs [i]);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (args_info->inputs_num)"; stream << "\n"; stream << indent_str; stream << " free (args_info->inputs);"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << " clear_given (args_info);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (check_possible_values) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param val the value to check"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param values the possible values"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "return the index of the matched value:"; stream << "\n"; stream << indent_str; stream << " * -1 if no value matched,"; stream << "\n"; stream << indent_str; stream << " * -2 if more than one value has matched"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static int"; stream << "\n"; stream << indent_str; stream << "check_possible_values(const char *val, const char *values[])"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i, found, last;"; stream << "\n"; stream << indent_str; stream << " size_t len;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!val) /* otherwise strlen() crashes below */"; stream << "\n"; stream << indent_str; stream << " return -1; /* -1 means no argument for the option */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " found = last = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " for (i = 0, len = strlen(val); values[i]; ++i)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (strncmp(val, values[i], len) == 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " ++found;"; stream << "\n"; stream << indent_str; stream << " last = i;"; stream << "\n"; stream << indent_str; stream << " if (strlen(values[i]) == len)"; stream << "\n"; stream << indent_str; stream << " return i; /* exact macth no need to check more */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (found == 1) /* one match: OK */"; stream << "\n"; stream << indent_str; stream << " return last;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return (found ? -2 : -1); /* return many values or none matched */"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "static void"; stream << "\n"; stream << indent_str; stream << "write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; if (check_possible_values) { stream << " int found = -1;"; stream << "\n"; stream << indent_str; } else { stream << " FIX_UNUSED (values);"; stream << "\n"; stream << indent_str; } stream << " if (arg) {"; stream << "\n"; stream << indent_str; if (check_possible_values) { stream << " if (values) {"; stream << "\n"; stream << indent_str; stream << " found = check_possible_values(arg, values); "; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (found >= 0)"; stream << "\n"; stream << indent_str; stream << " fprintf(outfile, \"%s=\\\"%s\\\" # %s\\n\", opt, arg, values[found]);"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " fprintf(outfile, \"%s=\\\"%s\\\"\\n\", opt, arg);"; stream << "\n"; stream << indent_str; } else { stream << " fprintf(outfile, \"%s=\\\"%s\\\"\\n\", opt, arg);"; stream << "\n"; stream << indent_str; } stream << " } else {"; stream << "\n"; stream << indent_str; stream << " fprintf(outfile, \"%s\\n\", opt);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (multiple_options) { stream << "static void"; stream << "\n"; stream << indent_str; stream << "write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[])"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " for (i = 0; i < len; ++i)"; stream << "\n"; stream << indent_str; stream << " write_into_file(outfile, opt, (arg ? arg[i] : 0), values);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_dump(FILE *outfile, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!outfile)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: cannot dump options to stream\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ");"; stream << "\n"; stream << indent_str; stream << " return EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (file_save_loop.size () > 0) generate_string (file_save_loop, stream, indent + indent_str.length ()); else generate_file_save_loop (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " i = EXIT_SUCCESS;"; stream << "\n"; stream << indent_str; stream << " return i;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_file_save(const char *filename, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " FILE *outfile;"; stream << "\n"; stream << indent_str; stream << " int i = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " outfile = fopen(filename, \"w\");"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!outfile)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: cannot open file for writing: %s\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename);"; stream << "\n"; stream << indent_str; stream << " return EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " i = "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_dump(outfile, args_info);"; stream << "\n"; stream << indent_str; stream << " fclose (outfile);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return i;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "void"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_free (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_release (args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (do_generate_strdup) { stream << "/** "; stream << "@"; stream << "brief replacement of strdup, which is not standard */"; stream << "\n"; stream << indent_str; stream << "char *"; stream << "\n"; stream << indent_str; stream << "gengetopt_strdup (const char *s)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char *result = 0;"; stream << "\n"; stream << indent_str; stream << " if (!s)"; stream << "\n"; stream << indent_str; stream << " return result;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " result = (char*)malloc(strlen(s) + 1);"; stream << "\n"; stream << indent_str; stream << " if (result == (char*)0)"; stream << "\n"; stream << indent_str; stream << " return (char*)0;"; stream << "\n"; stream << indent_str; stream << " strcpy(result, s);"; stream << "\n"; stream << indent_str; stream << " return result;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } if (multiple_token_functions) { stream << "static char *"; stream << "\n"; stream << indent_str; stream << "get_multiple_arg_token(const char *arg)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " const char *tok;"; stream << "\n"; stream << indent_str; stream << " char *ret;"; stream << "\n"; stream << indent_str; stream << " size_t len, num_of_escape, i, j;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!arg)"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " tok = strchr (arg, ',');"; stream << "\n"; stream << indent_str; stream << " num_of_escape = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* make sure it is not escaped */"; stream << "\n"; stream << indent_str; stream << " while (tok)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (*(tok-1) == '\\\\')"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* find the next one */"; stream << "\n"; stream << indent_str; stream << " tok = strchr (tok+1, ',');"; stream << "\n"; stream << indent_str; stream << " ++num_of_escape;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (tok)"; stream << "\n"; stream << indent_str; stream << " len = (size_t)(tok - arg + 1);"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " len = strlen (arg) + 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " len -= num_of_escape;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " ret = (char *) malloc (len);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " i = 0;"; stream << "\n"; stream << indent_str; stream << " j = 0;"; stream << "\n"; stream << indent_str; stream << " while (arg[i] && (j < len-1))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (arg[i] == '\\\\' && "; stream << "\n"; stream << indent_str; stream << " arg[ i + 1 ] && "; stream << "\n"; stream << indent_str; stream << " arg[ i + 1 ] == ',')"; stream << "\n"; stream << indent_str; stream << " ++i;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " ret[j++] = arg[i++];"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " ret[len-1] = '\\0';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return ret;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static const char *"; stream << "\n"; stream << indent_str; stream << "get_multiple_arg_token_next(const char *arg)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " const char *tok;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!arg)"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " tok = strchr (arg, ',');"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* make sure it is not escaped */"; stream << "\n"; stream << indent_str; stream << " while (tok)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (*(tok-1) == '\\\\')"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* find the next one */"; stream << "\n"; stream << indent_str; stream << " tok = strchr (tok+1, ',');"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (! tok || strlen(tok) == 1)"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return tok+1;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } if (multiple_options) { stream << "static int"; stream << "\n"; stream << indent_str; stream << "check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; stream << "check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int error_occurred = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (option_given && (min > 0 || max > 0))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (min > 0 && max > 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (min == max)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* specific occurrences */"; stream << "\n"; stream << indent_str; stream << " if (option_given != (unsigned int) min)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s option occurrences must be %d\\n\","; stream << "\n"; stream << indent_str; stream << " prog_name, option_desc, min);"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else if (option_given < (unsigned int) min"; stream << "\n"; stream << indent_str; stream << " || option_given > (unsigned int) max)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* range occurrences */"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s option occurrences must be between %d and %d\\n\","; stream << "\n"; stream << indent_str; stream << " prog_name, option_desc, min, max);"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else if (min > 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* at least check */"; stream << "\n"; stream << indent_str; stream << " if (option_given < min)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s option occurrences must be at least %d\\n\","; stream << "\n"; stream << indent_str; stream << " prog_name, option_desc, min);"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else if (max > 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " /* at most check */"; stream << "\n"; stream << indent_str; stream << " if (option_given > max)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s option occurrences must be at most %d\\n\","; stream << "\n"; stream << indent_str; stream << " prog_name, option_desc, max);"; stream << "\n"; stream << indent_str; stream << " error_occurred = 1;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; indent = 4; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " return error_occurred;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } if (reset_groups.size () > 0) generate_string (reset_groups, stream, indent + indent_str.length ()); else generate_reset_groups (stream, indent + indent_str.length ()); stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << " (int argc, char **argv, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " return "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "2 (argc, argv, args_info, 0, 1, 1);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_ext (int argc, char **argv, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int result;"; stream << "\n"; stream << indent_str; stream << " result = "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal (argc, argv, args_info, params, 0);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (final_exit, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "2 (int argc, char **argv, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, int override, int initialize, int check_required)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int result;"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params params;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " params.override = override;"; stream << "\n"; stream << indent_str; stream << " params.initialize = initialize;"; stream << "\n"; stream << indent_str; stream << " params.check_required = check_required;"; stream << "\n"; stream << indent_str; stream << " params.check_ambiguity = 0;"; stream << "\n"; stream << indent_str; stream << " params.print_errors = 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " result = "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal (argc, argv, args_info, ¶ms, 0);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (final_exit, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; if (check_required_options) { stream << " int result = EXIT_SUCCESS;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if ("; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required2(args_info, prog_name, 0) > 0)"; stream << "\n"; stream << indent_str; stream << " result = EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (final_exit, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; } else { stream << " FIX_UNUSED (args_info);"; stream << "\n"; stream << indent_str; stream << " FIX_UNUSED (prog_name);"; stream << "\n"; stream << indent_str; stream << " return EXIT_SUCCESS;"; stream << "\n"; stream << indent_str; } stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (check_required_options) { stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required2 (struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name, const char *additional_error)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int error_occurred = 0;"; stream << "\n"; stream << indent_str; stream << " FIX_UNUSED (additional_error);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* checks for required options */"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (handle_required.size () > 0) generate_string (handle_required, stream, indent + indent_str.length ()); else generate_handle_required (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << " /* checks for dependences among options */"; stream << "\n"; stream << indent_str; indent = 2; if (handle_dependencies.size () > 0) generate_string (handle_dependencies, stream, indent + indent_str.length ()); else generate_handle_dependencies (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return error_occurred;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } if (include_getopt) { if (custom_getopt.size () > 0) generate_string (custom_getopt, stream, indent + indent_str.length ()); else generate_custom_getopt (stream, indent + indent_str.length ()); stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "static char *package_name = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (( ! no_options )) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief updates an option"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param field the generic pointer to the field to update"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param orig_field the pointer to the orig field"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param field_given the pointer to the number of occurrence of this option"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param prev_given the pointer to the number of occurrence already seen"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param value the argument for this option (if null no arg was specified)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param possible_values the possible values for this option (if specified)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param default_value the default value (in case the option only accepts fixed values)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param arg_type the type of this option"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param check_ambiguity "; stream << "@"; stream << "see "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params.check_ambiguity"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param override "; stream << "@"; stream << "see "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params.override"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param no_free whether to free a possible previous value"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param multiple_option whether this is a multiple option"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param long_opt the corresponding long option"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param short_opt the corresponding short option (or '-' if none)"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param additional_error possible further error specification"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "int update_arg(void *field, char **orig_field,"; stream << "\n"; stream << indent_str; stream << " unsigned int *field_given, unsigned int *prev_given, "; stream << "\n"; stream << indent_str; stream << " char *value, const char *possible_values[],"; stream << "\n"; stream << indent_str; stream << " const char *default_value,"; stream << "\n"; stream << indent_str; indent = 15; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_arg_type arg_type,"; indent = 0; stream << "\n"; stream << indent_str; stream << " int check_ambiguity, int override,"; stream << "\n"; stream << indent_str; stream << " int no_free, int multiple_option,"; stream << "\n"; stream << indent_str; stream << " const char *long_opt, char short_opt,"; stream << "\n"; stream << indent_str; stream << " const char *additional_error)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char *stop_char = 0;"; stream << "\n"; stream << indent_str; stream << " const char *val = value;"; stream << "\n"; stream << indent_str; stream << " int found;"; stream << "\n"; stream << indent_str; if (has_arg_string) { stream << " char **string_field;"; stream << "\n"; stream << indent_str; } stream << " FIX_UNUSED (field);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " stop_char = 0;"; stream << "\n"; stream << indent_str; stream << " found = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (short_opt != '-')"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: `--%s' (`-%c') option given more than once%s\\n\", "; stream << "\n"; stream << indent_str; stream << " package_name, long_opt, short_opt,"; stream << "\n"; stream << indent_str; stream << " (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: `--%s' option given more than once%s\\n\", "; stream << "\n"; stream << indent_str; stream << " package_name, long_opt,"; stream << "\n"; stream << indent_str; stream << " (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " return 1; /* failure */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (check_possible_values) { stream << " if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " if (short_opt != '-')"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s argument, \\\"%s\\\", for option `--%s' (`-%c')%s\\n\", "; stream << "\n"; stream << indent_str; stream << " package_name, (found == -2) ? \"ambiguous\" : \"invalid\", value, long_opt, short_opt,"; stream << "\n"; stream << indent_str; stream << " (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: %s argument, \\\"%s\\\", for option `--%s'%s\\n\", "; stream << "\n"; stream << indent_str; stream << " package_name, (found == -2) ? \"ambiguous\" : \"invalid\", value, long_opt,"; stream << "\n"; stream << indent_str; stream << " (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " return 1; /* failure */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; } else { stream << " FIX_UNUSED (default_value);"; stream << "\n"; stream << indent_str; } stream << " "; stream << "\n"; stream << indent_str; stream << " if (field_given && *field_given && ! override)"; stream << "\n"; stream << indent_str; stream << " return 0;"; stream << "\n"; stream << indent_str; stream << " if (prev_given)"; stream << "\n"; stream << indent_str; stream << " (*prev_given)++;"; stream << "\n"; stream << indent_str; stream << " if (field_given)"; stream << "\n"; stream << indent_str; stream << " (*field_given)++;"; stream << "\n"; stream << indent_str; stream << " if (possible_values)"; stream << "\n"; stream << indent_str; stream << " val = possible_values[found];"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; if (has_arg_flag) { stream << " case ARG_FLAG:"; stream << "\n"; stream << indent_str; stream << " *((int *)field) = !*((int *)field);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_int) { stream << " case ARG_INT:"; stream << "\n"; stream << indent_str; stream << " if (val) *((int *)field) = strtol (val, &stop_char, 0);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " case ARG_SHORT:"; stream << "\n"; stream << indent_str; stream << " if (val) *((short *)field) = (short)strtol (val, &stop_char, 0);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " case ARG_LONG:"; stream << "\n"; stream << indent_str; stream << " if (val) *((long *)field) = (long)strtol (val, &stop_char, 0);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " case ARG_FLOAT:"; stream << "\n"; stream << indent_str; stream << " if (val) *((float *)field) = (float)strtod (val, &stop_char);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " case ARG_DOUBLE:"; stream << "\n"; stream << indent_str; stream << " if (val) *((double *)field) = strtod (val, &stop_char);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " case ARG_LONGDOUBLE:"; stream << "\n"; stream << indent_str; stream << " if (val) *((long double *)field) = (long double)strtod (val, &stop_char);"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " case ARG_LONGLONG:"; stream << "\n"; stream << indent_str; stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; stream << " if (val) *((long long int*)field) = (long long int) strtoll (val, &stop_char, 0);"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << " if (val) *((long *)field) = (long)strtol (val, &stop_char, 0);"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_enum) { stream << " case ARG_ENUM:"; stream << "\n"; stream << indent_str; stream << " if (val) *((int *)field) = found;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_string) { stream << " case ARG_STRING:"; stream << "\n"; stream << indent_str; stream << " if (val) {"; stream << "\n"; stream << indent_str; stream << " string_field = (char **)field;"; stream << "\n"; stream << indent_str; stream << " if (!no_free && *string_field)"; stream << "\n"; stream << indent_str; stream << " free (*string_field); /* free previous string */"; stream << "\n"; stream << indent_str; stream << " *string_field = gengetopt_strdup (val);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } stream << " default:"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " };"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (( ( ( ( ( ( has_arg_int || has_arg_short ) || has_arg_long ) || has_arg_float ) || has_arg_double ) || has_arg_longdouble ) || has_arg_longlong )) { stream << " /* check numeric conversion */"; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; if (has_arg_int) { stream << " case ARG_INT:"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " case ARG_SHORT:"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " case ARG_LONG:"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " case ARG_FLOAT:"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " case ARG_DOUBLE:"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " case ARG_LONGDOUBLE:"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " case ARG_LONGLONG:"; stream << "\n"; stream << indent_str; } stream << " if (val && !(stop_char && *stop_char == '\\0')) {"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s: invalid numeric value: %s\\n\", package_name, val);"; stream << "\n"; stream << indent_str; stream << " return 1; /* failure */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " default:"; stream << "\n"; stream << indent_str; stream << " ;"; stream << "\n"; stream << indent_str; stream << " };"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << " /* store the original value */"; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; stream << " case ARG_NO:"; stream << "\n"; stream << indent_str; if (has_arg_flag) { stream << " case ARG_FLAG:"; stream << "\n"; stream << indent_str; } stream << " break;"; stream << "\n"; stream << indent_str; stream << " default:"; stream << "\n"; stream << indent_str; stream << " if (value && orig_field) {"; stream << "\n"; stream << indent_str; stream << " if (no_free) {"; stream << "\n"; stream << indent_str; stream << " *orig_field = value;"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " if (*orig_field)"; stream << "\n"; stream << indent_str; stream << " free (*orig_field); /* free previous string */"; stream << "\n"; stream << indent_str; stream << " *orig_field = gengetopt_strdup (value);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " };"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return 0; /* OK */"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; if (multiple_token_functions) { stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief store information about a multiple option in a temporary list"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "param list where to (temporarily) store multiple options"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "int update_multiple_arg_temp(struct generic_list **list,"; stream << "\n"; stream << indent_str; stream << " unsigned int *prev_given, const char *val,"; stream << "\n"; stream << indent_str; stream << " const char *possible_values[], const char *default_value,"; stream << "\n"; stream << indent_str; indent = 15; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_arg_type arg_type,"; indent = 0; stream << "\n"; stream << indent_str; stream << " const char *long_opt, char short_opt,"; stream << "\n"; stream << indent_str; stream << " const char *additional_error)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " /* store single arguments */"; stream << "\n"; stream << indent_str; stream << " char *multi_token;"; stream << "\n"; stream << indent_str; stream << " const char *multi_next;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (arg_type == ARG_NO) {"; stream << "\n"; stream << indent_str; stream << " (*prev_given)++;"; stream << "\n"; stream << indent_str; stream << " return 0; /* OK */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " multi_token = get_multiple_arg_token(val);"; stream << "\n"; stream << indent_str; stream << " multi_next = get_multiple_arg_token_next (val);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " while (1)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " add_node (list);"; stream << "\n"; stream << indent_str; stream << " if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0,"; stream << "\n"; stream << indent_str; stream << " prev_given, multi_token, possible_values, default_value, "; stream << "\n"; stream << indent_str; stream << " arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) {"; stream << "\n"; stream << indent_str; stream << " if (multi_token) free(multi_token);"; stream << "\n"; stream << indent_str; stream << " return 1; /* failure */"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (multi_next)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " multi_token = get_multiple_arg_token(multi_next);"; stream << "\n"; stream << indent_str; stream << " multi_next = get_multiple_arg_token_next (multi_next);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return 0; /* OK */"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief free the passed list (including possible string argument)"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void free_list(struct generic_list *list, short string_arg)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " if (list) {"; stream << "\n"; stream << indent_str; stream << " struct generic_list *tmp;"; stream << "\n"; stream << indent_str; stream << " while (list)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " tmp = list;"; stream << "\n"; stream << indent_str; stream << " if (string_arg && list->arg.string_arg)"; stream << "\n"; stream << indent_str; stream << " free (list->arg.string_arg);"; stream << "\n"; stream << indent_str; stream << " if (list->orig)"; stream << "\n"; stream << indent_str; stream << " free (list->orig);"; stream << "\n"; stream << indent_str; stream << " list = list->next;"; stream << "\n"; stream << indent_str; stream << " free (tmp);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "/**"; stream << "\n"; stream << indent_str; stream << " * "; stream << "@"; stream << "brief updates a multiple option starting from the passed list"; stream << "\n"; stream << indent_str; stream << " */"; stream << "\n"; stream << indent_str; stream << "static"; stream << "\n"; stream << indent_str; stream << "void update_multiple_arg(void *field, char ***orig_field,"; stream << "\n"; stream << indent_str; stream << " unsigned int field_given, unsigned int prev_given, union generic_value *default_value,"; stream << "\n"; stream << indent_str; indent = 15; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_arg_type arg_type,"; indent = 0; stream << "\n"; stream << indent_str; stream << " struct generic_list *list)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i;"; stream << "\n"; stream << indent_str; stream << " struct generic_list *tmp;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (prev_given && list) {"; stream << "\n"; stream << indent_str; stream << " *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *));"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; if (( has_arg_int || has_arg_enum )) { if (has_arg_int) { stream << " case ARG_INT:"; stream << "\n"; stream << indent_str; } if (has_arg_enum) { stream << " case ARG_ENUM:"; stream << "\n"; stream << indent_str; } stream << " *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " case ARG_SHORT:"; stream << "\n"; stream << indent_str; stream << " *((short **)field) = (short *)realloc (*((short **)field), (field_given + prev_given) * sizeof (short)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " case ARG_LONG:"; stream << "\n"; stream << indent_str; stream << " *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " case ARG_FLOAT:"; stream << "\n"; stream << indent_str; stream << " *((float **)field) = (float *)realloc (*((float **)field), (field_given + prev_given) * sizeof (float)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " case ARG_DOUBLE:"; stream << "\n"; stream << indent_str; stream << " *((double **)field) = (double *)realloc (*((double **)field), (field_given + prev_given) * sizeof (double)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " case ARG_LONGDOUBLE:"; stream << "\n"; stream << indent_str; stream << " *((long double **)field) = (long double *)realloc (*((long double **)field), (field_given + prev_given) * sizeof (long double)); break;"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " case ARG_LONGLONG:"; stream << "\n"; stream << indent_str; stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; stream << " *((long long int **)field) = (long long int *)realloc (*((long long int **)field), (field_given + prev_given) * sizeof (long long int)); break;"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << " *((long **)field) = (long *)realloc (*((long **)field), (field_given + prev_given) * sizeof (long)); break;"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; } if (has_arg_string) { stream << " case ARG_STRING:"; stream << "\n"; stream << indent_str; stream << " *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break;"; stream << "\n"; stream << indent_str; } stream << " default:"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " };"; stream << "\n"; stream << indent_str; indent = 4; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " for (i = (prev_given - 1); i >= 0; --i)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " tmp = list;"; stream << "\n"; stream << indent_str; indent = 8; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; if (has_arg_int) { stream << " case ARG_INT:"; stream << "\n"; stream << indent_str; stream << " (*((int **)field))[i + field_given] = tmp->arg.int_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " case ARG_SHORT:"; stream << "\n"; stream << indent_str; stream << " (*((short **)field))[i + field_given] = tmp->arg.short_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " case ARG_LONG:"; stream << "\n"; stream << indent_str; stream << " (*((long **)field))[i + field_given] = tmp->arg.long_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " case ARG_FLOAT:"; stream << "\n"; stream << indent_str; stream << " (*((float **)field))[i + field_given] = tmp->arg.float_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " case ARG_DOUBLE:"; stream << "\n"; stream << indent_str; stream << " (*((double **)field))[i + field_given] = tmp->arg.double_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " case ARG_LONGDOUBLE:"; stream << "\n"; stream << indent_str; stream << " (*((long double **)field))[i + field_given] = tmp->arg.longdouble_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " case ARG_LONGLONG:"; stream << "\n"; stream << indent_str; stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; stream << " (*((long long int **)field))[i + field_given] = tmp->arg.longlong_arg; break;"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << " (*((long **)field))[i + field_given] = tmp->arg.longlong_arg; break;"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; } if (has_arg_enum) { stream << " case ARG_ENUM:"; stream << "\n"; stream << indent_str; stream << " (*((int **)field))[i + field_given] = tmp->arg.int_arg; break;"; stream << "\n"; stream << indent_str; } if (has_arg_string) { stream << " case ARG_STRING:"; stream << "\n"; stream << indent_str; stream << " (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break;"; stream << "\n"; stream << indent_str; } stream << " default:"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " } "; stream << "\n"; stream << indent_str; stream << " (*orig_field) [i + field_given] = list->orig;"; stream << "\n"; stream << indent_str; stream << " list = list->next;"; stream << "\n"; stream << indent_str; stream << " free (tmp);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " } else { /* set the default value */"; stream << "\n"; stream << indent_str; stream << " if (default_value && ! field_given) {"; stream << "\n"; stream << indent_str; stream << " switch(arg_type) {"; stream << "\n"; stream << indent_str; if (( has_arg_int || has_arg_enum )) { if (has_arg_int) { stream << " case ARG_INT:"; stream << "\n"; stream << indent_str; } if (has_arg_enum) { stream << " case ARG_ENUM:"; stream << "\n"; stream << indent_str; } stream << " if (! *((int **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((int **)field) = (int *)malloc (sizeof (int));"; stream << "\n"; stream << indent_str; stream << " (*((int **)field))[0] = default_value->int_arg; "; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_short) { stream << " case ARG_SHORT:"; stream << "\n"; stream << indent_str; stream << " if (! *((short **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((short **)field) = (short *)malloc (sizeof (short));"; stream << "\n"; stream << indent_str; stream << " (*((short **)field))[0] = default_value->short_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_long) { stream << " case ARG_LONG:"; stream << "\n"; stream << indent_str; stream << " if (! *((long **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((long **)field) = (long *)malloc (sizeof (long));"; stream << "\n"; stream << indent_str; stream << " (*((long **)field))[0] = default_value->long_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_float) { stream << " case ARG_FLOAT:"; stream << "\n"; stream << indent_str; stream << " if (! *((float **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((float **)field) = (float *)malloc (sizeof (float));"; stream << "\n"; stream << indent_str; stream << " (*((float **)field))[0] = default_value->float_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_double) { stream << " case ARG_DOUBLE:"; stream << "\n"; stream << indent_str; stream << " if (! *((double **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((double **)field) = (double *)malloc (sizeof (double));"; stream << "\n"; stream << indent_str; stream << " (*((double **)field))[0] = default_value->double_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_longdouble) { stream << " case ARG_LONGDOUBLE:"; stream << "\n"; stream << indent_str; stream << " if (! *((long double **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((long double **)field) = (long double *)malloc (sizeof (long double));"; stream << "\n"; stream << indent_str; stream << " (*((long double **)field))[0] = default_value->longdouble_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_longlong) { stream << " case ARG_LONGLONG:"; stream << "\n"; stream << indent_str; stream << "#if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)"; stream << "\n"; stream << indent_str; stream << " if (! *((long long int **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((long long int **)field) = (long long int *)malloc (sizeof (long long int));"; stream << "\n"; stream << indent_str; stream << " (*((long long int **)field))[0] = default_value->longlong_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "#else"; stream << "\n"; stream << indent_str; stream << " if (! *((long **)field)) {"; stream << "\n"; stream << indent_str; stream << " *((long **)field) = (long *)malloc (sizeof (long));"; stream << "\n"; stream << indent_str; stream << " (*((long **)field))[0] = default_value->longlong_arg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } if (has_arg_string) { stream << " case ARG_STRING:"; stream << "\n"; stream << indent_str; stream << " if (! *((char ***)field)) {"; stream << "\n"; stream << indent_str; stream << " *((char ***)field) = (char **)malloc (sizeof (char *));"; stream << "\n"; stream << indent_str; stream << " (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; } stream << " default: break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " if (!(*orig_field)) {"; stream << "\n"; stream << indent_str; stream << " *orig_field = (char **) malloc (sizeof (char *));"; stream << "\n"; stream << indent_str; stream << " (*orig_field)[0] = 0;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } if (has_modes) { stream << "\n"; stream << indent_str; stream << "static int check_modes("; stream << "\n"; stream << indent_str; stream << " int given1[], const char *options1[],"; stream << "\n"; stream << indent_str; stream << " int given2[], const char *options2[])"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i = 0, j = 0, errors = 0;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " while (given1[i] >= 0) {"; stream << "\n"; stream << indent_str; stream << " if (given1[i]) {"; stream << "\n"; stream << indent_str; stream << " while (given2[j] >= 0) {"; stream << "\n"; stream << indent_str; stream << " if (given2[j]) {"; stream << "\n"; stream << indent_str; stream << " ++errors;"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s: option %s conflicts with option %s\\n\","; stream << "\n"; stream << indent_str; stream << " package_name, options1[i], options2[j]);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " ++j;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " ++i;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " return errors;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal ("; stream << "\n"; stream << indent_str; stream << " int argc, char **argv, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params, const char *additional_error)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int c; /* Character of the parsed option. */"; stream << "\n"; stream << indent_str; if (multiple_options_with_default) { stream << " union generic_value multiple_default_value;"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; indent = 2; if (list_def.size () > 0) generate_string (list_def, stream, indent + indent_str.length ()); else generate_list_def (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << " int error_occurred = 0;"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " local_args_info;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " int override;"; stream << "\n"; stream << indent_str; stream << " int initialize;"; stream << "\n"; stream << indent_str; stream << " int check_required;"; stream << "\n"; stream << indent_str; stream << " int check_ambiguity;"; stream << "\n"; stream << indent_str; if (include_getopt) { stream << "\n"; stream << indent_str; stream << " char *optarg;"; stream << "\n"; stream << indent_str; stream << " int optind;"; stream << "\n"; stream << indent_str; stream << " int opterr;"; stream << "\n"; stream << indent_str; stream << " int optopt;"; stream << "\n"; stream << indent_str; } stream << " "; stream << "\n"; stream << indent_str; stream << " package_name = argv[0];"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " override = params->override;"; stream << "\n"; stream << indent_str; stream << " initialize = params->initialize;"; stream << "\n"; stream << indent_str; stream << " check_required = params->check_required;"; stream << "\n"; stream << indent_str; stream << " check_ambiguity = params->check_ambiguity;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (initialize)"; stream << "\n"; stream << indent_str; indent = 4; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_init (args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_init (&local_args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " optarg = 0;"; stream << "\n"; stream << indent_str; stream << " optind = 0;"; stream << "\n"; stream << indent_str; stream << " opterr = params->print_errors;"; stream << "\n"; stream << indent_str; stream << " optopt = '?';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " while (1)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " int option_index = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " static struct option long_options[] = {"; stream << "\n"; stream << indent_str; indent = 8; if (long_option_struct.size () > 0) generate_string (long_option_struct, stream, indent + indent_str.length ()); else generate_long_option_struct (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << " { 0, 0, 0, 0 }"; stream << "\n"; stream << indent_str; stream << " };"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (include_getopt) { stream << " custom_optarg = optarg;"; stream << "\n"; stream << indent_str; stream << " custom_optind = optind;"; stream << "\n"; stream << indent_str; stream << " custom_opterr = opterr;"; stream << "\n"; stream << indent_str; stream << " custom_optopt = optopt;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " c = custom_getopt_long (argc, argv, \""; generate_string (getopt_string, stream, indent + indent_str.length ()); stream << "\", long_options, &option_index);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " optarg = custom_optarg;"; stream << "\n"; stream << indent_str; stream << " optind = custom_optind;"; stream << "\n"; stream << indent_str; stream << " opterr = custom_opterr;"; stream << "\n"; stream << indent_str; stream << " optopt = custom_optopt;"; stream << "\n"; stream << indent_str; } else { stream << " c = getopt_long (argc, argv, \""; generate_string (getopt_string, stream, indent + indent_str.length ()); stream << "\", long_options, &option_index);"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << " if (c == -1) break; /* Exit from `while (1)' loop. */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " switch (c)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; indent = 8; if (handle_option.size () > 0) generate_string (handle_option, stream, indent + indent_str.length ()); else generate_handle_option (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "\n"; stream << indent_str; stream << " case 0: /* Long option with no short option */"; stream << "\n"; stream << indent_str; indent = 10; if (handle_no_short_option.size () > 0) generate_string (handle_no_short_option, stream, indent + indent_str.length ()); else generate_handle_no_short_option (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; if (handle_question_mark) { stream << " case '?': /* Invalid option. */"; stream << "\n"; stream << indent_str; stream << " /* `getopt_long' already printed an error message. */"; stream << "\n"; stream << indent_str; stream << " goto failure;"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << " default: /* bug: option not considered. */"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: option unknown: %c%s\\n\", "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", c, (additional_error ? additional_error : \"\"));"; stream << "\n"; stream << indent_str; stream << " abort ();"; stream << "\n"; stream << indent_str; stream << " } /* switch */"; stream << "\n"; stream << indent_str; stream << " } /* while */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; if (handle_group.size () > 0) generate_string (handle_group, stream, indent + indent_str.length ()); else generate_handle_group (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "\n"; stream << indent_str; indent = 2; if (multiple_fill_array.size () > 0) generate_string (multiple_fill_array, stream, indent + indent_str.length ()); else generate_multiple_fill_array (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; indent = 2; if (update_multiple_given.size () > 0) generate_string (update_multiple_given, stream, indent + indent_str.length ()); else generate_update_multiple_given (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; indent = 2; if (check_modes.size () > 0) generate_string (check_modes, stream, indent + indent_str.length ()); else generate_check_modes (stream, indent + indent_str.length ()); indent = 0; stream << indent_str; stream << "\n"; stream << indent_str; if (check_required_options) { stream << " if (check_required)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " error_occurred += "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_required2 (args_info, argv[0], additional_error);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_release (&local_args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if ( error_occurred )"; stream << "\n"; stream << indent_str; stream << " return (EXIT_FAILURE);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (handle_unamed) { stream << " if (optind < argc)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " int i = 0 ;"; stream << "\n"; stream << indent_str; stream << " int found_prog_name = 0;"; stream << "\n"; stream << indent_str; stream << " /* whether program name, i.e., argv[0], is in the remaining args"; stream << "\n"; stream << indent_str; stream << " (this may happen with some implementations of getopt,"; stream << "\n"; stream << indent_str; stream << " but surely not with the one included by gengetopt) */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; if (include_getopt) { } else { stream << " i = optind;"; stream << "\n"; stream << indent_str; stream << " while (i < argc)"; stream << "\n"; stream << indent_str; stream << " if (argv[i++] == argv[0]) {"; stream << "\n"; stream << indent_str; stream << " found_prog_name = 1;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " i = 0;"; stream << "\n"; stream << indent_str; } stream << "\n"; stream << indent_str; stream << " args_info->inputs_num = argc - optind - found_prog_name;"; stream << "\n"; stream << indent_str; stream << " args_info->inputs ="; stream << "\n"; stream << indent_str; stream << " (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;"; stream << "\n"; stream << indent_str; stream << " while (optind < argc)"; stream << "\n"; stream << indent_str; if (include_getopt) { stream << " args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;"; stream << "\n"; stream << indent_str; } else { stream << " if (argv[optind++] != argv[0])"; stream << "\n"; stream << indent_str; stream << " args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;"; stream << "\n"; stream << indent_str; } stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } stream << " return 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "failure:"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; if (list_free.size () > 0) generate_string (list_free, stream, indent + indent_str.length ()); else generate_list_free (stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_release (&local_args_info);"; indent = 0; stream << "\n"; stream << indent_str; stream << " return (EXIT_FAILURE);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; if (conf_parser) { stream << "\n"; stream << indent_str; stream << "#ifndef CONFIG_FILE_LINE_SIZE"; stream << "\n"; stream << indent_str; stream << "#define CONFIG_FILE_LINE_SIZE 2048"; stream << "\n"; stream << indent_str; stream << "#endif"; stream << "\n"; stream << indent_str; stream << "#define ADDITIONAL_ERROR \" in configuration file \""; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "#define CONFIG_FILE_LINE_BUFFER_SIZE (CONFIG_FILE_LINE_SIZE+3)"; stream << "\n"; stream << indent_str; stream << "/* 3 is for \"--\" and \"=\" */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "static int"; stream << "\n"; stream << indent_str; stream << "_"; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_configfile (const char *filename, int *my_argc)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " FILE* file;"; stream << "\n"; stream << indent_str; stream << " char my_argv[CONFIG_FILE_LINE_BUFFER_SIZE+1];"; stream << "\n"; stream << indent_str; stream << " char linebuf[CONFIG_FILE_LINE_SIZE];"; stream << "\n"; stream << indent_str; stream << " int line_num = 0;"; stream << "\n"; stream << indent_str; stream << " int result = 0, equal;"; stream << "\n"; stream << indent_str; stream << " char *fopt, *farg;"; stream << "\n"; stream << indent_str; stream << " char *str_index;"; stream << "\n"; stream << indent_str; stream << " size_t len, next_token;"; stream << "\n"; stream << indent_str; stream << " char delimiter;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if ((file = fopen(filename, \"r\")) == 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s: Error opening configuration file '%s'\\n\","; stream << "\n"; stream << indent_str; indent = 15; stream << " "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename);"; indent = 0; stream << "\n"; stream << indent_str; stream << " return EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != 0)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " ++line_num;"; stream << "\n"; stream << indent_str; stream << " my_argv[0] = '\\0';"; stream << "\n"; stream << indent_str; stream << " len = strlen(linebuf);"; stream << "\n"; stream << indent_str; stream << " if (len > (CONFIG_FILE_LINE_BUFFER_SIZE-1))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf (stderr, \"%s:%s:%d: Line too long in configuration file\\n\","; stream << "\n"; stream << indent_str; indent = 19; stream << " "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename, line_num);"; indent = 0; stream << "\n"; stream << indent_str; stream << " result = EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* find first non-whitespace character in the line */"; stream << "\n"; stream << indent_str; stream << " next_token = strspn (linebuf, \" \\t\\r\\n\");"; stream << "\n"; stream << indent_str; stream << " str_index = linebuf + next_token;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if ( str_index[0] == '\\0' || str_index[0] == '#')"; stream << "\n"; stream << indent_str; stream << " continue; /* empty line or comment line is skipped */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " fopt = str_index;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* truncate fopt at the end of the first non-valid character */"; stream << "\n"; stream << indent_str; stream << " next_token = strcspn (fopt, \" \\t\\r\\n=\");"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (fopt[next_token] == '\\0') /* the line is over */"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " farg = 0;"; stream << "\n"; stream << indent_str; stream << " equal = 0;"; stream << "\n"; stream << indent_str; stream << " goto noarg;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* remember if equal sign is present */"; stream << "\n"; stream << indent_str; stream << " equal = (fopt[next_token] == '=');"; stream << "\n"; stream << indent_str; stream << " fopt[next_token++] = '\\0';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* advance pointers to the next token after the end of fopt */"; stream << "\n"; stream << indent_str; stream << " next_token += strspn (fopt + next_token, \" \\t\\r\\n\");"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* check for the presence of equal sign, and if so, skip it */"; stream << "\n"; stream << indent_str; stream << " if ( !equal )"; stream << "\n"; stream << indent_str; stream << " if ((equal = (fopt[next_token] == '=')))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " next_token++;"; stream << "\n"; stream << indent_str; stream << " next_token += strspn (fopt + next_token, \" \\t\\r\\n\");"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " str_index += next_token;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* find argument */"; stream << "\n"; stream << indent_str; stream << " farg = str_index;"; stream << "\n"; stream << indent_str; stream << " if ( farg[0] == '\\\"' || farg[0] == '\\'' )"; stream << "\n"; stream << indent_str; stream << " { /* quoted argument */"; stream << "\n"; stream << indent_str; stream << " str_index = strchr (++farg, str_index[0] ); /* skip opening quote */"; stream << "\n"; stream << indent_str; stream << " if (! str_index)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf"; stream << "\n"; stream << indent_str; stream << " (stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s:%s:%d: unterminated string in configuration file\\n\","; stream << "\n"; stream << indent_str; indent = 17; stream << " "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename, line_num);"; indent = 0; stream << "\n"; stream << indent_str; stream << " result = EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " { /* read up the remaining part up to a delimiter */"; stream << "\n"; stream << indent_str; stream << " next_token = strcspn (farg, \" \\t\\r\\n#\\'\\\"\");"; stream << "\n"; stream << indent_str; stream << " str_index += next_token;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* truncate farg at the delimiter and store it for further check */"; stream << "\n"; stream << indent_str; stream << " delimiter = *str_index, *str_index++ = '\\0';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* everything but comment is illegal at the end of line */"; stream << "\n"; stream << indent_str; stream << " if (delimiter != '\\0' && delimiter != '#')"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " str_index += strspn(str_index, \" \\t\\r\\n\");"; stream << "\n"; stream << indent_str; stream << " if (*str_index != '\\0' && *str_index != '#')"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " fprintf"; stream << "\n"; stream << indent_str; stream << " (stderr,"; stream << "\n"; stream << indent_str; stream << " \"%s:%s:%d: malformed string in configuration file\\n\","; stream << "\n"; stream << indent_str; indent = 17; stream << " "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename, line_num);"; indent = 0; stream << "\n"; stream << indent_str; stream << " result = EXIT_FAILURE;"; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " noarg:"; stream << "\n"; stream << indent_str; stream << " if (!strcmp(fopt,\"include\")) {"; stream << "\n"; stream << indent_str; stream << " if (farg && *farg) {"; stream << "\n"; stream << indent_str; stream << " result = _"; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_configfile(farg, my_argc);"; stream << "\n"; stream << indent_str; stream << " } else {"; stream << "\n"; stream << indent_str; stream << " fprintf(stderr, \"%s:%s:%d: include requires a filename argument.\\n\","; stream << "\n"; stream << indent_str; indent = 18; stream << " "; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ", filename, line_num);"; indent = 0; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " continue;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " len = strlen(fopt);"; stream << "\n"; stream << indent_str; stream << " strcat (my_argv, len > 1 ? \"--\" : \"-\");"; stream << "\n"; stream << indent_str; stream << " strcat (my_argv, fopt);"; stream << "\n"; stream << indent_str; stream << " if (len > 1 && ((farg && *farg) || equal))"; stream << "\n"; stream << indent_str; stream << " strcat (my_argv, \"=\");"; stream << "\n"; stream << indent_str; stream << " if (farg && *farg)"; stream << "\n"; stream << indent_str; stream << " strcat (my_argv, farg);"; stream << "\n"; stream << indent_str; stream << " ++(*my_argc);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp->next = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list_tmp;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list->string_arg = gengetopt_strdup(my_argv);"; stream << "\n"; stream << indent_str; stream << " } /* while */"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (file)"; stream << "\n"; stream << indent_str; stream << " fclose(file);"; stream << "\n"; stream << indent_str; stream << " return result;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_configfile ("; stream << "\n"; stream << indent_str; stream << " const char *filename,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " int override, int initialize, int check_required)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params params;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " params.override = override;"; stream << "\n"; stream << indent_str; stream << " params.initialize = initialize;"; stream << "\n"; stream << indent_str; stream << " params.check_required = check_required;"; stream << "\n"; stream << indent_str; stream << " params.check_ambiguity = 0;"; stream << "\n"; stream << indent_str; stream << " params.print_errors = 1;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " return "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_config_file (filename, args_info, ¶ms);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_config_file (const char *filename,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " int i, result;"; stream << "\n"; stream << indent_str; stream << " int my_argc = 1;"; stream << "\n"; stream << indent_str; stream << " char **my_argv_arg;"; stream << "\n"; stream << indent_str; stream << " char *additional_error;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " /* store the program name */"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp->next = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list_tmp;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list->string_arg = gengetopt_strdup ("; generate_string (package_var_name, stream, indent + indent_str.length ()); stream << ");"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " result = _"; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_configfile(filename, &my_argc);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (result != EXIT_FAILURE) {"; stream << "\n"; stream << indent_str; stream << " my_argv_arg = (char **) malloc((my_argc+1) * sizeof(char *));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " for (i = my_argc - 1; i >= 0; --i) {"; stream << "\n"; stream << indent_str; stream << " my_argv_arg[i] = cmd_line_list_tmp->string_arg;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = cmd_line_list_tmp->next;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " my_argv_arg[my_argc] = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " additional_error = (char *)malloc(strlen(filename) + strlen(ADDITIONAL_ERROR) + 1);"; stream << "\n"; stream << indent_str; stream << " strcpy (additional_error, ADDITIONAL_ERROR);"; stream << "\n"; stream << indent_str; stream << " strcat (additional_error, filename);"; stream << "\n"; stream << indent_str; stream << " result ="; stream << "\n"; stream << indent_str; indent = 6; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal (my_argc, my_argv_arg, args_info,"; indent = 0; stream << "\n"; stream << indent_str; stream << " params,"; stream << "\n"; stream << indent_str; stream << " additional_error);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free (additional_error);"; stream << "\n"; stream << indent_str; stream << " free (my_argv_arg);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free_cmd_list();"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (final_exit, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; } if (generate_string_parser) { stream << "\n"; stream << indent_str; stream << "static unsigned int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_create_argv(const char *cmdline_, char ***argv_ptr, const char *prog_name)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char *cmdline, *p;"; stream << "\n"; stream << indent_str; stream << " size_t n = 0, j;"; stream << "\n"; stream << indent_str; stream << " int i;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " if (prog_name) {"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp->next = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list_tmp;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list->string_arg = gengetopt_strdup (prog_name);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " ++n;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " cmdline = gengetopt_strdup(cmdline_);"; stream << "\n"; stream << indent_str; stream << " p = cmdline;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " while (p && strlen(p))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " j = strcspn(p, \" \\t\");"; stream << "\n"; stream << indent_str; stream << " ++n;"; stream << "\n"; stream << indent_str; stream << " if (j && j < strlen(p))"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " p[j] = '\\0';"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp->next = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list_tmp;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list->string_arg = gengetopt_strdup (p);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " p += (j+1);"; stream << "\n"; stream << indent_str; stream << " p += strspn(p, \" \\t\");"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " else"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp->next = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list = cmd_line_list_tmp;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list->string_arg = gengetopt_strdup (p);"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " break;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " *argv_ptr = (char **) malloc((n + 1) * sizeof(char *));"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = cmd_line_list;"; stream << "\n"; stream << indent_str; stream << " for (i = (n-1); i >= 0; --i)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " (*argv_ptr)[i] = cmd_line_list_tmp->string_arg;"; stream << "\n"; stream << indent_str; stream << " cmd_line_list_tmp = cmd_line_list_tmp->next;"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " (*argv_ptr)[n] = 0;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free(cmdline);"; stream << "\n"; stream << indent_str; stream << " return n;"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string(const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " return "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string2(cmdline, args_info, prog_name, 0, 1, 1);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string2(const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name,"; stream << "\n"; stream << indent_str; stream << " int override, int initialize, int check_required)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params params;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " params.override = override;"; stream << "\n"; stream << indent_str; stream << " params.initialize = initialize;"; stream << "\n"; stream << indent_str; stream << " params.check_required = check_required;"; stream << "\n"; stream << indent_str; stream << " params.check_ambiguity = 0;"; stream << "\n"; stream << indent_str; stream << " params.print_errors = 1;"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " return "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string_ext(cmdline, args_info, prog_name, ¶ms);"; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << "int"; stream << "\n"; stream << indent_str; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_string_ext(const char *cmdline, struct "; generate_string (args_info, stream, indent + indent_str.length ()); stream << " *args_info, const char *prog_name,"; stream << "\n"; stream << indent_str; stream << " struct "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_params *params)"; stream << "\n"; stream << indent_str; stream << "{"; stream << "\n"; stream << indent_str; stream << " char **argv_ptr = 0;"; stream << "\n"; stream << indent_str; stream << " int result;"; stream << "\n"; stream << indent_str; stream << " unsigned int argc;"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " argc = "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_create_argv(cmdline, &argv_ptr, prog_name);"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " result ="; stream << "\n"; stream << indent_str; indent = 4; stream << " "; generate_string (parser_name, stream, indent + indent_str.length ()); stream << "_internal (argc, argv_ptr, args_info, params, 0);"; indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; stream << " if (argv_ptr)"; stream << "\n"; stream << indent_str; stream << " {"; stream << "\n"; stream << indent_str; stream << " free (argv_ptr);"; stream << "\n"; stream << indent_str; stream << " }"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; stream << " free_cmd_list();"; stream << "\n"; stream << indent_str; indent = 2; stream << " "; indent = 0; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (final_exit, stream, indent + indent_str.length ()); indent = 0; stream << "\n"; stream << indent_str; stream << "}"; stream << "\n"; stream << indent_str; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/handle_version.h0000664000175000017500000000260012044745036015606 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef HANDLE_VERSION_GEN_CLASS_H #define HANDLE_VERSION_GEN_CLASS_H #include #include using std::string; using std::ostream; class handle_version_gen_class { protected: string parser_name; bool short_opt; public: handle_version_gen_class() : short_opt (false) { } handle_version_gen_class(const string &_parser_name, bool _short_opt) : parser_name (_parser_name), short_opt (_short_opt) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_parser_name(const string &_parser_name) { parser_name = _parser_name; } void set_short_opt(bool _short_opt) { short_opt = _short_opt; } void generate_handle_version(ostream &stream, unsigned int indent = 0); }; #endif // HANDLE_VERSION_GEN_CLASS_H gengetopt-2.22.6/src/skels/group_counter.h0000664000175000017500000000250512044745036015505 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef GROUP_COUNTER_GEN_CLASS_H #define GROUP_COUNTER_GEN_CLASS_H #include #include using std::string; using std::ostream; class group_counter_gen_class { protected: string group_name; string name; public: group_counter_gen_class() { } group_counter_gen_class(const string &_group_name, const string &_name) : group_name (_group_name), name (_name) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_group_name(const string &_group_name) { group_name = _group_name; } void set_name(const string &_name) { name = _name; } void generate_group_counter(ostream &stream, unsigned int indent = 0); }; #endif // GROUP_COUNTER_GEN_CLASS_H gengetopt-2.22.6/src/skels/file_save.h_skel0000664000175000017500000000021512044745036015561 00000000000000if (args_info->@given@) write_into_file(outfile, "@opt_name@", @IF@ arg:string = "" @THEN@ 0, 0 @ELSE@ args_info->@arg@, @values@@ENDIF@); gengetopt-2.22.6/src/skels/multiple_fill_array.cc0000664000175000017500000000333012044745036017004 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "multiple_fill_array.h" void multiple_fill_array_gen_class::generate_multiple_fill_array(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (( default_value != "0" )) { stream << "multiple_default_value."; if (( arg_type == "ARG_STRING" )) { stream << "default_"; } generate_string (type, stream, indent + indent_str.length ()); stream << "_arg = "; generate_string (default_value, stream, indent + indent_str.length ()); stream << ";"; stream << "\n"; stream << indent_str; } stream << "update_multiple_arg((void *)&(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_arg),"; stream << "\n"; stream << indent_str; stream << " &(args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_orig), args_info->"; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given,"; stream << "\n"; stream << indent_str; stream << " local_args_info."; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_given, "; if (( default_value != "0" )) { stream << "&multiple_default_value"; } else { stream << "0"; } stream << ","; stream << "\n"; stream << indent_str; indent = 2; stream << " "; generate_string (arg_type, stream, indent + indent_str.length ()); stream << ", "; generate_string (option_var_name, stream, indent + indent_str.length ()); stream << "_list);"; } gengetopt-2.22.6/src/skels/multiple_opt_list.h_skel0000664000175000017500000000005512044745036017376 00000000000000struct generic_list * @arg_name@_list = NULL;gengetopt-2.22.6/src/skels/Makefile.am0000664000175000017500000000527412044745036014503 00000000000000# Copyright (C) 1999-2008 Free Software Foundation, Inc. # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # if gengen is not installed we simply ignore the changes SUFFIXES = .h_skel if NO_GENGEN #.h_skel.cc: # echo "Not regenerating $@ since gengen is not installed" # better not to use touch, otherwise we will create an empty file in # the build directory # touch $@ else GENERATE = $(GENGEN) .h_skel.cc: name="`echo $* | sed 's/^.*\///g'`"; \ echo "$$name"; \ $(GENERATE) -i $< -F $*.h -f $$name --separate-files --expand-tabs --output-dir=$(srcdir) --force endif INCLUDES = -I@top_srcdir@/src noinst_LTLIBRARIES = libgen.la libgen_la_SOURCES = $(BUILT_SOURCES) BUILT_SOURCES = header.h header.cc c_source.h c_source.cc \ handle_help.h handle_version.h handle_help.cc handle_version.cc \ generic_option.h required_option.h dependant_option.h \ generic_option.cc required_option.cc dependant_option.cc \ group_counter.h group_option.h \ group_counter.cc group_option.cc \ print_help_string.h print_help_string.cc \ multiple_opt_list.cc multiple_opt_list.h \ multiple_fill_array.cc multiple_fill_array.h \ copyright.cc copyright.h \ free_string.cc free_string.h \ free_multiple.cc free_multiple.h \ reset_group.cc reset_group.h \ exit_failure.cc exit_failure.h \ update_given.cc update_given.h \ option_arg.cc option_arg.h \ given_field.cc given_field.h \ clear_given.cc clear_given.h \ clear_arg.cc clear_arg.h \ free_list.cc free_list.h \ file_save.cc file_save.h \ file_save_multiple.cc file_save_multiple.h \ init_args_info.cc init_args_info.h \ custom_getopt_gen.cc custom_getopt_gen.h \ check_modes.cc check_modes.h \ enum_decl.cc enum_decl.h EXTRA_DIST = header.h_skel c_source.h_skel handle_help.h_skel \ handle_version.h_skel generic_option.h_skel \ required_option.h_skel dependant_option.h_skel \ group_counter.h_skel group_option.h_skel \ print_help_string.h_skel \ multiple_opt_list.h_skel \ multiple_fill_array.h_skel \ copyright.h_skel free_string.h_skel \ free_multiple.h_skel \ reset_group.h_skel \ exit_failure.h_skel \ update_given.h_skel \ option_arg.h_skel \ given_field.h_skel \ clear_given.h_skel \ clear_arg.h_skel \ free_list.h_skel \ file_save.h_skel \ file_save_multiple.h_skel \ init_args_info.h_skel \ custom_getopt_gen.h_skel \ check_modes.h_skel \ enum_decl.h_skel \ $(BUILT_SOURCES) built-clean: cd @srcdir@ && rm -f $(BUILT_SOURCES)gengetopt-2.22.6/src/skels/multiple_fill_array.h0000664000175000017500000000334312044745036016652 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef MULTIPLE_FILL_ARRAY_GEN_CLASS_H #define MULTIPLE_FILL_ARRAY_GEN_CLASS_H #include #include using std::string; using std::ostream; class multiple_fill_array_gen_class { protected: string arg_type; string default_value; string option_var_name; string type; public: multiple_fill_array_gen_class() { } multiple_fill_array_gen_class(const string &_arg_type, const string &_default_value, const string &_option_var_name, const string &_type) : arg_type (_arg_type), default_value (_default_value), option_var_name (_option_var_name), type (_type) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_arg_type(const string &_arg_type) { arg_type = _arg_type; } void set_default_value(const string &_default_value) { default_value = _default_value; } void set_option_var_name(const string &_option_var_name) { option_var_name = _option_var_name; } void set_type(const string &_type) { type = _type; } void generate_multiple_fill_array(ostream &stream, unsigned int indent = 0); }; #endif // MULTIPLE_FILL_ARRAY_GEN_CLASS_H gengetopt-2.22.6/src/skels/print_help_string.h0000664000175000017500000000375612044745036016355 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef PRINT_HELP_STRING_GEN_CLASS_H #define PRINT_HELP_STRING_GEN_CLASS_H #include #include using std::string; using std::ostream; class print_help_string_gen_class { protected: string from; string full_index; string helpstring; string index; bool last; bool shared; string target; public: print_help_string_gen_class() : last (false), shared (false) { } print_help_string_gen_class(const string &_from, const string &_full_index, const string &_helpstring, const string &_index, bool _last, bool _shared, const string &_target) : from (_from), full_index (_full_index), helpstring (_helpstring), index (_index), last (_last), shared (_shared), target (_target) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_from(const string &_from) { from = _from; } void set_full_index(const string &_full_index) { full_index = _full_index; } void set_helpstring(const string &_helpstring) { helpstring = _helpstring; } void set_index(const string &_index) { index = _index; } void set_last(bool _last) { last = _last; } void set_shared(bool _shared) { shared = _shared; } void set_target(const string &_target) { target = _target; } void generate_print_help_string(ostream &stream, unsigned int indent = 0); }; #endif // PRINT_HELP_STRING_GEN_CLASS_H gengetopt-2.22.6/src/skels/enum_decl.h_skel0000664000175000017500000000007312044745036015561 00000000000000enum enum_@var_arg@ { @var_arg@__NULL = -1@enum_values@ }; gengetopt-2.22.6/src/skels/clear_given.cc0000664000175000017500000000141212044745036015222 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "clear_given.h" void clear_given_gen_class::generate_clear_given(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; generate_string (arg_struct, stream, indent + indent_str.length ()); stream << "->"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "_given = 0 ;"; if (group) { indent = 1; stream << " "; generate_string (arg_struct, stream, indent + indent_str.length ()); stream << "->"; generate_string (var_arg, stream, indent + indent_str.length ()); stream << "_group = 0 ;"; } stream << "\n"; stream << indent_str; } gengetopt-2.22.6/src/skels/clear_arg.h0000664000175000017500000000323712044745036014534 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef CLEAR_ARG_GEN_CLASS_H #define CLEAR_ARG_GEN_CLASS_H #include #include using std::string; using std::ostream; class clear_arg_gen_class { protected: bool has_arg; bool has_orig; string name; string suffix; string value; public: clear_arg_gen_class() : has_arg (false), has_orig (false) { } clear_arg_gen_class(bool _has_arg, bool _has_orig, const string &_name, const string &_suffix, const string &_value) : has_arg (_has_arg), has_orig (_has_orig), name (_name), suffix (_suffix), value (_value) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_has_arg(bool _has_arg) { has_arg = _has_arg; } void set_has_orig(bool _has_orig) { has_orig = _has_orig; } void set_name(const string &_name) { name = _name; } void set_suffix(const string &_suffix) { suffix = _suffix; } void set_value(const string &_value) { value = _value; } void generate_clear_arg(ostream &stream, unsigned int indent = 0); }; #endif // CLEAR_ARG_GEN_CLASS_H gengetopt-2.22.6/src/skels/check_modes.h_skel0000664000175000017500000000064712045003074016067 00000000000000if (args_info->@mode1_name@_mode_counter && args_info->@mode2_name@_mode_counter) { int @mode1_name@_given[] = {@mode1_given_fields@ -1}; const char *@mode1_name@_desc[] = {@mode1_options@ 0}; int @mode2_name@_given[] = {@mode2_given_fields@ -1}; const char *@mode2_name@_desc[] = {@mode2_options@ 0}; error_occurred += check_modes(@mode1_name@_given, @mode1_name@_desc, @mode2_name@_given, @mode2_name@_desc); } gengetopt-2.22.6/src/skels/print_help_string.cc0000664000175000017500000000203412044745036016477 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "print_help_string.h" void print_help_string_gen_class::generate_print_help_string(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; if (shared) { generate_string (target, stream, indent + indent_str.length ()); stream << "["; generate_string (index, stream, indent + indent_str.length ()); stream << "] = "; if (last) { stream << "0; "; } else { generate_string (from, stream, indent + indent_str.length ()); stream << "["; generate_string (full_index, stream, indent + indent_str.length ()); stream << "];"; } stream << "\n"; stream << indent_str; } else { stream << "\""; generate_string (helpstring, stream, indent + indent_str.length ()); stream << "\","; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/required_option.h_skel0000664000175000017500000000073512045003074017031 00000000000000@IF@ checkrange @THEN@ if (@mode_condition@check_multiple_option_occurrences(@package_var_name@, args_info->@option_var_name@_given, args_info->@option_var_name@_min, args_info->@option_var_name@_max, "@option_descr@")) error_occurred = 1; @ELSE@ if (@mode_condition@! args_info->@option_var_name@_given) { fprintf (stderr, "%s: @option_descr@ option required%s\n", @package_var_name@, (additional_error ? additional_error : "")); error_occurred = 1; } @ENDIF@gengetopt-2.22.6/src/skels/group_counter.h_skel0000664000175000017500000000012012044745036016512 00000000000000int @group_name@_@name@_counter; /**< @@brief Counter for @name@ @group_name@ */gengetopt-2.22.6/src/skels/update_given.h_skel0000664000175000017500000000017412044745036016302 00000000000000args_info->@option_var_name@_given += local_args_info.@option_var_name@_given; local_args_info.@option_var_name@_given = 0; gengetopt-2.22.6/src/skels/group_option.h_skel0000664000175000017500000000047112045003074016342 00000000000000if (args_info->@group_var_name@_group_counter @Comparison_rule@) { fprintf (stderr, "%s: %d options of group @group_name@ were given. @number_required@ is required%s.\n", @package_var_name@, args_info->@group_var_name@_group_counter, (additional_error ? additional_error : "")); error_occurred = 1; } gengetopt-2.22.6/src/skels/free_string.h0000664000175000017500000000303312044745036015116 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef FREE_STRING_GEN_CLASS_H #define FREE_STRING_GEN_CLASS_H #include #include using std::string; using std::ostream; class free_string_gen_class { protected: bool has_string_type; string opt_var; string structure; public: free_string_gen_class() : has_string_type (false) { } free_string_gen_class(bool _has_string_type, const string &_opt_var, const string &_structure) : has_string_type (_has_string_type), opt_var (_opt_var), structure (_structure) { } static void generate_string(const string &s, ostream &stream, unsigned int indent) { if (!indent || s.find('\n') == string::npos) { stream << s; return; } string::size_type pos; string::size_type start = 0; string ind (indent, ' '); while ( (pos=s.find('\n', start)) != string::npos) { stream << s.substr (start, (pos+1)-start); start = pos+1; if (start+1 <= s.size ()) stream << ind; } if (start+1 <= s.size ()) stream << s.substr (start); } void set_has_string_type(bool _has_string_type) { has_string_type = _has_string_type; } void set_opt_var(const string &_opt_var) { opt_var = _opt_var; } void set_structure(const string &_structure) { structure = _structure; } void generate_free_string(ostream &stream, unsigned int indent = 0); }; #endif // FREE_STRING_GEN_CLASS_H gengetopt-2.22.6/src/skels/given_field.cc0000664000175000017500000000172212044745036015223 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #include "given_field.h" void given_field_gen_class::generate_given_field(ostream &stream, unsigned int indent) { string indent_str (indent, ' '); indent = 0; stream << "unsigned int "; generate_string (arg_name, stream, indent + indent_str.length ()); stream << "_given ; /**< "; stream << "@"; stream << "brief Whether "; generate_string (long_opt, stream, indent + indent_str.length ()); stream << " was given. */"; stream << "\n"; stream << indent_str; if (group) { stream << " int "; generate_string (arg_name, stream, indent + indent_str.length ()); stream << "_group ; /**< "; stream << "@"; stream << "brief Whether "; generate_string (long_opt, stream, indent + indent_str.length ()); stream << "'s was updated. */"; stream << "\n"; stream << indent_str; } } gengetopt-2.22.6/src/skels/custom_getopt_gen.h0000664000175000017500000000076512044745036016345 00000000000000/* * File automatically generated by * gengen 1.4.3rc by Lorenzo Bettini * http://www.gnu.org/software/gengen */ #ifndef CUSTOM_GETOPT_GEN_GEN_CLASS_H #define CUSTOM_GETOPT_GEN_GEN_CLASS_H #include #include using std::string; using std::ostream; class custom_getopt_gen_gen_class { protected: public: custom_getopt_gen_gen_class() { } void generate_custom_getopt_gen(ostream &stream, unsigned int indent = 0); }; #endif // CUSTOM_GETOPT_GEN_GEN_CLASS_H gengetopt-2.22.6/src/gm_utils.h0000664000175000017500000000716312045003074013307 00000000000000// // C++ Interface: gm_utils // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef GM_UTILS_H #define GM_UTILS_H #include #include #include "ggos.h" using std::string; /** * @param name * @return a copy of the string passed after canonizing it (i.e. '-' and * '.' are transformed in '_'). */ char *canonize_names(const char * name); /** * @param name * @return a copy of the string passed after canonizing it (i.e. '-' and * '.' are transformed in '_'). */ const string canonize_name(const string &name); /** * @param s the string representing an enum value * @return a copy of the string passed after canonizing it (i.e. '-' and * becomes _MINUS_, '+' becomes _PLUS_) */ const string canonize_enum(const string &s); const string strip_path(const string &); const string to_upper(const string &); /** * All multiple options are of type string * @return All multiple options are of type string */ bool has_multiple_options_all_string(); /** * Has multiple options and at least one is of type string * @return Has multiple options and at least one is of type string */ bool has_multiple_options_string(); /** * Has multiple options and at least one has a default value * @return Has multiple options and at least one has a default value */ bool has_multiple_options_with_default(); bool has_multiple_options(); bool has_multiple_options_with_type(); bool has_required(); bool has_dependencies(); bool has_options_with_type(); bool has_options_with_mode(); bool has_options(); bool has_hidden_options(); /** * Has an option that has details and, where strict hiding is in effect, isn't * hidden. * @param strict_hidden whether strict hiding is in effect * @return Has options that have details */ bool has_options_with_details(bool strict_hidden); bool has_values(); /** * Whether the specified option deals with number * * @param opt * @return */ bool is_numeric(const gengetopt_option *opt); /** * Performs word wrapping on the passed string (and return the result in the first * parameter). * * @param wrapped the output parameter * @param from_column the string start from this column * @param second_indent an additional indentation for lines after the * first one * @param orig the original string that must be wrapped */ void wrap_cstr (string &wrapped, unsigned int from_column, unsigned int second_indent, const string &orig); /** * Searches for characters which are not newlines. * * @param buf where to search for new characters * @param num_of_newlines where the number of newlines * before the first non newline char will be stored * @return the position in the string after the (possible) new line char */ int not_newlines(const string &buf, int &num_of_newlines); bool string_contains(const char *s, const char *tofind); /** * Function object to print something into a stream (to be used with for_each) */ template struct print_f : public std::unary_function { print_f(std::ostream& out, const string &s = ", ") : os(out), sep(s) {} void operator() (T x) { os << x << sep; } std::ostream& os; const string &sep; }; /** * Function object to print a pair into two streams (to be used with for_each) */ template struct pair_print_f : public std::unary_function { pair_print_f(std::ostream& out1, std::ostream& out2, const string &s = ", ") : os1(out1), os2(out2), sep(s) {} void operator() (T x) { os1 << x.first << sep; os2 << x.second << sep;} std::ostream &os1, &os2; const string &sep; }; #endif gengetopt-2.22.6/src/parser.cc0000664000175000017500000021662312045003074013121 00000000000000/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 1 /* Copy the first part of user declarations. */ /* Line 268 of yacc.c */ #line 22 "./parser.yy" #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "acceptedvalues.h" #include "argsdef.h" #include "gengetopt.h" #include "errorcodes.h" #include "ggos.h" #include "yyerror.h" extern int gengetopt_count_line; extern char * gengetopt_input_filename; static int gengetopt_package_given = 0; static int gengetopt_version_given = 0; static int gengetopt_purpose_given = 0; static int gengetopt_versiontext_given = 0; static int gengetopt_usage_given = 0; static int gengetopt_description_given = 0; /// the last option parsed static gengetopt_option *current_option = 0; extern int yylex (void) ; //#define YYERROR_VERBOSE 1 using namespace std; void check_result(int o, gengetopt_option *opt) { if (o) { ostringstream err; switch (o) { case NOT_ENOUGH_MEMORY: yyerror (opt, "not enough memory"); break; case REQ_LONG_OPTION: err << "long option redefined \'" << opt->long_opt << "\'"; yyerror (opt, err.str().c_str()); break; case REQ_SHORT_OPTION: err << "short option redefined \'" << opt->short_opt << "\'"; yyerror (opt, err.str().c_str()); break; case FOUND_BUG: yyerror (opt, "bug found!!"); break; case GROUP_UNDEFINED: yyerror (opt, "group undefined"); break; case MODE_UNDEFINED: yyerror (opt, "mode undefined"); break; case INVALID_DEFAULT_VALUE: yyerror (opt, "invalid default value"); break; case NOT_REQUESTED_TYPE: yyerror (opt, "type specification not requested"); break; case NOT_VALID_SPECIFICATION: yyerror (opt, "invalid specification for this kind of option"); break; case SPECIFY_FLAG_STAT: yyerror (opt, "you must specify the default flag status"); break; case NOT_GROUP_OPTION: yyerror (opt, "group specification for a non group option"); break; case NOT_MODE_OPTION: yyerror (opt, "mode specification for an option not belonging to a mode"); break; case SPECIFY_GROUP: yyerror (opt, "missing group specification"); break; case SPECIFY_MODE: yyerror (opt, "missing mode specification"); break; case INVALID_NUMERIC_VALUE: yyerror (opt, "invalid numeric value"); break; case INVALID_ENUM_TYPE_USE: yyerror (opt, "enum type can only be specified for options with values"); break; case HELP_REDEFINED: yyerror (opt, "if you want to redefine --help, please use option --no-help"); break; case VERSION_REDEFINED: yyerror (opt, "if you want to redefine --version, please use option --no-version"); break; } } } /* the number of allowed occurrences of a multiple option */ struct multiple_size { /* these strings are allocated dynamically and NOT automatically freed upon destruction */ char *min; char *max; /* if no limit is specified then initialized to 0. if the same size is specified for min and max, it means that an exact number of occurrences is required*/ multiple_size(const char *m = "0", const char *M = "0") : min(strdup(m)), max(strdup(M)) {} }; #define check_error if (o) YYERROR; /* Line 268 of yacc.c */ #line 200 "./parser.cc" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_PACKAGE = 258, TOK_VERSION = 259, TOK_OPTION = 260, TOK_DEFGROUP = 261, TOK_GROUPOPTION = 262, TOK_DEFMODE = 263, TOK_MODEOPTION = 264, TOK_YES = 265, TOK_NO = 266, TOK_ON = 267, TOK_OFF = 268, TOK_FLAG = 269, TOK_PURPOSE = 270, TOK_DESCRIPTION = 271, TOK_USAGE = 272, TOK_DEFAULT = 273, TOK_GROUP = 274, TOK_GROUPDESC = 275, TOK_MODE = 276, TOK_MODEDESC = 277, TOK_MULTIPLE = 278, TOK_ARGOPTIONAL = 279, TOK_TYPESTR = 280, TOK_SECTION = 281, TOK_DETAILS = 282, TOK_SECTIONDESC = 283, TOK_TEXT = 284, TOK_VERSIONTEXT = 285, TOK_ARGS = 286, TOK_VALUES = 287, TOK_HIDDEN = 288, TOK_DEPENDON = 289, TOK_STRING = 290, TOK_CHAR = 291, TOK_ARGTYPE = 292, TOK_SIZE = 293 }; #endif /* Tokens. */ #define TOK_PACKAGE 258 #define TOK_VERSION 259 #define TOK_OPTION 260 #define TOK_DEFGROUP 261 #define TOK_GROUPOPTION 262 #define TOK_DEFMODE 263 #define TOK_MODEOPTION 264 #define TOK_YES 265 #define TOK_NO 266 #define TOK_ON 267 #define TOK_OFF 268 #define TOK_FLAG 269 #define TOK_PURPOSE 270 #define TOK_DESCRIPTION 271 #define TOK_USAGE 272 #define TOK_DEFAULT 273 #define TOK_GROUP 274 #define TOK_GROUPDESC 275 #define TOK_MODE 276 #define TOK_MODEDESC 277 #define TOK_MULTIPLE 278 #define TOK_ARGOPTIONAL 279 #define TOK_TYPESTR 280 #define TOK_SECTION 281 #define TOK_DETAILS 282 #define TOK_SECTIONDESC 283 #define TOK_TEXT 284 #define TOK_VERSIONTEXT 285 #define TOK_ARGS 286 #define TOK_VALUES 287 #define TOK_HIDDEN 288 #define TOK_DEPENDON 289 #define TOK_STRING 290 #define TOK_CHAR 291 #define TOK_ARGTYPE 292 #define TOK_SIZE 293 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 293 of yacc.c */ #line 150 "./parser.yy" char *str; char chr; int argtype; int boolean; class AcceptedValues *ValueList; struct gengetopt_option *gengetopt_option; struct multiple_size *multiple_size; /* Line 293 of yacc.c */ #line 324 "./parser.cc" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 343 of yacc.c */ #line 349 "./parser.cc" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 46 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 91 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 44 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 28 /* YYNRULES -- Number of rules. */ #define YYNRULES 68 /* YYNRULES -- Number of states. */ #define YYNSTATES 119 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 293 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 41, 42, 2, 2, 40, 43, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 39, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 37, 38 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 38, 41, 44, 47, 50, 54, 57, 60, 63, 68, 72, 78, 84, 90, 92, 95, 98, 103, 108, 113, 118, 123, 128, 133, 136, 140, 143, 146, 149, 150, 152, 154, 155, 157, 159, 161, 163, 164, 168, 169, 173, 174, 178, 180, 184, 186, 187, 191, 196, 201 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 45, 0, -1, -1, 46, 45, -1, 47, -1, 48, -1, 55, -1, 49, -1, 50, -1, 51, -1, 52, -1, 58, -1, 53, -1, 54, -1, 59, -1, 56, -1, 60, -1, 57, -1, 3, 35, -1, 4, 35, -1, 15, 61, -1, 16, 61, -1, 17, 61, -1, 26, 61, 68, -1, 29, 61, -1, 30, 61, -1, 31, 35, -1, 6, 35, 66, 64, -1, 8, 35, 67, -1, 5, 35, 36, 61, 62, -1, 7, 35, 36, 61, 62, -1, 9, 35, 36, 61, 62, -1, 35, -1, 62, 65, -1, 62, 37, -1, 62, 25, 39, 35, -1, 62, 27, 39, 61, -1, 62, 32, 39, 69, -1, 62, 18, 39, 35, -1, 62, 19, 39, 35, -1, 62, 21, 39, 35, -1, 62, 34, 39, 35, -1, 62, 24, -1, 62, 23, 71, -1, 62, 14, -1, 62, 33, -1, 62, 63, -1, -1, 12, -1, 13, -1, -1, 10, -1, 11, -1, 10, -1, 11, -1, -1, 20, 39, 35, -1, -1, 22, 39, 35, -1, -1, 28, 39, 35, -1, 70, -1, 69, 40, 70, -1, 35, -1, -1, 41, 38, 42, -1, 41, 38, 43, 42, -1, 41, 43, 38, 42, -1, 41, 38, 43, 38, 42, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 212, 212, 214, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 237, 257, 277, 297, 317, 338, 345, 362, 382, 389, 400, 411, 431, 450, 472, 475, 481, 486, 491, 496, 501, 506, 511, 516, 521, 526, 534, 539, 544, 549, 553, 554, 558, 559, 560, 564, 565, 569, 570, 574, 575, 579, 580, 584, 585, 589, 593, 594, 595, 596, 597 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "\"package\"", "\"version\"", "\"option\"", "\"defgroup\"", "\"groupoption\"", "\"defmode\"", "\"modeoption\"", "\"yes\"", "\"no\"", "\"on\"", "\"off\"", "\"flag\"", "\"purpose\"", "\"description\"", "\"usage\"", "\"default\"", "\"group\"", "\"groupdesc\"", "\"mode\"", "\"modedesc\"", "\"multiple\"", "\"argoptional\"", "\"typestr\"", "\"section\"", "\"details\"", "\"sectiondesc\"", "\"text\"", "\"versiontext\"", "\"args\"", "\"values\"", "\"hidden\"", "\"dependon\"", "TOK_STRING", "TOK_CHAR", "TOK_ARGTYPE", "TOK_SIZE", "'='", "','", "'('", "')'", "'-'", "$accept", "input", "statement", "package", "version", "purpose", "description", "usage", "sectiondef", "text", "versiontext", "args", "groupdef", "modedef", "option", "groupoption", "modeoption", "quoted_string", "option_parts", "req_onoff", "optional_yesno", "opt_yesno", "opt_groupdesc", "opt_modedesc", "opt_sectiondesc", "listofvalues", "acceptedvalue", "multiple_size", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 61, 44, 40, 41, 45 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 44, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 71, 71, 71, 71, 71 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 4, 3, 5, 5, 5, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 2, 3, 2, 2, 2, 0, 1, 1, 0, 1, 1, 1, 1, 0, 3, 0, 3, 0, 3, 1, 3, 1, 0, 3, 4, 4, 5 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 5, 7, 8, 9, 10, 12, 13, 6, 15, 17, 11, 14, 16, 18, 19, 0, 55, 0, 57, 0, 32, 20, 21, 22, 59, 24, 25, 26, 1, 3, 0, 0, 50, 0, 0, 28, 0, 0, 23, 47, 0, 51, 52, 27, 47, 0, 47, 0, 29, 56, 30, 58, 31, 60, 53, 54, 48, 49, 44, 0, 0, 0, 64, 42, 0, 0, 0, 45, 0, 34, 46, 33, 0, 0, 0, 0, 43, 0, 0, 0, 0, 38, 39, 40, 0, 0, 35, 36, 63, 37, 61, 41, 65, 0, 0, 0, 0, 66, 67, 62, 68 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 39, 66, 88, 61, 89, 50, 53, 56, 107, 108, 94 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -42 static const yytype_int8 yypact[] = { 2, -13, -8, -6, -5, -1, 0, 1, 5, 5, 5, 5, 5, 5, 6, 26, 2, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 7, 17, 8, 16, 15, -42, -42, -42, -42, 24, -42, -42, -42, -42, -42, 5, 14, 3, 5, 19, -42, 5, 23, -42, -42, 21, -42, -42, -42, -42, 29, -42, 30, 36, -42, 36, -42, 36, -42, -42, -42, -42, -42, -42, 27, 28, 32, 31, -42, 35, 37, 38, -42, 39, -42, -42, -42, 40, 44, 45, -23, -42, 46, 5, 47, 48, -42, -42, -42, -18, 50, -42, -42, -42, 49, -42, -42, -42, -26, 42, 47, 43, -42, -42, -42, -42 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -42, 70, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -9, -41, -42, -42, -42, -42, -42, -42, -42, -22, -42 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 40, 41, 42, 43, 44, 1, 2, 3, 4, 5, 6, 7, 114, 59, 60, 102, 115, 8, 9, 10, 103, 68, 31, 70, 110, 111, 46, 32, 11, 33, 34, 12, 13, 14, 35, 36, 37, 49, 52, 57, 38, 45, 62, 48, 51, 64, 72, 73, 74, 75, 76, 54, 55, 58, 77, 78, 67, 79, 63, 80, 81, 82, 65, 83, 69, 71, 90, 91, 84, 85, 86, 92, 93, 87, 95, 99, 96, 97, 98, 100, 101, 104, 106, 109, 116, 118, 47, 105, 112, 113, 0, 117 }; #define yypact_value_is_default(yystate) \ ((yystate) == (-42)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { 9, 10, 11, 12, 13, 3, 4, 5, 6, 7, 8, 9, 38, 10, 11, 38, 42, 15, 16, 17, 43, 62, 35, 64, 42, 43, 0, 35, 26, 35, 35, 29, 30, 31, 35, 35, 35, 20, 22, 48, 35, 35, 51, 36, 36, 54, 10, 11, 12, 13, 14, 36, 28, 39, 18, 19, 35, 21, 39, 23, 24, 25, 39, 27, 35, 35, 39, 39, 32, 33, 34, 39, 41, 37, 39, 35, 39, 39, 39, 35, 35, 35, 35, 35, 42, 42, 16, 96, 38, 40, -1, 113 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 15, 16, 17, 26, 29, 30, 31, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 35, 35, 35, 35, 35, 35, 35, 35, 61, 61, 61, 61, 61, 61, 35, 0, 45, 36, 20, 66, 36, 22, 67, 36, 28, 68, 61, 39, 10, 11, 64, 61, 39, 61, 39, 62, 35, 62, 35, 62, 35, 10, 11, 12, 13, 14, 18, 19, 21, 23, 24, 25, 27, 32, 33, 34, 37, 63, 65, 39, 39, 39, 41, 71, 39, 39, 39, 39, 35, 35, 35, 38, 43, 35, 61, 35, 69, 70, 35, 42, 43, 38, 40, 38, 42, 42, 70, 42 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. However, YYFAIL appears to be in use. Nevertheless, it is formally deprecated in Bison 2.4.2's NEWS entry, where a plan to phase it out is discussed. */ #define YYFAIL goto yyerrlab #if defined YYFAIL /* This is here to suppress warnings from the GCC cpp's -Wunused-macros. Normally we don't worry about that warning, but some users do, and we want to make it easy for users to remove YYFAIL uses, which will produce warnings from Bison 2.5. */ #endif #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (!yyvaluep) return; YYUSE (yylocationp); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) #else static void yy_reduce_print (yyvsp, yylsp, yyrule) YYSTYPE *yyvsp; YYLTYPE *yylsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, yylsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - Assume YYFAIL is not used. It's too flawed to consider. See for details. YYERROR is fine as it does not invoke this function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) #else static void yydestruct (yymsg, yytype, yyvaluep, yylocationp) const char *yymsg; int yytype; YYSTYPE *yyvaluep; YYLTYPE *yylocationp; #endif { YYUSE (yyvaluep); YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Location data for the lookahead symbol. */ YYLTYPE yylloc; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; yylsp = yyls; #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; *++yylsp = yylloc; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YY_REDUCE_PRINT (yyn); switch (yyn) { case 18: /* Line 1806 of yacc.c */ #line 238 "./parser.yy" { if (gengetopt_package_given) { yyerror ("package redefined"); YYERROR; } else { gengetopt_package_given = 1; if (gengetopt_define_package ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 19: /* Line 1806 of yacc.c */ #line 258 "./parser.yy" { if (gengetopt_version_given) { yyerror ("version redefined"); YYERROR; } else { gengetopt_version_given = 1; if (gengetopt_define_version ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 20: /* Line 1806 of yacc.c */ #line 278 "./parser.yy" { if (gengetopt_purpose_given) { yyerror ("purpose redefined"); YYERROR; } else { gengetopt_purpose_given = 1; if (gengetopt_define_purpose ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 21: /* Line 1806 of yacc.c */ #line 298 "./parser.yy" { if (gengetopt_description_given) { yyerror ("description redefined"); YYERROR; } else { gengetopt_description_given = 1; if (gengetopt_define_description ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 22: /* Line 1806 of yacc.c */ #line 318 "./parser.yy" { if (gengetopt_usage_given) { yyerror ("usage redefined"); YYERROR; } else { gengetopt_usage_given = 1; if (gengetopt_define_usage ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 23: /* Line 1806 of yacc.c */ #line 339 "./parser.yy" { gengetopt_set_section ((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); } break; case 24: /* Line 1806 of yacc.c */ #line 346 "./parser.yy" { if (current_option) { std::string current_option_text; if (current_option->text_after) { current_option_text = std::string(current_option->text_after) + (yyvsp[(2) - (2)].str); current_option->text_after = strdup(current_option_text.c_str()); } else { current_option->text_after = strdup((yyvsp[(2) - (2)].str)); } } else { gengetopt_set_text((yyvsp[(2) - (2)].str)); } } break; case 25: /* Line 1806 of yacc.c */ #line 363 "./parser.yy" { if (gengetopt_versiontext_given) { yyerror ("versiontext redefined"); YYERROR; } else { gengetopt_versiontext_given = 1; if (gengetopt_define_versiontext ((yyvsp[(2) - (2)].str))) { yyerror ("not enough memory"); YYERROR; } } } break; case 26: /* Line 1806 of yacc.c */ #line 383 "./parser.yy" { gengetopt_set_args((yyvsp[(2) - (2)].str)); } break; case 27: /* Line 1806 of yacc.c */ #line 390 "./parser.yy" { if (gengetopt_add_group ((yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), (yyvsp[(4) - (4)].boolean))) { yyerror ("group redefined"); YYERROR; } } break; case 28: /* Line 1806 of yacc.c */ #line 401 "./parser.yy" { if (gengetopt_add_mode ((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))) { yyerror ("mode redefined"); YYERROR; } } break; case 29: /* Line 1806 of yacc.c */ #line 413 "./parser.yy" { (yyvsp[(5) - (5)].gengetopt_option)->filename = gengetopt_input_filename; (yyvsp[(5) - (5)].gengetopt_option)->linenum = (yylsp[(1) - (5)]).first_line; (yyvsp[(5) - (5)].gengetopt_option)->long_opt = strdup((yyvsp[(2) - (5)].str)); if ((yyvsp[(3) - (5)].chr) != '-') (yyvsp[(5) - (5)].gengetopt_option)->short_opt = (yyvsp[(3) - (5)].chr); (yyvsp[(5) - (5)].gengetopt_option)->desc = strdup((yyvsp[(4) - (5)].str)); int o = gengetopt_check_option ((yyvsp[(5) - (5)].gengetopt_option), false); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; o = gengetopt_add_option ((yyvsp[(5) - (5)].gengetopt_option)); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; current_option = (yyvsp[(5) - (5)].gengetopt_option); } break; case 30: /* Line 1806 of yacc.c */ #line 433 "./parser.yy" { (yyvsp[(5) - (5)].gengetopt_option)->filename = gengetopt_input_filename; (yyvsp[(5) - (5)].gengetopt_option)->linenum = (yylsp[(1) - (5)]).first_line; (yyvsp[(5) - (5)].gengetopt_option)->long_opt = strdup((yyvsp[(2) - (5)].str)); if ((yyvsp[(3) - (5)].chr) != '-') (yyvsp[(5) - (5)].gengetopt_option)->short_opt = (yyvsp[(3) - (5)].chr); (yyvsp[(5) - (5)].gengetopt_option)->desc = strdup((yyvsp[(4) - (5)].str)); int o = gengetopt_check_option ((yyvsp[(5) - (5)].gengetopt_option), true); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; o = gengetopt_add_option ((yyvsp[(5) - (5)].gengetopt_option)); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; } break; case 31: /* Line 1806 of yacc.c */ #line 452 "./parser.yy" { (yyvsp[(5) - (5)].gengetopt_option)->filename = gengetopt_input_filename; (yyvsp[(5) - (5)].gengetopt_option)->linenum = (yylsp[(1) - (5)]).first_line; (yyvsp[(5) - (5)].gengetopt_option)->long_opt = strdup((yyvsp[(2) - (5)].str)); if ((yyvsp[(3) - (5)].chr) != '-') (yyvsp[(5) - (5)].gengetopt_option)->short_opt = (yyvsp[(3) - (5)].chr); (yyvsp[(5) - (5)].gengetopt_option)->desc = strdup((yyvsp[(4) - (5)].str)); int o = gengetopt_check_option ((yyvsp[(5) - (5)].gengetopt_option), false, true); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; o = gengetopt_add_option ((yyvsp[(5) - (5)].gengetopt_option)); check_result(o, (yyvsp[(5) - (5)].gengetopt_option)); check_error; } break; case 33: /* Line 1806 of yacc.c */ #line 476 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->required = (yyvsp[(2) - (2)].boolean); (yyval.gengetopt_option)->required_set = true; } break; case 34: /* Line 1806 of yacc.c */ #line 482 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->type = (yyvsp[(2) - (2)].argtype); } break; case 35: /* Line 1806 of yacc.c */ #line 487 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->type_str = strdup((yyvsp[(4) - (4)].str)); } break; case 36: /* Line 1806 of yacc.c */ #line 492 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->details = strdup((yyvsp[(4) - (4)].str)); } break; case 37: /* Line 1806 of yacc.c */ #line 497 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->acceptedvalues = (yyvsp[(4) - (4)].ValueList); } break; case 38: /* Line 1806 of yacc.c */ #line 502 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->default_string = strdup((yyvsp[(4) - (4)].str)); } break; case 39: /* Line 1806 of yacc.c */ #line 507 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->group_value = strdup((yyvsp[(4) - (4)].str)); } break; case 40: /* Line 1806 of yacc.c */ #line 512 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->mode_value = strdup((yyvsp[(4) - (4)].str)); } break; case 41: /* Line 1806 of yacc.c */ #line 517 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (4)].gengetopt_option); (yyval.gengetopt_option)->dependon = strdup((yyvsp[(4) - (4)].str)); } break; case 42: /* Line 1806 of yacc.c */ #line 522 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->arg_is_optional = true; } break; case 43: /* Line 1806 of yacc.c */ #line 527 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (3)].gengetopt_option); (yyval.gengetopt_option)->multiple = true; (yyval.gengetopt_option)->multiple_min = (yyvsp[(3) - (3)].multiple_size)->min; (yyval.gengetopt_option)->multiple_max = (yyvsp[(3) - (3)].multiple_size)->max; delete (yyvsp[(3) - (3)].multiple_size); } break; case 44: /* Line 1806 of yacc.c */ #line 535 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->type = ARG_FLAG; } break; case 45: /* Line 1806 of yacc.c */ #line 540 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->hidden = true; } break; case 46: /* Line 1806 of yacc.c */ #line 545 "./parser.yy" { (yyval.gengetopt_option) = (yyvsp[(1) - (2)].gengetopt_option); (yyval.gengetopt_option)->flagstat = (yyvsp[(2) - (2)].boolean); } break; case 47: /* Line 1806 of yacc.c */ #line 549 "./parser.yy" { (yyval.gengetopt_option) = new gengetopt_option; } break; case 48: /* Line 1806 of yacc.c */ #line 553 "./parser.yy" { (yyval.boolean) = 1; } break; case 49: /* Line 1806 of yacc.c */ #line 554 "./parser.yy" { (yyval.boolean) = 0; } break; case 50: /* Line 1806 of yacc.c */ #line 558 "./parser.yy" { (yyval.boolean) = 0; } break; case 51: /* Line 1806 of yacc.c */ #line 559 "./parser.yy" { (yyval.boolean) = 1; } break; case 52: /* Line 1806 of yacc.c */ #line 560 "./parser.yy" { (yyval.boolean) = 0; } break; case 53: /* Line 1806 of yacc.c */ #line 564 "./parser.yy" { (yyval.boolean) = 1; } break; case 54: /* Line 1806 of yacc.c */ #line 565 "./parser.yy" { (yyval.boolean) = 0; } break; case 55: /* Line 1806 of yacc.c */ #line 569 "./parser.yy" { (yyval.str) = 0; } break; case 56: /* Line 1806 of yacc.c */ #line 570 "./parser.yy" { (yyval.str) = (yyvsp[(3) - (3)].str); } break; case 57: /* Line 1806 of yacc.c */ #line 574 "./parser.yy" { (yyval.str) = 0; } break; case 58: /* Line 1806 of yacc.c */ #line 575 "./parser.yy" { (yyval.str) = (yyvsp[(3) - (3)].str); } break; case 59: /* Line 1806 of yacc.c */ #line 579 "./parser.yy" { (yyval.str) = 0; } break; case 60: /* Line 1806 of yacc.c */ #line 580 "./parser.yy" { (yyval.str) = (yyvsp[(3) - (3)].str); } break; case 61: /* Line 1806 of yacc.c */ #line 584 "./parser.yy" { (yyval.ValueList) = new AcceptedValues; (yyval.ValueList)->insert((yyvsp[(1) - (1)].str)); } break; case 62: /* Line 1806 of yacc.c */ #line 585 "./parser.yy" { (yyvsp[(1) - (3)].ValueList)->insert((yyvsp[(3) - (3)].str)); (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); } break; case 63: /* Line 1806 of yacc.c */ #line 589 "./parser.yy" { (yyval.str) = (yyvsp[(1) - (1)].str); } break; case 64: /* Line 1806 of yacc.c */ #line 593 "./parser.yy" { (yyval.multiple_size) = new multiple_size; } break; case 65: /* Line 1806 of yacc.c */ #line 594 "./parser.yy" { (yyval.multiple_size) = new multiple_size((yyvsp[(2) - (3)].str), (yyvsp[(2) - (3)].str)); } break; case 66: /* Line 1806 of yacc.c */ #line 595 "./parser.yy" { (yyval.multiple_size) = new multiple_size((yyvsp[(2) - (4)].str), "0"); free((yyvsp[(2) - (4)].str)); } break; case 67: /* Line 1806 of yacc.c */ #line 596 "./parser.yy" { (yyval.multiple_size) = new multiple_size("0", (yyvsp[(3) - (4)].str)); free((yyvsp[(3) - (4)].str)); } break; case 68: /* Line 1806 of yacc.c */ #line 597 "./parser.yy" { (yyval.multiple_size) = new multiple_size((yyvsp[(2) - (5)].str), (yyvsp[(4) - (5)].str)); free((yyvsp[(2) - (5)].str)); free((yyvsp[(4) - (5)].str)); } break; /* Line 1806 of yacc.c */ #line 2278 "./parser.cc" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } yyerror_range[1] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, yylsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 2067 of yacc.c */ #line 600 "./parser.yy" gengetopt-2.22.6/src/yyerror.h0000664000175000017500000000024512044745036013203 00000000000000#ifndef YYERROR_H_ #define YYERROR_H_ #include "ggos.h" void yyerror (const char *s); void yyerror (gengetopt_option *opt, const char *s); #endif /*YYERROR_H_*/ gengetopt-2.22.6/src/acceptedvalues.h0000664000175000017500000000145612044745036014465 00000000000000// // C++ Interface: acceptedvalues // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ACCEPTEDVALUES_H #define ACCEPTEDVALUES_H #include #include #include /** the values that can be passed to an option @author Lorenzo Bettini */ class AcceptedValues : protected std::list { private: typedef std::set value_set; value_set values; public: using std::list::const_iterator; using std::list::begin; using std::list::end; void insert(const std::string &s); const std::string toString(bool escape = true) const; bool contains(const std::string &s) const; }; #endif gengetopt-2.22.6/src/global_opts.h0000664000175000017500000000302612044745036013775 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GLOBAL_OPTS_H #define GLOBAL_OPTS_H #define HELP_LONG_OPT "help" #define HELP_SHORT_OPT 'h' #define HELP_SHORT_OPT_STR "h" #define HELP_OPT_DESCR "Print help and exit" #define FULL_HELP_LONG_OPT "full-help" #define FULL_HELP_LONG_OPT_FIELD "full_help" #define FULL_HELP_OPT_DESCR "Print help, including hidden options, and exit" #define DETAILED_HELP_LONG_OPT "detailed-help" #define DETAILED_HELP_LONG_OPT_FIELD "detailed_help" #define DETAILED_HELP_OPT_DESCR "Print help, including all details and hidden options, and exit" #define VERSION_LONG_OPT "version" #define VERSION_SHORT_OPT 'V' #define VERSION_SHORT_OPT_STR "V" #define VERSION_OPT_DESCR "Print version and exit" #endif /* GLOBAL_OPTS_H */ gengetopt-2.22.6/src/cmdline.c0000664000175000017500000013714412045003074013075 00000000000000/* File autogenerated by gengetopt version 2.22.6 generated with the following command: ../src/gengetopt --input=../../src/cmdline.ggo --output-dir=../../src --no-handle-version --no-handle-help --no-handle-error --string-parser The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "cmdline.h" const char *gengetopt_args_info_purpose = "This program generates a C function that uses getopt_long function\nto parse the command line options, validate them and fill a struct."; const char *gengetopt_args_info_usage = "Usage: " CMDLINE_PARSER_PACKAGE " [OPTIONS]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_detailed_help[] = { " -h, --help Print help and exit", " --detailed-help Print help, including all details and hidden\n options, and exit", " -V, --version Print version and exit", "\nMain options:", "", " -i, --input=filename input file (default std input)", " -f, --func-name=name name of generated function\n (default=`cmdline_parser')", " -a, --arg-struct-name=name name of generated args info struct\n (default=`gengetopt_args_info')", " -F, --file-name=name name of generated file (default=`cmdline')", " --output-dir=path output directory", " \n if this option is not specified, the files are generated in the current\n directory.\n", " --header-output-dir=path header output directory", " --src-output-dir=path source output directory", " -c, --c-extension=ext extension of c file (default=`c')", " -H, --header-extension=ext extension of header file (default=`h')", " -l, --long-help long usage line in help", " \n The usage line will print all the options, e.g.,\n\n sample1 -iINT|--int-opt=INT [-h|--help]\n", " --default-optional by default, an option is considered optional if\n not specified otherwise", " -u, --unamed-opts[=STRING] accept options without names (e.g., file names)\n (default=`FILES')", "\nThe parser generated is thought to be used to parse the command line arguments.\nHowever, you can also generate parsers for configuration files, or strings that\ncontain the arguments to parse, by using the following two options.\n", " -C, --conf-parser generate a config file parser", " -S, --string-parser generate a string parser (the string contains\n the command line)", "\nAdditional options:", " -G, --include-getopt adds the code for getopt_long in the generated\n C file", " -n, --no-handle-help do not handle --help|-h automatically", " \n If --no-handle-help is specified, the command line option --help|-h will not\n be handled automatically, so the programmer will be able to print some other\n information; then the function for printing the standard help output can be\n used; this function is called _print_help.\n\n Notice that, although the programmer can handle --help|-h manually, the\n parser will return after finding such option: the other command line options,\n if any, will be ignored. In case you want to have full control on --help|-h,\n you should use --ho-help.\n", " --no-help do not add --help|-h automatically", " \n With this option you can disable the automatic addition of options --help|-h.\n The programmer will then be able to add this option in the input file and\n handle it as he sees fit. Notice that --no-help will also disable the\n automatic options --detailed-help and --full-help.\n\n The programmer can still define options with short character h as he wants,\n but he cannot define options help, unless he specifies --no-help (otherwise\n an error will be printed).\n", " -N, --no-handle-version do not handle --version|-V automatically", " --no-version do not add --version|-V automatically", " \n See above the details about --no-handle-help and --no-help, respectively.\n", " -e, --no-handle-error do not exit on errors", " \n With this option, if the generated parser encounters an error (e.g., an\n unknown option) it does not make the main program exit; instead, the parser\n function returns a value different 0, and the main program can print a help\n message.\n", " --show-required[=STRING] in the output of help will specify which\n options are mandatory, by using the optional\n passed string (default=`(mandatory)')", " --strict-hidden completely hide hidden options", " -g, --gen-version put gengetopt version in the generated file\n (default=on)", " --set-package=STRING set the package name (override package defined\n in the .ggo file)", " --set-version=STRING set the version number (override version\n defined in the .ggo file)", " --show-help show the output of --help instead of generating\n code", " --show-full-help show the output of --full-help (i.e., including\n hidden options) instead of generating code", " --show-detailed-help show the output of --detailed-help (i.e.,\n including details and hidden options) instead\n of generating code", " --show-version show the output of --version instead of\n generating code", "\nPlease refer to the info manual for further explanations.", 0 }; static void init_help_array(void) { gengetopt_args_info_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_help[4] = gengetopt_args_info_detailed_help[4]; gengetopt_args_info_help[5] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_help[6] = gengetopt_args_info_detailed_help[6]; gengetopt_args_info_help[7] = gengetopt_args_info_detailed_help[7]; gengetopt_args_info_help[8] = gengetopt_args_info_detailed_help[8]; gengetopt_args_info_help[9] = gengetopt_args_info_detailed_help[9]; gengetopt_args_info_help[10] = gengetopt_args_info_detailed_help[11]; gengetopt_args_info_help[11] = gengetopt_args_info_detailed_help[12]; gengetopt_args_info_help[12] = gengetopt_args_info_detailed_help[13]; gengetopt_args_info_help[13] = gengetopt_args_info_detailed_help[14]; gengetopt_args_info_help[14] = gengetopt_args_info_detailed_help[15]; gengetopt_args_info_help[15] = gengetopt_args_info_detailed_help[17]; gengetopt_args_info_help[16] = gengetopt_args_info_detailed_help[18]; gengetopt_args_info_help[17] = gengetopt_args_info_detailed_help[19]; gengetopt_args_info_help[18] = gengetopt_args_info_detailed_help[20]; gengetopt_args_info_help[19] = gengetopt_args_info_detailed_help[21]; gengetopt_args_info_help[20] = gengetopt_args_info_detailed_help[22]; gengetopt_args_info_help[21] = gengetopt_args_info_detailed_help[23]; gengetopt_args_info_help[22] = gengetopt_args_info_detailed_help[24]; gengetopt_args_info_help[23] = gengetopt_args_info_detailed_help[26]; gengetopt_args_info_help[24] = gengetopt_args_info_detailed_help[28]; gengetopt_args_info_help[25] = gengetopt_args_info_detailed_help[29]; gengetopt_args_info_help[26] = gengetopt_args_info_detailed_help[31]; gengetopt_args_info_help[27] = gengetopt_args_info_detailed_help[33]; gengetopt_args_info_help[28] = gengetopt_args_info_detailed_help[34]; gengetopt_args_info_help[29] = gengetopt_args_info_detailed_help[35]; gengetopt_args_info_help[30] = gengetopt_args_info_detailed_help[36]; gengetopt_args_info_help[31] = gengetopt_args_info_detailed_help[37]; gengetopt_args_info_help[32] = gengetopt_args_info_detailed_help[38]; gengetopt_args_info_help[33] = gengetopt_args_info_detailed_help[39]; gengetopt_args_info_help[34] = gengetopt_args_info_detailed_help[40]; gengetopt_args_info_help[35] = gengetopt_args_info_detailed_help[41]; gengetopt_args_info_help[36] = gengetopt_args_info_detailed_help[42]; gengetopt_args_info_help[37] = 0; } const char *gengetopt_args_info_help[38]; typedef enum {ARG_NO , ARG_FLAG , ARG_STRING } cmdline_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error); struct line_list { char * string_arg; struct line_list * next; }; static struct line_list *cmd_line_list = 0; static struct line_list *cmd_line_list_tmp = 0; static void free_cmd_list(void) { /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } } } static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->detailed_help_given = 0 ; args_info->version_given = 0 ; args_info->input_given = 0 ; args_info->func_name_given = 0 ; args_info->arg_struct_name_given = 0 ; args_info->file_name_given = 0 ; args_info->output_dir_given = 0 ; args_info->header_output_dir_given = 0 ; args_info->src_output_dir_given = 0 ; args_info->c_extension_given = 0 ; args_info->header_extension_given = 0 ; args_info->long_help_given = 0 ; args_info->default_optional_given = 0 ; args_info->unamed_opts_given = 0 ; args_info->conf_parser_given = 0 ; args_info->string_parser_given = 0 ; args_info->include_getopt_given = 0 ; args_info->no_handle_help_given = 0 ; args_info->no_help_given = 0 ; args_info->no_handle_version_given = 0 ; args_info->no_version_given = 0 ; args_info->no_handle_error_given = 0 ; args_info->show_required_given = 0 ; args_info->strict_hidden_given = 0 ; args_info->gen_version_given = 0 ; args_info->set_package_given = 0 ; args_info->set_version_given = 0 ; args_info->show_help_given = 0 ; args_info->show_full_help_given = 0 ; args_info->show_detailed_help_given = 0 ; args_info->show_version_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->input_arg = NULL; args_info->input_orig = NULL; args_info->func_name_arg = gengetopt_strdup ("cmdline_parser"); args_info->func_name_orig = NULL; args_info->arg_struct_name_arg = gengetopt_strdup ("gengetopt_args_info"); args_info->arg_struct_name_orig = NULL; args_info->file_name_arg = gengetopt_strdup ("cmdline"); args_info->file_name_orig = NULL; args_info->output_dir_arg = NULL; args_info->output_dir_orig = NULL; args_info->header_output_dir_arg = NULL; args_info->header_output_dir_orig = NULL; args_info->src_output_dir_arg = NULL; args_info->src_output_dir_orig = NULL; args_info->c_extension_arg = gengetopt_strdup ("c"); args_info->c_extension_orig = NULL; args_info->header_extension_arg = gengetopt_strdup ("h"); args_info->header_extension_orig = NULL; args_info->unamed_opts_arg = gengetopt_strdup ("FILES"); args_info->unamed_opts_orig = NULL; args_info->show_required_arg = gengetopt_strdup ("(mandatory)"); args_info->show_required_orig = NULL; args_info->gen_version_flag = 1; args_info->set_package_arg = NULL; args_info->set_package_orig = NULL; args_info->set_version_arg = NULL; args_info->set_version_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { init_help_array(); args_info->help_help = gengetopt_args_info_detailed_help[0] ; args_info->detailed_help_help = gengetopt_args_info_detailed_help[1] ; args_info->version_help = gengetopt_args_info_detailed_help[2] ; args_info->input_help = gengetopt_args_info_detailed_help[5] ; args_info->func_name_help = gengetopt_args_info_detailed_help[6] ; args_info->arg_struct_name_help = gengetopt_args_info_detailed_help[7] ; args_info->file_name_help = gengetopt_args_info_detailed_help[8] ; args_info->output_dir_help = gengetopt_args_info_detailed_help[9] ; args_info->header_output_dir_help = gengetopt_args_info_detailed_help[11] ; args_info->src_output_dir_help = gengetopt_args_info_detailed_help[12] ; args_info->c_extension_help = gengetopt_args_info_detailed_help[13] ; args_info->header_extension_help = gengetopt_args_info_detailed_help[14] ; args_info->long_help_help = gengetopt_args_info_detailed_help[15] ; args_info->default_optional_help = gengetopt_args_info_detailed_help[17] ; args_info->unamed_opts_help = gengetopt_args_info_detailed_help[18] ; args_info->conf_parser_help = gengetopt_args_info_detailed_help[20] ; args_info->string_parser_help = gengetopt_args_info_detailed_help[21] ; args_info->include_getopt_help = gengetopt_args_info_detailed_help[23] ; args_info->no_handle_help_help = gengetopt_args_info_detailed_help[24] ; args_info->no_help_help = gengetopt_args_info_detailed_help[26] ; args_info->no_handle_version_help = gengetopt_args_info_detailed_help[28] ; args_info->no_version_help = gengetopt_args_info_detailed_help[29] ; args_info->no_handle_error_help = gengetopt_args_info_detailed_help[31] ; args_info->show_required_help = gengetopt_args_info_detailed_help[33] ; args_info->strict_hidden_help = gengetopt_args_info_detailed_help[34] ; args_info->gen_version_help = gengetopt_args_info_detailed_help[35] ; args_info->set_package_help = gengetopt_args_info_detailed_help[36] ; args_info->set_version_help = gengetopt_args_info_detailed_help[37] ; args_info->show_help_help = gengetopt_args_info_detailed_help[38] ; args_info->show_full_help_help = gengetopt_args_info_detailed_help[39] ; args_info->show_detailed_help_help = gengetopt_args_info_detailed_help[40] ; args_info->show_version_help = gengetopt_args_info_detailed_help[41] ; } void cmdline_parser_print_version (void) { printf ("%s %s\n", (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), CMDLINE_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { cmdline_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void cmdline_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void cmdline_parser_print_detailed_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_detailed_help[i]) printf("%s\n", gengetopt_args_info_detailed_help[i++]); } void cmdline_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); } void cmdline_parser_params_init(struct cmdline_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct cmdline_parser_params * cmdline_parser_params_create(void) { struct cmdline_parser_params *params = (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); cmdline_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void cmdline_parser_release (struct gengetopt_args_info *args_info) { free_string_field (&(args_info->input_arg)); free_string_field (&(args_info->input_orig)); free_string_field (&(args_info->func_name_arg)); free_string_field (&(args_info->func_name_orig)); free_string_field (&(args_info->arg_struct_name_arg)); free_string_field (&(args_info->arg_struct_name_orig)); free_string_field (&(args_info->file_name_arg)); free_string_field (&(args_info->file_name_orig)); free_string_field (&(args_info->output_dir_arg)); free_string_field (&(args_info->output_dir_orig)); free_string_field (&(args_info->header_output_dir_arg)); free_string_field (&(args_info->header_output_dir_orig)); free_string_field (&(args_info->src_output_dir_arg)); free_string_field (&(args_info->src_output_dir_orig)); free_string_field (&(args_info->c_extension_arg)); free_string_field (&(args_info->c_extension_orig)); free_string_field (&(args_info->header_extension_arg)); free_string_field (&(args_info->header_extension_orig)); free_string_field (&(args_info->unamed_opts_arg)); free_string_field (&(args_info->unamed_opts_orig)); free_string_field (&(args_info->show_required_arg)); free_string_field (&(args_info->show_required_orig)); free_string_field (&(args_info->set_package_arg)); free_string_field (&(args_info->set_package_orig)); free_string_field (&(args_info->set_version_arg)); free_string_field (&(args_info->set_version_orig)); clear_given (args_info); } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { FIX_UNUSED (values); if (arg) { fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->detailed_help_given) write_into_file(outfile, "detailed-help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->input_given) write_into_file(outfile, "input", args_info->input_orig, 0); if (args_info->func_name_given) write_into_file(outfile, "func-name", args_info->func_name_orig, 0); if (args_info->arg_struct_name_given) write_into_file(outfile, "arg-struct-name", args_info->arg_struct_name_orig, 0); if (args_info->file_name_given) write_into_file(outfile, "file-name", args_info->file_name_orig, 0); if (args_info->output_dir_given) write_into_file(outfile, "output-dir", args_info->output_dir_orig, 0); if (args_info->header_output_dir_given) write_into_file(outfile, "header-output-dir", args_info->header_output_dir_orig, 0); if (args_info->src_output_dir_given) write_into_file(outfile, "src-output-dir", args_info->src_output_dir_orig, 0); if (args_info->c_extension_given) write_into_file(outfile, "c-extension", args_info->c_extension_orig, 0); if (args_info->header_extension_given) write_into_file(outfile, "header-extension", args_info->header_extension_orig, 0); if (args_info->long_help_given) write_into_file(outfile, "long-help", 0, 0 ); if (args_info->default_optional_given) write_into_file(outfile, "default-optional", 0, 0 ); if (args_info->unamed_opts_given) write_into_file(outfile, "unamed-opts", args_info->unamed_opts_orig, 0); if (args_info->conf_parser_given) write_into_file(outfile, "conf-parser", 0, 0 ); if (args_info->string_parser_given) write_into_file(outfile, "string-parser", 0, 0 ); if (args_info->include_getopt_given) write_into_file(outfile, "include-getopt", 0, 0 ); if (args_info->no_handle_help_given) write_into_file(outfile, "no-handle-help", 0, 0 ); if (args_info->no_help_given) write_into_file(outfile, "no-help", 0, 0 ); if (args_info->no_handle_version_given) write_into_file(outfile, "no-handle-version", 0, 0 ); if (args_info->no_version_given) write_into_file(outfile, "no-version", 0, 0 ); if (args_info->no_handle_error_given) write_into_file(outfile, "no-handle-error", 0, 0 ); if (args_info->show_required_given) write_into_file(outfile, "show-required", args_info->show_required_orig, 0); if (args_info->strict_hidden_given) write_into_file(outfile, "strict-hidden", 0, 0 ); if (args_info->gen_version_given) write_into_file(outfile, "gen-version", 0, 0 ); if (args_info->set_package_given) write_into_file(outfile, "set-package", args_info->set_package_orig, 0); if (args_info->set_version_given) write_into_file(outfile, "set-version", args_info->set_version_orig, 0); if (args_info->show_help_given) write_into_file(outfile, "show-help", 0, 0 ); if (args_info->show_full_help_given) write_into_file(outfile, "show-full-help", 0, 0 ); if (args_info->show_detailed_help_given) write_into_file(outfile, "show-detailed-help", 0, 0 ); if (args_info->show_version_given) write_into_file(outfile, "show-version", 0, 0 ); i = EXIT_SUCCESS; return i; } int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = cmdline_parser_dump(outfile, args_info); fclose (outfile); return i; } void cmdline_parser_free (struct gengetopt_args_info *args_info) { cmdline_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); } int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params) { int result; result = cmdline_parser_internal (argc, argv, args_info, params, 0); return result; } int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct cmdline_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); return result; } int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { FIX_UNUSED (args_info); FIX_UNUSED (prog_name); return EXIT_SUCCESS; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see cmdline_parser_params.check_ambiguity * @param override @see cmdline_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, cmdline_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } FIX_UNUSED (default_value); if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int cmdline_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) cmdline_parser_init (args_info); cmdline_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "detailed-help", 0, NULL, 0 }, { "version", 0, NULL, 'V' }, { "input", 1, NULL, 'i' }, { "func-name", 1, NULL, 'f' }, { "arg-struct-name", 1, NULL, 'a' }, { "file-name", 1, NULL, 'F' }, { "output-dir", 1, NULL, 0 }, { "header-output-dir", 1, NULL, 0 }, { "src-output-dir", 1, NULL, 0 }, { "c-extension", 1, NULL, 'c' }, { "header-extension", 1, NULL, 'H' }, { "long-help", 0, NULL, 'l' }, { "default-optional", 0, NULL, 0 }, { "unamed-opts", 2, NULL, 'u' }, { "conf-parser", 0, NULL, 'C' }, { "string-parser", 0, NULL, 'S' }, { "include-getopt", 0, NULL, 'G' }, { "no-handle-help", 0, NULL, 'n' }, { "no-help", 0, NULL, 0 }, { "no-handle-version", 0, NULL, 'N' }, { "no-version", 0, NULL, 0 }, { "no-handle-error", 0, NULL, 'e' }, { "show-required", 2, NULL, 0 }, { "strict-hidden", 0, NULL, 0 }, { "gen-version", 0, NULL, 'g' }, { "set-package", 1, NULL, 0 }, { "set-version", 1, NULL, 0 }, { "show-help", 0, NULL, 0 }, { "show-full-help", 0, NULL, 0 }, { "show-detailed-help", 0, NULL, 0 }, { "show-version", 0, NULL, 0 }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVi:f:a:F:c:H:lu::CSGnNeg", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ if (update_arg( 0 , 0 , &(args_info->help_given), &(local_args_info.help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "help", 'h', additional_error)) goto failure; cmdline_parser_free (&local_args_info); return 0; break; case 'V': /* Print version and exit. */ if (update_arg( 0 , 0 , &(args_info->version_given), &(local_args_info.version_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "version", 'V', additional_error)) goto failure; cmdline_parser_free (&local_args_info); return 0; break; case 'i': /* input file (default std input). */ if (update_arg( (void *)&(args_info->input_arg), &(args_info->input_orig), &(args_info->input_given), &(local_args_info.input_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "input", 'i', additional_error)) goto failure; break; case 'f': /* name of generated function. */ if (update_arg( (void *)&(args_info->func_name_arg), &(args_info->func_name_orig), &(args_info->func_name_given), &(local_args_info.func_name_given), optarg, 0, "cmdline_parser", ARG_STRING, check_ambiguity, override, 0, 0, "func-name", 'f', additional_error)) goto failure; break; case 'a': /* name of generated args info struct. */ if (update_arg( (void *)&(args_info->arg_struct_name_arg), &(args_info->arg_struct_name_orig), &(args_info->arg_struct_name_given), &(local_args_info.arg_struct_name_given), optarg, 0, "gengetopt_args_info", ARG_STRING, check_ambiguity, override, 0, 0, "arg-struct-name", 'a', additional_error)) goto failure; break; case 'F': /* name of generated file. */ if (update_arg( (void *)&(args_info->file_name_arg), &(args_info->file_name_orig), &(args_info->file_name_given), &(local_args_info.file_name_given), optarg, 0, "cmdline", ARG_STRING, check_ambiguity, override, 0, 0, "file-name", 'F', additional_error)) goto failure; break; case 'c': /* extension of c file. */ if (update_arg( (void *)&(args_info->c_extension_arg), &(args_info->c_extension_orig), &(args_info->c_extension_given), &(local_args_info.c_extension_given), optarg, 0, "c", ARG_STRING, check_ambiguity, override, 0, 0, "c-extension", 'c', additional_error)) goto failure; break; case 'H': /* extension of header file. */ if (update_arg( (void *)&(args_info->header_extension_arg), &(args_info->header_extension_orig), &(args_info->header_extension_given), &(local_args_info.header_extension_given), optarg, 0, "h", ARG_STRING, check_ambiguity, override, 0, 0, "header-extension", 'H', additional_error)) goto failure; break; case 'l': /* long usage line in help. */ if (update_arg( 0 , 0 , &(args_info->long_help_given), &(local_args_info.long_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "long-help", 'l', additional_error)) goto failure; break; case 'u': /* accept options without names (e.g., file names). */ if (update_arg( (void *)&(args_info->unamed_opts_arg), &(args_info->unamed_opts_orig), &(args_info->unamed_opts_given), &(local_args_info.unamed_opts_given), optarg, 0, "FILES", ARG_STRING, check_ambiguity, override, 0, 0, "unamed-opts", 'u', additional_error)) goto failure; break; case 'C': /* generate a config file parser. */ if (update_arg( 0 , 0 , &(args_info->conf_parser_given), &(local_args_info.conf_parser_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "conf-parser", 'C', additional_error)) goto failure; break; case 'S': /* generate a string parser (the string contains the command line). */ if (update_arg( 0 , 0 , &(args_info->string_parser_given), &(local_args_info.string_parser_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "string-parser", 'S', additional_error)) goto failure; break; case 'G': /* adds the code for getopt_long in the generated C file. */ if (update_arg( 0 , 0 , &(args_info->include_getopt_given), &(local_args_info.include_getopt_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "include-getopt", 'G', additional_error)) goto failure; break; case 'n': /* do not handle --help|-h automatically. */ if (update_arg( 0 , 0 , &(args_info->no_handle_help_given), &(local_args_info.no_handle_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-handle-help", 'n', additional_error)) goto failure; break; case 'N': /* do not handle --version|-V automatically. */ if (update_arg( 0 , 0 , &(args_info->no_handle_version_given), &(local_args_info.no_handle_version_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-handle-version", 'N', additional_error)) goto failure; break; case 'e': /* do not exit on errors. */ if (update_arg( 0 , 0 , &(args_info->no_handle_error_given), &(local_args_info.no_handle_error_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-handle-error", 'e', additional_error)) goto failure; break; case 'g': /* put gengetopt version in the generated file. */ if (update_arg((void *)&(args_info->gen_version_flag), 0, &(args_info->gen_version_given), &(local_args_info.gen_version_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "gen-version", 'g', additional_error)) goto failure; break; case 0: /* Long option with no short option */ /* Print help, including all details and hidden options, and exit. */ if (strcmp (long_options[option_index].name, "detailed-help") == 0) { if (update_arg( 0 , 0 , &(args_info->detailed_help_given), &(local_args_info.detailed_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "detailed-help", '-', additional_error)) goto failure; cmdline_parser_free (&local_args_info); return 0; } /* output directory. */ else if (strcmp (long_options[option_index].name, "output-dir") == 0) { if (update_arg( (void *)&(args_info->output_dir_arg), &(args_info->output_dir_orig), &(args_info->output_dir_given), &(local_args_info.output_dir_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "output-dir", '-', additional_error)) goto failure; } /* header output directory. */ else if (strcmp (long_options[option_index].name, "header-output-dir") == 0) { if (update_arg( (void *)&(args_info->header_output_dir_arg), &(args_info->header_output_dir_orig), &(args_info->header_output_dir_given), &(local_args_info.header_output_dir_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "header-output-dir", '-', additional_error)) goto failure; } /* source output directory. */ else if (strcmp (long_options[option_index].name, "src-output-dir") == 0) { if (update_arg( (void *)&(args_info->src_output_dir_arg), &(args_info->src_output_dir_orig), &(args_info->src_output_dir_given), &(local_args_info.src_output_dir_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "src-output-dir", '-', additional_error)) goto failure; } /* by default, an option is considered optional if not specified otherwise. */ else if (strcmp (long_options[option_index].name, "default-optional") == 0) { if (update_arg( 0 , 0 , &(args_info->default_optional_given), &(local_args_info.default_optional_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "default-optional", '-', additional_error)) goto failure; } /* do not add --help|-h automatically. */ else if (strcmp (long_options[option_index].name, "no-help") == 0) { if (update_arg( 0 , 0 , &(args_info->no_help_given), &(local_args_info.no_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-help", '-', additional_error)) goto failure; } /* do not add --version|-V automatically. */ else if (strcmp (long_options[option_index].name, "no-version") == 0) { if (update_arg( 0 , 0 , &(args_info->no_version_given), &(local_args_info.no_version_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "no-version", '-', additional_error)) goto failure; } /* in the output of help will specify which options are mandatory, by using the optional passed string. */ else if (strcmp (long_options[option_index].name, "show-required") == 0) { if (update_arg( (void *)&(args_info->show_required_arg), &(args_info->show_required_orig), &(args_info->show_required_given), &(local_args_info.show_required_given), optarg, 0, "(mandatory)", ARG_STRING, check_ambiguity, override, 0, 0, "show-required", '-', additional_error)) goto failure; } /* completely hide hidden options. */ else if (strcmp (long_options[option_index].name, "strict-hidden") == 0) { if (update_arg( 0 , 0 , &(args_info->strict_hidden_given), &(local_args_info.strict_hidden_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "strict-hidden", '-', additional_error)) goto failure; } /* set the package name (override package defined in the .ggo file). */ else if (strcmp (long_options[option_index].name, "set-package") == 0) { if (update_arg( (void *)&(args_info->set_package_arg), &(args_info->set_package_orig), &(args_info->set_package_given), &(local_args_info.set_package_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "set-package", '-', additional_error)) goto failure; } /* set the version number (override version defined in the .ggo file). */ else if (strcmp (long_options[option_index].name, "set-version") == 0) { if (update_arg( (void *)&(args_info->set_version_arg), &(args_info->set_version_orig), &(args_info->set_version_given), &(local_args_info.set_version_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "set-version", '-', additional_error)) goto failure; } /* show the output of --help instead of generating code. */ else if (strcmp (long_options[option_index].name, "show-help") == 0) { if (update_arg( 0 , 0 , &(args_info->show_help_given), &(local_args_info.show_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "show-help", '-', additional_error)) goto failure; } /* show the output of --full-help (i.e., including hidden options) instead of generating code. */ else if (strcmp (long_options[option_index].name, "show-full-help") == 0) { if (update_arg( 0 , 0 , &(args_info->show_full_help_given), &(local_args_info.show_full_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "show-full-help", '-', additional_error)) goto failure; } /* show the output of --detailed-help (i.e., including details and hidden options) instead of generating code. */ else if (strcmp (long_options[option_index].name, "show-detailed-help") == 0) { if (update_arg( 0 , 0 , &(args_info->show_detailed_help_given), &(local_args_info.show_detailed_help_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "show-detailed-help", '-', additional_error)) goto failure; } /* show the output of --version instead of generating code. */ else if (strcmp (long_options[option_index].name, "show-version") == 0) { if (update_arg( 0 , 0 , &(args_info->show_version_given), &(local_args_info.show_version_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "show-version", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ cmdline_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); return 0; failure: cmdline_parser_release (&local_args_info); return (EXIT_FAILURE); } static unsigned int cmdline_parser_create_argv(const char *cmdline_, char ***argv_ptr, const char *prog_name) { char *cmdline, *p; size_t n = 0, j; int i; if (prog_name) { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (prog_name); ++n; } cmdline = gengetopt_strdup(cmdline_); p = cmdline; while (p && strlen(p)) { j = strcspn(p, " \t"); ++n; if (j && j < strlen(p)) { p[j] = '\0'; cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); p += (j+1); p += strspn(p, " \t"); } else { cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list)); cmd_line_list_tmp->next = cmd_line_list; cmd_line_list = cmd_line_list_tmp; cmd_line_list->string_arg = gengetopt_strdup (p); break; } } *argv_ptr = (char **) malloc((n + 1) * sizeof(char *)); cmd_line_list_tmp = cmd_line_list; for (i = (n-1); i >= 0; --i) { (*argv_ptr)[i] = cmd_line_list_tmp->string_arg; cmd_line_list_tmp = cmd_line_list_tmp->next; } (*argv_ptr)[n] = 0; free(cmdline); return n; } int cmdline_parser_string(const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name) { return cmdline_parser_string2(cmdline, args_info, prog_name, 0, 1, 1); } int cmdline_parser_string2(const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name, int override, int initialize, int check_required) { struct cmdline_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; return cmdline_parser_string_ext(cmdline, args_info, prog_name, ¶ms); } int cmdline_parser_string_ext(const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name, struct cmdline_parser_params *params) { char **argv_ptr = 0; int result; unsigned int argc; argc = cmdline_parser_create_argv(cmdline, &argv_ptr, prog_name); result = cmdline_parser_internal (argc, argv_ptr, args_info, params, 0); if (argv_ptr) { free (argv_ptr); } free_cmd_list(); return result; } gengetopt-2.22.6/src/parser.yy0000664000175000017500000003356012045003074013172 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %{ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "acceptedvalues.h" #include "argsdef.h" #include "gengetopt.h" #include "errorcodes.h" #include "ggos.h" #include "yyerror.h" extern int gengetopt_count_line; extern char * gengetopt_input_filename; static int gengetopt_package_given = 0; static int gengetopt_version_given = 0; static int gengetopt_purpose_given = 0; static int gengetopt_versiontext_given = 0; static int gengetopt_usage_given = 0; static int gengetopt_description_given = 0; /// the last option parsed static gengetopt_option *current_option = 0; extern int yylex (void) ; //#define YYERROR_VERBOSE 1 using namespace std; void check_result(int o, gengetopt_option *opt) { if (o) { ostringstream err; switch (o) { case NOT_ENOUGH_MEMORY: yyerror (opt, "not enough memory"); break; case REQ_LONG_OPTION: err << "long option redefined \'" << opt->long_opt << "\'"; yyerror (opt, err.str().c_str()); break; case REQ_SHORT_OPTION: err << "short option redefined \'" << opt->short_opt << "\'"; yyerror (opt, err.str().c_str()); break; case FOUND_BUG: yyerror (opt, "bug found!!"); break; case GROUP_UNDEFINED: yyerror (opt, "group undefined"); break; case MODE_UNDEFINED: yyerror (opt, "mode undefined"); break; case INVALID_DEFAULT_VALUE: yyerror (opt, "invalid default value"); break; case NOT_REQUESTED_TYPE: yyerror (opt, "type specification not requested"); break; case NOT_VALID_SPECIFICATION: yyerror (opt, "invalid specification for this kind of option"); break; case SPECIFY_FLAG_STAT: yyerror (opt, "you must specify the default flag status"); break; case NOT_GROUP_OPTION: yyerror (opt, "group specification for a non group option"); break; case NOT_MODE_OPTION: yyerror (opt, "mode specification for an option not belonging to a mode"); break; case SPECIFY_GROUP: yyerror (opt, "missing group specification"); break; case SPECIFY_MODE: yyerror (opt, "missing mode specification"); break; case INVALID_NUMERIC_VALUE: yyerror (opt, "invalid numeric value"); break; case INVALID_ENUM_TYPE_USE: yyerror (opt, "enum type can only be specified for options with values"); break; case HELP_REDEFINED: yyerror (opt, "if you want to redefine --help, please use option --no-help"); break; case VERSION_REDEFINED: yyerror (opt, "if you want to redefine --version, please use option --no-version"); break; } } } /* the number of allowed occurrences of a multiple option */ struct multiple_size { /* these strings are allocated dynamically and NOT automatically freed upon destruction */ char *min; char *max; /* if no limit is specified then initialized to 0. if the same size is specified for min and max, it means that an exact number of occurrences is required*/ multiple_size(const char *m = "0", const char *M = "0") : min(strdup(m)), max(strdup(M)) {} }; #define check_error if (o) YYERROR; %} %union { char *str; char chr; int argtype; int boolean; class AcceptedValues *ValueList; struct gengetopt_option *gengetopt_option; struct multiple_size *multiple_size; } %token TOK_PACKAGE "package" %token TOK_VERSION "version" %token TOK_OPTION "option" %token TOK_DEFGROUP "defgroup" %token TOK_GROUPOPTION "groupoption" %token TOK_DEFMODE "defmode" %token TOK_MODEOPTION "modeoption" %token TOK_YES "yes" %token TOK_NO "no" %token TOK_ON "on" %token TOK_OFF "off" %token TOK_FLAG "flag" %token TOK_PURPOSE "purpose" %token TOK_DESCRIPTION "description" %token TOK_USAGE "usage" %token TOK_DEFAULT "default" %token TOK_GROUP "group" %token TOK_GROUPDESC "groupdesc" %token TOK_MODE "mode" %token TOK_MODEDESC "modedesc" %token TOK_MULTIPLE "multiple" %token TOK_ARGOPTIONAL "argoptional" %token TOK_TYPESTR "typestr" %token TOK_SECTION "section" %token TOK_DETAILS "details" %token TOK_SECTIONDESC "sectiondesc" %token TOK_TEXT "text" %token TOK_VERSIONTEXT "versiontext" %token TOK_ARGS "args" %token TOK_VALUES "values" %token TOK_HIDDEN "hidden" %token TOK_DEPENDON "dependon" %token TOK_STRING %token TOK_CHAR %token TOK_ARGTYPE %token TOK_SIZE %type req_onoff %type opt_yesno optional_yesno %type quoted_string %type opt_groupdesc %type opt_sectiondesc %type opt_modedesc %type listofvalues %type acceptedvalue %type option_parts %type multiple_size %% /* ====================================================================== */ input : /* empty */ | statement input ; statement : package | version | args | purpose | description | usage | sectiondef | option | text | versiontext | groupoption | groupdef | modeoption | modedef ; package : TOK_PACKAGE TOK_STRING { if (gengetopt_package_given) { yyerror ("package redefined"); YYERROR; } else { gengetopt_package_given = 1; if (gengetopt_define_package ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; version : TOK_VERSION TOK_STRING { if (gengetopt_version_given) { yyerror ("version redefined"); YYERROR; } else { gengetopt_version_given = 1; if (gengetopt_define_version ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; purpose : TOK_PURPOSE quoted_string { if (gengetopt_purpose_given) { yyerror ("purpose redefined"); YYERROR; } else { gengetopt_purpose_given = 1; if (gengetopt_define_purpose ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; description : TOK_DESCRIPTION quoted_string { if (gengetopt_description_given) { yyerror ("description redefined"); YYERROR; } else { gengetopt_description_given = 1; if (gengetopt_define_description ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; usage : TOK_USAGE quoted_string { if (gengetopt_usage_given) { yyerror ("usage redefined"); YYERROR; } else { gengetopt_usage_given = 1; if (gengetopt_define_usage ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; sectiondef : TOK_SECTION quoted_string opt_sectiondesc { gengetopt_set_section ($2, $3); } ; text : TOK_TEXT quoted_string { if (current_option) { std::string current_option_text; if (current_option->text_after) { current_option_text = std::string(current_option->text_after) + $2; current_option->text_after = strdup(current_option_text.c_str()); } else { current_option->text_after = strdup($2); } } else { gengetopt_set_text($2); } } ; versiontext : TOK_VERSIONTEXT quoted_string { if (gengetopt_versiontext_given) { yyerror ("versiontext redefined"); YYERROR; } else { gengetopt_versiontext_given = 1; if (gengetopt_define_versiontext ($2)) { yyerror ("not enough memory"); YYERROR; } } } ; args : TOK_ARGS TOK_STRING { gengetopt_set_args($2); } ; groupdef : TOK_DEFGROUP TOK_STRING opt_groupdesc optional_yesno { if (gengetopt_add_group ($2, $3, $4)) { yyerror ("group redefined"); YYERROR; } } ; modedef : TOK_DEFMODE TOK_STRING opt_modedesc { if (gengetopt_add_mode ($2, $3)) { yyerror ("mode redefined"); YYERROR; } } ; option : TOK_OPTION TOK_STRING TOK_CHAR quoted_string option_parts { $5->filename = gengetopt_input_filename; $5->linenum = @1.first_line; $5->long_opt = strdup($2); if ($3 != '-') $5->short_opt = $3; $5->desc = strdup($4); int o = gengetopt_check_option ($5, false); check_result(o, $5); check_error; o = gengetopt_add_option ($5); check_result(o, $5); check_error; current_option = $5; } ; groupoption : TOK_GROUPOPTION TOK_STRING TOK_CHAR quoted_string option_parts { $5->filename = gengetopt_input_filename; $5->linenum = @1.first_line; $5->long_opt = strdup($2); if ($3 != '-') $5->short_opt = $3; $5->desc = strdup($4); int o = gengetopt_check_option ($5, true); check_result(o, $5); check_error; o = gengetopt_add_option ($5); check_result(o, $5); check_error; } ; modeoption : TOK_MODEOPTION TOK_STRING TOK_CHAR quoted_string option_parts { $5->filename = gengetopt_input_filename; $5->linenum = @1.first_line; $5->long_opt = strdup($2); if ($3 != '-') $5->short_opt = $3; $5->desc = strdup($4); int o = gengetopt_check_option ($5, false, true); check_result(o, $5); check_error; o = gengetopt_add_option ($5); check_result(o, $5); check_error; } ; /* ---------------------------------------------------------------------- */ quoted_string : TOK_STRING ; option_parts: option_parts opt_yesno { $$ = $1; $$->required = $2; $$->required_set = true; } | option_parts TOK_ARGTYPE { $$ = $1; $$->type = $2; } | option_parts TOK_TYPESTR '=' TOK_STRING { $$ = $1; $$->type_str = strdup($4); } | option_parts TOK_DETAILS '=' quoted_string { $$ = $1; $$->details = strdup($4); } | option_parts TOK_VALUES '=' listofvalues { $$ = $1; $$->acceptedvalues = $4; } | option_parts TOK_DEFAULT '=' TOK_STRING { $$ = $1; $$->default_string = strdup($4); } | option_parts TOK_GROUP '=' TOK_STRING { $$ = $1; $$->group_value = strdup($4); } | option_parts TOK_MODE '=' TOK_STRING { $$ = $1; $$->mode_value = strdup($4); } | option_parts TOK_DEPENDON '=' TOK_STRING { $$ = $1; $$->dependon = strdup($4); } | option_parts TOK_ARGOPTIONAL { $$ = $1; $$->arg_is_optional = true; } | option_parts TOK_MULTIPLE multiple_size { $$ = $1; $$->multiple = true; $$->multiple_min = $3->min; $$->multiple_max = $3->max; delete $3; } | option_parts TOK_FLAG { $$ = $1; $$->type = ARG_FLAG; } | option_parts TOK_HIDDEN { $$ = $1; $$->hidden = true; } | option_parts req_onoff { $$ = $1; $$->flagstat = $2; } | { $$ = new gengetopt_option; } ; req_onoff : TOK_ON { $$ = 1; } | TOK_OFF { $$ = 0; } ; optional_yesno : /* empty */ { $$ = 0; } | TOK_YES { $$ = 1; } | TOK_NO { $$ = 0; } ; opt_yesno : TOK_YES { $$ = 1; } | TOK_NO { $$ = 0; } ; opt_groupdesc : /* empty */ { $$ = 0; } | TOK_GROUPDESC '=' TOK_STRING { $$ = $3; } ; opt_modedesc : /* empty */ { $$ = 0; } | TOK_MODEDESC '=' TOK_STRING { $$ = $3; } ; opt_sectiondesc : /* empty */ { $$ = 0; } | TOK_SECTIONDESC '=' TOK_STRING { $$ = $3; } ; listofvalues : acceptedvalue { $$ = new AcceptedValues; $$->insert($1); } | listofvalues ',' acceptedvalue { $1->insert($3); $$ = $1; } ; acceptedvalue : TOK_STRING { $$ = $1; } ; multiple_size : { $$ = new multiple_size; } | '(' TOK_SIZE ')' { $$ = new multiple_size($2, $2); } | '(' TOK_SIZE '-' ')' { $$ = new multiple_size($2, "0"); free($2); } | '(' '-' TOK_SIZE ')' { $$ = new multiple_size("0", $3); free($3); } | '(' TOK_SIZE '-' TOK_SIZE ')' { $$ = new multiple_size($2, $4); free($2); free($4); } ; %% gengetopt-2.22.6/src/ggos.h0000664000175000017500000000532712044745036012435 00000000000000/* This file is licensed to you under the license specified in the included file `LICENSE'. Look there for further details. */ #ifndef _GENGETOPT_GGOS_H #define _GENGETOPT_GGOS_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "acceptedvalues.h" #include "argsdef.h" /** * The structure for storing an option specified in the .ggo file */ struct gengetopt_option { char short_opt; /**< the short option specification (one char) */ char * long_opt; /**< the short option specification */ char * desc; /**< the option description */ int type; /**< the type of the option (possible values in `argsdef.h') */ int flagstat ; /**< if the option is of type flag, this indicates its state (on/off) */ int required; /**< whether the option required */ bool required_set; /**< whether the required property was set */ char * var_arg; /**< canonized long_opt + "_arg" = argument var */ int default_given ; /**< if a default is given */ char * default_string ; /**< default value for this option, if string */ char * group_value; /**< group name, if it's part of an option group */ char * group_desc; /**< group description, if it's part of an option group */ char * mode_value; /**< mode name, if it's part of an option mode */ char * mode_desc; /**< mode description, if it's part of an option mode */ bool multiple; /**< whether this option can be given more than once */ char * multiple_min; /**< minimum occurrences of a multiple option (-1: not specified) */ char * multiple_max; /**< maximum occurrences of a multiple option (-1: not specified) */ bool arg_is_optional; /**< whether the argument is optional */ bool hidden; /**< whether this option will be hidden from the help output */ char *type_str; /**< Alternative name for type, e.g. "URL" or "SECONDS" */ const AcceptedValues *acceptedvalues; /**< values that can be passed to this option */ char *section; /**< the section of this option */ char *section_desc; /**< the description associated with the possible section */ char *dependon; /**< the name of the option this one depends on */ char *text_before; /**< a possible text specified before this option */ char *text_after; /**< a possible text specified after this option */ char *details; /**< possible further details for this option that will be printed only if --detailed-help is specified */ /**< parser information */ char *filename; /**< source file */ int linenum; /**< line number */ gengetopt_option(); }; /** the list storing gengetopt options */ typedef std::list gengetopt_option_list; std::ostream & operator <<(std::ostream &s, gengetopt_option &opt); #endif /* _GENGETOPT_GGOS_H */ gengetopt-2.22.6/src/globals.h0000664000175000017500000000200412044745036013106 00000000000000/** * Copyright (C) 1999-2010 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef GLOBALS_H_ #define GLOBALS_H_ #include "ggos.h" #include "groups.h" extern gengetopt_option_list gengetopt_options; extern groups_collection_t gengetopt_groups; #endif /* GLOBALS_H_ */ gengetopt-2.22.6/src/errorcodes.h0000664000175000017500000000136112044745036013637 00000000000000// // C++ Interface: errorcodes // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ERRORCODES_H #define ERRORCODES_H #define NOT_ENOUGH_MEMORY 1 #define REQ_LONG_OPTION 2 #define REQ_SHORT_OPTION 3 #define FOUND_BUG 4 #define GROUP_UNDEFINED 5 #define INVALID_DEFAULT_VALUE 6 #define NOT_REQUESTED_TYPE 7 #define NOT_VALID_SPECIFICATION 8 #define SPECIFY_FLAG_STAT 9 #define NOT_GROUP_OPTION 10 #define SPECIFY_GROUP 11 #define INVALID_NUMERIC_VALUE 12 #define INVALID_ENUM_TYPE_USE 13 #define MODE_UNDEFINED 14 #define NOT_MODE_OPTION 15 #define SPECIFY_MODE 16 #define HELP_REDEFINED 17 #define VERSION_REDEFINED 18 #endif gengetopt-2.22.6/src/gm_utils.cpp0000664000175000017500000001744412045003074013645 00000000000000// // C++ Implementation: gm_utils // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "gm_utils.h" #include "ggo_options.h" #include "argsdef.h" #include "groups.h" using namespace std; extern groups_collection_t gengetopt_groups; char * canonize_names(const char *name) { char *pvar; char *p; pvar = strdup(name); for (p = pvar; *p; ++p) if (*p == '.' || *p == '-' || *p == '/') *p = '_'; return pvar; } // remove the path from the file name const string strip_path(const string &s) { string::size_type pos_of_sep; pos_of_sep = s.rfind("/"); if (pos_of_sep == string::npos) pos_of_sep = s.rfind("\\"); // try also with DOS path sep if (pos_of_sep == string::npos) return s; // no path return s.substr(pos_of_sep + 1); } const string to_upper(const string &old) { string upper = old; for (string::iterator s = upper.begin(); s != upper.end(); ++s) *s = toupper(*s); return upper; } const string canonize_name(const string &old) { string canonized = old; for (string::iterator s = canonized.begin(); s != canonized.end(); ++s) if (*s == '.' || *s == '-' || *s == ' ' || *s == '/') *s = '_'; return canonized; } const string canonize_enum(const string &old) { string canonized; for (string::const_iterator s = old.begin(); s != old.end(); ++s) if (*s == '-') canonized += "MINUS_"; else if (*s == '+') canonized += "PLUS_"; else canonized += *s; return canonized; } bool has_multiple_options_all_string() { if (!has_multiple_options()) return false; struct gengetopt_option * opt = 0; foropt { if (opt->multiple && (opt->type && opt->type != ARG_STRING)) return false; } return true; } bool has_multiple_options_string() { if (!has_multiple_options()) return false; struct gengetopt_option * opt = 0; foropt { if (opt->multiple && opt->type == ARG_STRING) return true; } return false; } bool has_multiple_options() { struct gengetopt_option * opt = 0; foropt { if (opt->multiple) return true; } return false; } bool has_multiple_options_with_type() { gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end() && (opt = *it); ++it) if (opt->multiple && opt->type) return true; return false; } bool has_multiple_options_with_default() { gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end() && (opt = *it); ++it) if (opt->multiple && opt->default_given) return true; return false; } bool has_options_with_details(bool strict_hidden) { gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end() && (opt = *it); ++it) if (opt->details && (!strict_hidden || !opt->hidden)) return true; return false; } bool has_options_with_type() { gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end() && (opt = *it); ++it) if (opt->type && opt->type != ARG_FLAG) return true; return false; } bool has_options_with_mode() { gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end() && (opt = *it); ++it) if (opt->mode_value) return true; return false; } bool has_required() { struct gengetopt_option * opt = 0; foropt { if (opt->required) return true; } groups_collection_t::const_iterator end = gengetopt_groups.end(); for (groups_collection_t::const_iterator idx = gengetopt_groups.begin(); idx != end; ++idx) { if (idx->second.required) { return true; } } return false; } bool has_dependencies() { struct gengetopt_option * opt = 0; foropt { if (opt->dependon) return true; } return false; } bool has_options() { struct gengetopt_option * opt = 0; foropt { if (opt->short_opt) { if (opt->short_opt != 'h' && opt->short_opt != 'V') return true; } } return false; } bool has_hidden_options() { struct gengetopt_option * opt = 0; foropt { if (opt->hidden) { return true; } } return false; } bool has_values() { struct gengetopt_option * opt = 0; for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end(); ++it) { opt = *it; if (opt->acceptedvalues) { return true; } } return false; } int not_newlines(const string &buf, int &num_of_newlines) { num_of_newlines = 0; // searches for the first non newline char string::size_type notnewline = buf.find_first_not_of("\r\n"); if (notnewline == string::npos) { // a string made only of newlines num_of_newlines = buf.size(); return num_of_newlines; } if (notnewline) { // everything before the non newline char is a newline num_of_newlines = notnewline; return notnewline; } return 0; } void wrap_cstr(string& wrapped, unsigned int from_column, unsigned int second_indent, const string &orig) { int next_space = from_column; string next_word; const char * out_buf = orig.c_str(); ostringstream stream; const unsigned int second_line_column = from_column + second_indent; string indent(second_line_column, ' '); int newline_chars = 0; int num_of_newlines = 0; while (*out_buf) { // check for a new line if ((newline_chars = not_newlines(out_buf, num_of_newlines))) { for (int i = 1; i <= num_of_newlines; ++i) stream << "\\n"; out_buf += newline_chars; if (*out_buf) { stream << indent; next_space = second_line_column; continue; } else break; } // find next word (including any preceeding spaces) bool had_word = false; while ((*out_buf) && (*out_buf != ' ' || !had_word) && !not_newlines(out_buf, num_of_newlines)) { had_word = *out_buf != ' '; next_word += *out_buf++; next_space++; } // wrap line if it's too long if (next_space > 79) { // trim leading spaces std::size_t pos = next_word.find_first_not_of(' '); if( pos == std::string::npos ) next_word.empty(); else if( pos ) next_word.erase( 0, pos ); stream << "\\n" << indent << next_word; next_space = second_line_column + next_word.size(); } else stream << next_word; // simply write word next_word = ""; } wrapped += stream.str(); } bool is_numeric(const gengetopt_option *opt) { switch (opt->type) { case ARG_INT: case ARG_SHORT: case ARG_LONG: case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: case ARG_LONGLONG: return true; default: return false; } } bool string_contains(const char *s, const char *tofind) { if (!s) return false; return (strstr(s, tofind) != 0); } gengetopt-2.22.6/src/acceptedvalues.cpp0000664000175000017500000000142412044745036015013 00000000000000// // C++ Implementation: acceptedvalues // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "acceptedvalues.h" using namespace std; void AcceptedValues::insert(const string &s) { push_back(s); values.insert(s); } bool AcceptedValues::contains(const string &s) const { return (values.count(s) > 0); } const string AcceptedValues::toString(bool escape) const { ostringstream buf; for (const_iterator it = begin(); it != end(); ) { buf << (escape ? "\\\"" : "\"") << *it << (escape ? "\\\"" : "\""); if (++it != end()) buf << ", "; } return buf.str(); } gengetopt-2.22.6/src/argsdef.c0000664000175000017500000000306512044745036013101 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "argsdef.h" const char * arg_names [] = { (const char*)0, (const char*)0, "STRING", "INT", "SHORT", "LONG", "FLOAT", "DOUBLE", "LONGDOUBLE", "LONGLONG", "ENUM" }; const char * arg_type_constants [] = { "ARG_NO", "ARG_FLAG", "ARG_STRING", "ARG_INT", "ARG_SHORT", "ARG_LONG", "ARG_FLOAT", "ARG_DOUBLE", "ARG_LONGDOUBLE", "ARG_LONGLONG", "ARG_ENUM" }; const char * arg_types [] = { (const char*)0, "int", "char *", "int", "short", "long", "float", "double", "long double", "long long int", "enum" }; const char * arg_types_names [] = { (const char*)0, "int", "string", "int", "short", "long", "float", "double", "longdouble", "longlong", "int" }; gengetopt-2.22.6/src/getopt1.c0000664000175000017500000001065012044745036013047 00000000000000/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ gengetopt-2.22.6/src/yyerror.cc0000664000175000017500000000207712044745036013346 00000000000000/* This file is licensed to you under the license specified in the included file `LICENSE'. Look there for further details. */ /* Called by yyparse on error. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "yyerror.h" #include #include #include extern int gengetopt_count_line; extern char * gengetopt_input_filename; extern int tokenpos; extern char linebuf[]; extern char *yytext; using namespace std; void yyerror (const char *s) { const char *source = (gengetopt_input_filename ? gengetopt_input_filename : "gengetopt"); fprintf (stderr, "%s:%d: %s %s\n", source, gengetopt_count_line, s, yytext); if (/*!linebuf || */!strlen(linebuf)) return; fprintf (stderr, "%s:%d: %s\n", source, gengetopt_count_line, linebuf); fprintf (stderr, "%s:%d: %*s\n", source, gengetopt_count_line, tokenpos + 1, "^"); } void yyerror (gengetopt_option *opt, const char *s) { const char *source = (opt->filename ? opt->filename : "gengetopt"); cerr << source << ":" << opt->linenum << ": " << s << endl; } gengetopt-2.22.6/src/gnugetopt.h0000664000175000017500000001445712044745036013516 00000000000000/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { # if (defined __STDC__ && __STDC__) || defined __cplusplus const char *name; # else char *name; # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #if (defined __STDC__ && __STDC__) || defined __cplusplus # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int __argc, char *const *__argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ extern int getopt (); # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #else /* not __STDC__ */ extern int getopt (); # ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); # endif #endif /* __STDC__ */ #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ gengetopt-2.22.6/src/ggo_options.h0000664000175000017500000000051512044745036014017 00000000000000#ifndef GGO_OPTIONS_H #define GGO_OPTIONS_H #include "ggos.h" extern gengetopt_option_list gengetopt_options; #define foropt for (gengetopt_option_list::iterator it = gengetopt_options.begin(); \ it != gengetopt_options.end() && (opt = *it); \ ++it) #endif /* GGO_OPTIONS_H */ gengetopt-2.22.6/src/globals.cpp0000664000175000017500000000172612044745036013453 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "globals.h" gengetopt_option_list gengetopt_options; groups_collection_t gengetopt_groups; gengetopt-2.22.6/src/scanner.ll0000664000175000017500000001526012045003074013272 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %{ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "argsdef.h" #include "parser.h" extern int gengetopt_count_line; static void update_count_line (char *str); static void updateTokenInfo (int pos); // the buffer for strings (possibly spanning more lines) static std::ostringstream buff; static void buffer(const char *s); static char *flush_buffer(); #define LINEBUF_LEN 1024 #define PUSH(s) yy_push_state(s); #define POP() yy_pop_state(); int tokenpos = 0; char linebuf[LINEBUF_LEN] ; /* current line */ //#define DEBUG_SCANNER #ifdef DEBUG_SCANNER #include // for debug #define DEB(s) std::cerr << s << std::endl; #define DEB2(s,s2) std::cerr << s << ": " << s2 << std::endl; #else #define DEB(s) #define DEB2(s,s2) #endif %} %option stack nomain yylineno noyywrap nounput ws [ ]+ tabs [\t]+ %s SIZE_STATE STRING_STATE %% string updateTokenInfo (-1); yylval.argtype = ARG_STRING; return TOK_ARGTYPE; int updateTokenInfo (-1); yylval.argtype = ARG_INT; return TOK_ARGTYPE; short updateTokenInfo (-1); yylval.argtype = ARG_SHORT; return TOK_ARGTYPE; long updateTokenInfo (-1); yylval.argtype = ARG_LONG; return TOK_ARGTYPE; float updateTokenInfo (-1); yylval.argtype = ARG_FLOAT; return TOK_ARGTYPE; double updateTokenInfo (-1); yylval.argtype = ARG_DOUBLE; return TOK_ARGTYPE; longdouble updateTokenInfo (-1); yylval.argtype = ARG_LONGDOUBLE; return TOK_ARGTYPE; longlong updateTokenInfo (-1); yylval.argtype = ARG_LONGLONG; return TOK_ARGTYPE; enum updateTokenInfo (-1); yylval.argtype = ARG_ENUM; return TOK_ARGTYPE; package updateTokenInfo (-1); return TOK_PACKAGE; version updateTokenInfo (-1); return TOK_VERSION; groupoption updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_GROUPOPTION; modeoption updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_MODEOPTION; yes|required updateTokenInfo (-1); return TOK_YES; no|optional updateTokenInfo (-1); return TOK_NO; option updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_OPTION; flag updateTokenInfo (-1); return TOK_FLAG; on updateTokenInfo (-1); return TOK_ON; off updateTokenInfo (-1); return TOK_OFF; purpose updateTokenInfo (-1); return TOK_PURPOSE; description updateTokenInfo (-1); return TOK_DESCRIPTION; usage updateTokenInfo (-1); return TOK_USAGE; default updateTokenInfo (-1); return TOK_DEFAULT; typestr updateTokenInfo (-1); return TOK_TYPESTR; group updateTokenInfo (-1); return TOK_GROUP; groupdesc updateTokenInfo (-1); return TOK_GROUPDESC; defgroup updateTokenInfo (-1); return TOK_DEFGROUP; mode updateTokenInfo (-1); return TOK_MODE; modedesc updateTokenInfo (-1); return TOK_MODEDESC; defmode updateTokenInfo (-1); return TOK_DEFMODE; multiple updateTokenInfo (-1); return TOK_MULTIPLE; argoptional updateTokenInfo (-1); return TOK_ARGOPTIONAL; sectiondesc updateTokenInfo (-1); return TOK_SECTIONDESC; section updateTokenInfo (-1); return TOK_SECTION; values updateTokenInfo (-1); return TOK_VALUES; hidden updateTokenInfo (-1); return TOK_HIDDEN; dependon updateTokenInfo (-1); return TOK_DEPENDON; details updateTokenInfo (-1); return TOK_DETAILS; text updateTokenInfo (-1); return TOK_TEXT; versiontext updateTokenInfo (-1); return TOK_VERSIONTEXT; args updateTokenInfo (-1); return TOK_ARGS; "=" { updateTokenInfo (-1); return '='; } "," { updateTokenInfo (-1); return ','; } "(" { PUSH(SIZE_STATE); updateTokenInfo (-1); return '('; } "-" { updateTokenInfo (-1); return '-'; } [[:digit:]]+ { updateTokenInfo (-1); yylval.str = strdup(yytext); return TOK_SIZE; } ")" { POP(); updateTokenInfo (-1); return ')'; } [[:alnum:]-]|\? updateTokenInfo (-1); yylval.chr = yytext[0]; return TOK_CHAR; \" { updateTokenInfo (-1); DEB("start string"); PUSH(STRING_STATE) ; } \\\\n { updateTokenInfo (2); buffer("\\\\n"); } \\n { updateTokenInfo (1); buffer("\n"); } \n+ { update_count_line (yytext); buffer( yytext ) ; } \\{ws}*\n { update_count_line (yytext); /* a line break */ } \\\" { updateTokenInfo (-1); buffer(yytext); } \" { updateTokenInfo (-1); DEB("end string"); POP() ; yylval.str = flush_buffer(); return TOK_STRING; } [^\n] { updateTokenInfo (-1); buffer( yytext ) ; } {ws} updateTokenInfo (-1); {tabs} updateTokenInfo (8*yyleng); #[^\n]* /* comments begin with # in any place (but strings) */ \n.* update_count_line (0); yyless(1) ; /* give back all but the \n to rescan */ \r {} . { return 1000; /* little hack to produce a parse error too. */ } %% /* Otherwise '\n' within a TOK_MLSTRING would not be counted */ void update_count_line (char *str) { if (str) { char *p; for (p = str; *p; ++p) if (*p == '\n') { ++gengetopt_count_line; tokenpos = 0 ; /* reset token position */ strncpy (linebuf, ( (p+1) ? p+1 : ""), LINEBUF_LEN - 1); } } else { ++gengetopt_count_line; tokenpos = 0 ; /* reset token position */ strncpy (linebuf, yytext+1, LINEBUF_LEN - 1); /* save the next line */ } } void updateTokenInfo( int pos ) { if ( pos >= 0 ) tokenpos += pos ; else tokenpos += yyleng ; } void buffer(const char *s) { buff << s; } char *flush_buffer() { char *ret = strdup(buff.str().c_str()); buff.str(""); return ret; } gengetopt-2.22.6/src/cmdline.h0000664000175000017500000004117312045003074013076 00000000000000/** @file cmdline.h * @brief The header file for the command line option parser * generated by GNU Gengetopt version 2.22.6 * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef CMDLINE_H #define CMDLINE_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef CMDLINE_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define CMDLINE_PARSER_PACKAGE PACKAGE #endif #ifndef CMDLINE_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #ifdef PACKAGE_NAME #define CMDLINE_PARSER_PACKAGE_NAME PACKAGE_NAME #else #define CMDLINE_PARSER_PACKAGE_NAME PACKAGE #endif #endif #ifndef CMDLINE_PARSER_VERSION /** @brief the program version */ #define CMDLINE_PARSER_VERSION VERSION #endif /** @brief Where the command line options are stored */ struct gengetopt_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *detailed_help_help; /**< @brief Print help, including all details and hidden options, and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * input_arg; /**< @brief input file (default std input). */ char * input_orig; /**< @brief input file (default std input) original value given at command line. */ const char *input_help; /**< @brief input file (default std input) help description. */ char * func_name_arg; /**< @brief name of generated function (default='cmdline_parser'). */ char * func_name_orig; /**< @brief name of generated function original value given at command line. */ const char *func_name_help; /**< @brief name of generated function help description. */ char * arg_struct_name_arg; /**< @brief name of generated args info struct (default='gengetopt_args_info'). */ char * arg_struct_name_orig; /**< @brief name of generated args info struct original value given at command line. */ const char *arg_struct_name_help; /**< @brief name of generated args info struct help description. */ char * file_name_arg; /**< @brief name of generated file (default='cmdline'). */ char * file_name_orig; /**< @brief name of generated file original value given at command line. */ const char *file_name_help; /**< @brief name of generated file help description. */ char * output_dir_arg; /**< @brief output directory. */ char * output_dir_orig; /**< @brief output directory original value given at command line. */ const char *output_dir_help; /**< @brief output directory help description. */ char * header_output_dir_arg; /**< @brief header output directory. */ char * header_output_dir_orig; /**< @brief header output directory original value given at command line. */ const char *header_output_dir_help; /**< @brief header output directory help description. */ char * src_output_dir_arg; /**< @brief source output directory. */ char * src_output_dir_orig; /**< @brief source output directory original value given at command line. */ const char *src_output_dir_help; /**< @brief source output directory help description. */ char * c_extension_arg; /**< @brief extension of c file (default='c'). */ char * c_extension_orig; /**< @brief extension of c file original value given at command line. */ const char *c_extension_help; /**< @brief extension of c file help description. */ char * header_extension_arg; /**< @brief extension of header file (default='h'). */ char * header_extension_orig; /**< @brief extension of header file original value given at command line. */ const char *header_extension_help; /**< @brief extension of header file help description. */ const char *long_help_help; /**< @brief long usage line in help help description. */ const char *default_optional_help; /**< @brief by default, an option is considered optional if not specified otherwise help description. */ char * unamed_opts_arg; /**< @brief accept options without names (e.g., file names) (default='FILES'). */ char * unamed_opts_orig; /**< @brief accept options without names (e.g., file names) original value given at command line. */ const char *unamed_opts_help; /**< @brief accept options without names (e.g., file names) help description. */ const char *conf_parser_help; /**< @brief generate a config file parser help description. */ const char *string_parser_help; /**< @brief generate a string parser (the string contains the command line) help description. */ const char *include_getopt_help; /**< @brief adds the code for getopt_long in the generated C file help description. */ const char *no_handle_help_help; /**< @brief do not handle --help|-h automatically help description. */ const char *no_help_help; /**< @brief do not add --help|-h automatically help description. */ const char *no_handle_version_help; /**< @brief do not handle --version|-V automatically help description. */ const char *no_version_help; /**< @brief do not add --version|-V automatically help description. */ const char *no_handle_error_help; /**< @brief do not exit on errors help description. */ char * show_required_arg; /**< @brief in the output of help will specify which options are mandatory, by using the optional passed string (default='(mandatory)'). */ char * show_required_orig; /**< @brief in the output of help will specify which options are mandatory, by using the optional passed string original value given at command line. */ const char *show_required_help; /**< @brief in the output of help will specify which options are mandatory, by using the optional passed string help description. */ const char *strict_hidden_help; /**< @brief completely hide hidden options help description. */ int gen_version_flag; /**< @brief put gengetopt version in the generated file (default=on). */ const char *gen_version_help; /**< @brief put gengetopt version in the generated file help description. */ char * set_package_arg; /**< @brief set the package name (override package defined in the .ggo file). */ char * set_package_orig; /**< @brief set the package name (override package defined in the .ggo file) original value given at command line. */ const char *set_package_help; /**< @brief set the package name (override package defined in the .ggo file) help description. */ char * set_version_arg; /**< @brief set the version number (override version defined in the .ggo file). */ char * set_version_orig; /**< @brief set the version number (override version defined in the .ggo file) original value given at command line. */ const char *set_version_help; /**< @brief set the version number (override version defined in the .ggo file) help description. */ const char *show_help_help; /**< @brief show the output of --help instead of generating code help description. */ const char *show_full_help_help; /**< @brief show the output of --full-help (i.e., including hidden options) instead of generating code help description. */ const char *show_detailed_help_help; /**< @brief show the output of --detailed-help (i.e., including details and hidden options) instead of generating code help description. */ const char *show_version_help; /**< @brief show the output of --version instead of generating code help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int detailed_help_given ; /**< @brief Whether detailed-help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int input_given ; /**< @brief Whether input was given. */ unsigned int func_name_given ; /**< @brief Whether func-name was given. */ unsigned int arg_struct_name_given ; /**< @brief Whether arg-struct-name was given. */ unsigned int file_name_given ; /**< @brief Whether file-name was given. */ unsigned int output_dir_given ; /**< @brief Whether output-dir was given. */ unsigned int header_output_dir_given ; /**< @brief Whether header-output-dir was given. */ unsigned int src_output_dir_given ; /**< @brief Whether src-output-dir was given. */ unsigned int c_extension_given ; /**< @brief Whether c-extension was given. */ unsigned int header_extension_given ; /**< @brief Whether header-extension was given. */ unsigned int long_help_given ; /**< @brief Whether long-help was given. */ unsigned int default_optional_given ; /**< @brief Whether default-optional was given. */ unsigned int unamed_opts_given ; /**< @brief Whether unamed-opts was given. */ unsigned int conf_parser_given ; /**< @brief Whether conf-parser was given. */ unsigned int string_parser_given ; /**< @brief Whether string-parser was given. */ unsigned int include_getopt_given ; /**< @brief Whether include-getopt was given. */ unsigned int no_handle_help_given ; /**< @brief Whether no-handle-help was given. */ unsigned int no_help_given ; /**< @brief Whether no-help was given. */ unsigned int no_handle_version_given ; /**< @brief Whether no-handle-version was given. */ unsigned int no_version_given ; /**< @brief Whether no-version was given. */ unsigned int no_handle_error_given ; /**< @brief Whether no-handle-error was given. */ unsigned int show_required_given ; /**< @brief Whether show-required was given. */ unsigned int strict_hidden_given ; /**< @brief Whether strict-hidden was given. */ unsigned int gen_version_given ; /**< @brief Whether gen-version was given. */ unsigned int set_package_given ; /**< @brief Whether set-package was given. */ unsigned int set_version_given ; /**< @brief Whether set-version was given. */ unsigned int show_help_given ; /**< @brief Whether show-help was given. */ unsigned int show_full_help_given ; /**< @brief Whether show-full-help was given. */ unsigned int show_detailed_help_given ; /**< @brief Whether show-detailed-help was given. */ unsigned int show_version_given ; /**< @brief Whether show-version was given. */ } ; /** @brief The additional parameters to pass to parser functions */ struct cmdline_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ extern const char *gengetopt_args_info_usage; /** @brief all the lines making the help output */ extern const char *gengetopt_args_info_help[]; /** @brief all the lines making the detailed help output (including hidden options and details) */ extern const char *gengetopt_args_info_detailed_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use cmdline_parser_ext() instead */ int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info); /** * Print the help */ void cmdline_parser_print_help(void); /** * Print the detailed help (including hidden options and details) */ void cmdline_parser_print_detailed_help(void); /** * Print the version */ void cmdline_parser_print_version(void); /** * Initializes all the fields a cmdline_parser_params structure * to their default values * @param params the structure to initialize */ void cmdline_parser_params_init(struct cmdline_parser_params *params); /** * Allocates dynamically a cmdline_parser_params structure and initializes * all its fields to their default values * @return the created and initialized cmdline_parser_params structure */ struct cmdline_parser_params *cmdline_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void cmdline_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void cmdline_parser_free (struct gengetopt_args_info *args_info); /** * The string parser (interprets the passed string as a command line) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_string (const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name); /** * The string parser (version with additional parameters - deprecated) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use cmdline_parser_string_ext() instead */ int cmdline_parser_string2 (const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name, int override, int initialize, int check_required); /** * The string parser (version with additional parameters) * @param cmdline the command line stirng * @param args_info the structure where option information will be stored * @param prog_name the name of the program that will be used to print * possible errors * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int cmdline_parser_string_ext (const char *cmdline, struct gengetopt_args_info *args_info, const char *prog_name, struct cmdline_parser_params *params); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* CMDLINE_H */ gengetopt-2.22.6/src/Makefile.am0000664000175000017500000000736512044745036013365 00000000000000# Copyright (C) 1999-2009 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SUBDIRS = skels tests #INCLUDES = -I@top_srcdir@/src/skels SUFFIXES = .text .c .ggo .text.o: $(TXTC) $< bin_PROGRAMS = gengetopt noinst_LTLIBRARIES = libgengetopt.la libgengetopt_la_SOURCES = parser.cc scanner.cc \ globals.cpp \ argsdef.c cmdline.ggo gm.cc \ yyerror.cc gm_utils.cpp fileutils.cpp acceptedvalues.cpp ggos.cpp gengetopt_SOURCES = gengetopt.cc scanner.cc: $(srcdir)/scanner.ll $(LEX) $(LFLAGS) -o $(srcdir)/scanner.cc $(srcdir)/scanner.ll parser.cc: $(srcdir)/parser.yy $(YACC) -o $(srcdir)/parser.cc $(srcdir)/parser.yy --defines=$(srcdir)/parser.h #gengetopt_LDADD = @LIBOBJS@ @LEXLIB@ skels/libgen.a # these are for gnulib AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl libgengetopt_la_LIBADD = $(top_builddir)/gl/libgnu.la \ @LTLIBOBJS@ \ skels/libgen.la LDADD = $(top_builddir)/src/libgengetopt.la EXTRA_DIST = parser.h argsdef.h gengetopt.h ggos.h gm.h gnugetopt.h \ cmdline.c cmdline.h \ global_opts.h \ ggo_options.h \ groups.h \ parser.yy scanner.ll \ globals.h \ $(pkgdata_DATA) # version of gengetopt linked to the ElectricFence library # don't use it anymore: use valgrind #EXTRA_PROGRAMS = gengetopt-efence #gengetopt_efence_SOURCES = $(gengetopt_SOURCES) #gengetopt_efence_LDADD = -lefence $(gengetopt_LDADD) PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT) # to have flex generate a case insensitive scanner AM_LFLAGS = -i # it may happen, usually if the sources have been downloaded from CVS # repository, that cmdline.ggo is more recent than cmdline.c, but # cmdline.c cannot be re-generated, even because gengetopt has # to be built first. For instance if you only change spaces in cmdline.ggo # cmdline.c will not be different, and thus it is not updated in the CVS # repository; then when you make a checkout on another place, make # would try to build cmdline.c, but to do this it would need gengetopt # which is not built yet; so we simply touch cmdline.c (and this is safe) .ggo.c: if test -f $(PROGNAME); then \ $(PROGNAME) --input=$< --output-dir=$(srcdir) ; \ else touch $(srcdir)/$@ ; fi cmdline.h: cmdline.c BUILT_SOURCES = cmdline.h cmdline.c parser.cc scanner.cc # automatically generate gengetopt_strdup() from the replacement function # strdup(). # gengetopt_strdup.text: strdup.c # echo "/* gengetopt_strdup(): automatically generated from strdup.c. */" > $@ # cat strdup.c | sed -e 's/^strdup (/gengetopt_&/' \ # -e 's/^char \* *$$/&/' \ # -e '/^#include.*$$/D' -e '/^$$/D' >> $@ # we distribute these files because who uses gengetopt might need them # these are installed in $(prefix)/share/gengetopt pkgdata_DATA = gnugetopt.h getopt.c getopt1.c # yywrap.c is added only if it is not found on lex (flex) lib, and will be # added automatically by automake # automake (maybe due to a bug) doesn't added these files well, # so we explicitely declare them MAINTAINERCLEANFILES = scanner.cc parser.h parser.cc noinst_HEADERS = acceptedvalues.h errorcodes.h fileutils.h \ gm_utils.h yyerror.h gengetopt-2.22.6/src/getopt.c0000664000175000017500000007271312044745036012776 00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # ifndef _ # define _(msgid) gettext (msgid) # endif # else # define _(msgid) (msgid) # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (posixly_correct == NULL && argc == __libc_argc && argv == __libc_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (print_errors) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ gengetopt-2.22.6/src/gengetopt.cc0000664000175000017500000005764212045003074013625 00000000000000/** * Copyright (C) 1999-2011 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include void gengetopt_free (void); /* The following one is generated by gengetopt itself */ #include "cmdline.h" extern int yyparse () ; #include "gengetopt.h" #include "errorcodes.h" #include "argsdef.h" #include "global_opts.h" #include "gm.h" #include "groups.h" #include "gm_utils.h" #include "skels/copyright.h" #include "yyerror.h" #include "globals.h" char * gengetopt_package = NULL; char * gengetopt_version = NULL; char * gengetopt_purpose = NULL; char * gengetopt_versiontext = NULL; char * gengetopt_description = NULL; char * gengetopt_usage = NULL; modes_collection_t gengetopt_modes; int gengetopt_count_line = 1; char * gengetopt_input_filename = 0; char *current_section = 0; char *current_section_desc = 0; char *current_text = 0; char *current_args = 0; /// whether, if not specified, an option is considered optional bool default_to_optional = false; int canonize_vars (void); static void set_default_required_properties(void); static void print_copyright(); static void print_reportbugs(); static void output_formatted_string(const string &); static bool check_dependencies(); static int gengetopt_create_option (gengetopt_option *&opt, const char * long_opt, char short_opt, const char * desc, int type, int flagstat, int required, const char *default_value, const char * group_value, const char * mode_value, const char * type_str, const AcceptedValues *acceptedvalues, int multiple = 0, int argoptional = 0); #include #include using namespace std; /// the structure for command line arguments struct gengetopt_args_info args_info ; int main (int argc, char **argv) { char *cmdline_parser_name ; /* name of the generated function */ char *cmdline_filename ; /* name of generated file */ char *c_ext ; /* extenstion of c file */ char *header_ext ; /* extenstion of header file */ string output_dir, header_output_dir, src_output_dir; /* output directory (default empty -> current dir)*/ int i, has_help, has_version; FILE *input_file ; if (cmdline_parser (argc, argv, &args_info) != 0) { fprintf (stderr, "Run gengetopt --help to see the list of options.\n"); exit(1) ; } if (args_info.help_given) { cmdline_parser_print_help (); print_reportbugs (); exit (0); } if (args_info.detailed_help_given) { cmdline_parser_print_detailed_help (); print_reportbugs (); exit (0); } if (args_info.version_given) { cmdline_parser_print_version (); print_copyright (); exit (0); } if ( args_info.input_arg ) { gengetopt_input_filename = strdup (args_info.input_arg); input_file = freopen (args_info.input_arg, "r", stdin) ; if (!input_file) { fprintf (stderr, "Error opening input file: %s\n", args_info.input_arg); exit (1); } } /* else standard input is used */ if (yyparse () != 0) { gengetopt_free (); return 1; } // check whether some options were given in the input file bool no_options = (gengetopt_options.size() == 0); if (current_args) { // parse the arguments passed in the "args" part of the input file // by possibily overriding those given at command line if (cmdline_parser_string2 (current_args, &args_info, "gengetopt", 1, 0, 0) != 0) { fprintf (stderr, "Error in the args specification of the input_file.\n"); exit(1) ; } } cmdline_parser_name = args_info.func_name_arg ; cmdline_filename = args_info.file_name_arg ; c_ext = args_info.c_extension_arg; header_ext = args_info.header_extension_arg; default_to_optional = args_info.default_optional_given; // now set the default "required" property for options set_default_required_properties(); if (! check_dependencies()) { gengetopt_free(); return 1; } // insert options for help and version if not already present gengetopt_option *opt; if (current_section) free(current_section); current_section = 0; has_version = gengetopt_has_option (VERSION_LONG_OPT, VERSION_SHORT_OPT); if (has_version != REQ_LONG_OPTION && !args_info.no_version_given) { gengetopt_create_option (opt, VERSION_LONG_OPT, has_version ? '-' : VERSION_SHORT_OPT, VERSION_OPT_DESCR, ARG_NO, 0, 0, 0, 0, 0, 0, 0); gengetopt_options.push_front(opt); } if (!args_info.no_help_given && !args_info.strict_hidden_given && has_hidden_options() && gengetopt_has_option(FULL_HELP_LONG_OPT, 0) == 0) { gengetopt_create_option (opt, FULL_HELP_LONG_OPT, '-', FULL_HELP_OPT_DESCR, ARG_NO, 0, 0, 0, 0, 0, 0, 0); gengetopt_options.push_front(opt); } if (!args_info.no_help_given && has_options_with_details(args_info.strict_hidden_given) && gengetopt_has_option(DETAILED_HELP_LONG_OPT, 0) == 0) { gengetopt_create_option (opt, DETAILED_HELP_LONG_OPT, '-', DETAILED_HELP_OPT_DESCR, ARG_NO, 0, 0, 0, 0, 0, 0, 0); gengetopt_options.push_front(opt); } has_help = gengetopt_has_option(HELP_LONG_OPT, HELP_SHORT_OPT); if (has_help != REQ_LONG_OPTION && !args_info.no_help_given) { gengetopt_create_option (opt, HELP_LONG_OPT, has_help ? '-' : HELP_SHORT_OPT, HELP_OPT_DESCR, ARG_NO, 0, 0, 0, 0, 0, 0, 0); gengetopt_options.push_front(opt); } // check whether there's pending text after all options and // in case, set it to the last option if (current_text && gengetopt_options.size()) { gengetopt_options.back()->text_after = current_text; gengetopt_set_text(0); } if (canonize_vars ()) { gengetopt_free (); return 1; } if (args_info.set_package_given) { if (gengetopt_package) free (gengetopt_package); gengetopt_package = args_info.set_package_arg; } if (args_info.set_version_given) { if (gengetopt_version) free (gengetopt_version); gengetopt_version = args_info.set_version_arg; } ostringstream command_line; for ( i = 0; i < argc ; ++i ) command_line << argv[i] << " "; // add also possible args specification in the input file if (current_args) command_line << current_args; if (args_info.output_dir_given) output_dir = args_info.output_dir_arg; if (args_info.header_output_dir_given) header_output_dir = args_info.header_output_dir_arg; if (args_info.src_output_dir_given) src_output_dir = args_info.src_output_dir_arg; CmdlineParserCreator cmdline_parser_creator (cmdline_parser_name, args_info.arg_struct_name_arg, (args_info.unamed_opts_given ? args_info.unamed_opts_arg : 0), cmdline_filename, header_ext, c_ext, args_info.long_help_given, args_info.no_handle_help_given, args_info.no_help_given, args_info.no_handle_version_given, args_info.no_version_given, args_info.no_handle_error_given, args_info.strict_hidden_given, args_info.conf_parser_given, args_info.string_parser_given, args_info.gen_version_flag, args_info.include_getopt_given, no_options, command_line.str (), output_dir, header_output_dir, src_output_dir, (args_info.show_required_given ? args_info.show_required_arg : "")); if (! gengetopt_package && (args_info.show_version_given || args_info.show_help_given)) { cerr << "package not defined; please specify it with --set-package" << endl; return 1; } else if (! gengetopt_version && (args_info.show_version_given || args_info.show_help_given)) { cerr << "version not defined; please specify it with --set-version" << endl; return 1; } else if (args_info.show_version_given) { cout << gengetopt_package << " " << gengetopt_version << endl; } else if (args_info.show_help_given || args_info.show_full_help_given || args_info.show_detailed_help_given) { cout << gengetopt_package << " " << gengetopt_version << "\n" << endl; if (gengetopt_purpose) { output_formatted_string(cmdline_parser_creator.generate_purpose()); cout << endl; } output_formatted_string("Usage: " + cmdline_parser_creator.generate_usage_string(false) + "\n"); if (gengetopt_description) { output_formatted_string(cmdline_parser_creator.generate_description()); cout << endl; } // if --show-full-help is specified we have to generate also hidden options OptionHelpList *option_list = cmdline_parser_creator.generate_help_option_list(args_info.show_full_help_given, args_info.show_detailed_help_given); std::for_each(option_list->begin(), option_list->end(), output_formatted_string); delete option_list; } else if (cmdline_parser_creator.generate ()) { gengetopt_free (); return 1; } gengetopt_free (); return 0; } void output_formatted_string(const string &s) { for (string::const_iterator it = s.begin(); it != s.end(); ++it) { if (*it == '\\' && ((it+1) != s.end()) && *(it+1) == 'n') { cout << "\n"; ++it; } else if (*it == '\\' && ((it+1) != s.end()) && *(it+1) == '"') { cout << "\""; ++it; } else cout << *it; } cout << endl; } /* ************* */ int gengetopt_define_package (char * s) { gengetopt_package = strdup (s); if (gengetopt_package == NULL) return 1; return 0; } int gengetopt_define_version (char * s) { gengetopt_version = strdup (s); if (gengetopt_version == NULL) return 1; return 0; } int gengetopt_define_purpose (char * s) { gengetopt_purpose = strdup (s); if (gengetopt_purpose == NULL) return 1; return 0; } int gengetopt_define_versiontext (char * s) { gengetopt_versiontext = strdup (s); if (gengetopt_versiontext == NULL) return 1; return 0; } int gengetopt_define_description (char * s) { gengetopt_description = strdup (s); if (gengetopt_description == NULL) return 1; return 0; } int gengetopt_define_usage (char * s) { gengetopt_usage = strdup (s); if (gengetopt_usage == NULL) return 1; return 0; } int gengetopt_add_group (const char *s, const char *desc, int required) { string group_desc; if (desc) group_desc = desc; if ( !gengetopt_groups.insert (make_pair(string(s),Group (group_desc, required != 0))).second ) return 1; else return 0; } int gengetopt_add_mode (const char *s, const char *desc) { string mode_desc; if (desc) mode_desc = desc; if ( !gengetopt_modes.insert (make_pair(string(s),Mode (mode_desc))).second ) return 1; else return 0; } void gengetopt_set_section (const char * s, const char *desc) { if (current_section) free (current_section); if (current_section_desc) free (current_section_desc); current_section = strdup (s); if (desc) current_section_desc = strdup (desc); else current_section_desc = 0; } void gengetopt_set_text (const char * desc) { /* no need to free it, since it will be then owned by the option only if (current_text) free (current_text); */ // the current text is reset if (!desc) { current_text = 0; return; } if (current_text) { // a previous text was collected, so we append the new text // to the current one. string buffer = current_text; buffer += desc; current_text = strdup(buffer.c_str()); return; } // otherwise simply copy the passed text current_text = strdup (desc); } void gengetopt_set_args(const char *a) { if (current_args) free(current_args); if (a) current_args = strdup(a); else current_args = 0; } int gengetopt_has_option (const char * long_opt, char short_opt) { gengetopt_option * n; for (gengetopt_option_list::const_iterator it = gengetopt_options.begin(); it != gengetopt_options.end(); ++it) { n = *it; if (!strcmp (n->long_opt, long_opt)) return REQ_LONG_OPTION; if (short_opt && n->short_opt == short_opt) return REQ_SHORT_OPTION; } return 0; } bool check_numeric_validity(const char *val, int opt_type) { char *end_of_string, *expected_eos; expected_eos = (char *) (val + strlen(val)); switch ( opt_type ) { case ARG_INT : case ARG_SHORT : case ARG_LONG : case ARG_LONGLONG : (void) strtol(val, &end_of_string, 0); break; case ARG_FLOAT: case ARG_DOUBLE: case ARG_LONGDOUBLE: (void) strtod(val, &end_of_string); break; default : // This will allow us to factorise as a single line the // test for correctness of the default value end_of_string = expected_eos; break; } return ( end_of_string == expected_eos ); } bool check_values(const AcceptedValues *acceptedvalues, int opt_type) { for (AcceptedValues::const_iterator it = acceptedvalues->begin(); it != acceptedvalues->end(); ++it) { if (!check_numeric_validity((*it).c_str(), opt_type)) return false; } return true; } int gengetopt_create_option (gengetopt_option *&n, const char * long_opt, char short_opt, const char * desc, int type, int flagstat, int required, const char * default_value, const char * group_value, const char * mode_value, const char * type_str, const AcceptedValues *acceptedvalues, int multiple, int argoptional) { if ((long_opt == NULL) || (long_opt[0] == 0) || (desc == NULL)) return FOUND_BUG; n = new gengetopt_option; if (n == NULL) return NOT_ENOUGH_MEMORY; // here we will set required anyway n->required_set = true; n->long_opt = strdup (long_opt); if (n->long_opt == NULL) { free (n); return NOT_ENOUGH_MEMORY; } n->desc = strdup (desc); if (n->desc == NULL) { free (n->long_opt); free (n); return NOT_ENOUGH_MEMORY; } n->short_opt = ((short_opt == '-') ? 0 : short_opt); n->type = type; n->flagstat = flagstat; n->required = required; n->multiple = (multiple != 0); n->arg_is_optional = (argoptional != 0); if (type_str != 0) n->type_str = strdup(type_str); else n->type_str = NULL; n->section = 0; n->section_desc = 0; if (current_section) n->section = strdup (current_section); if (current_section_desc) n->section_desc = strdup (current_section_desc); if (group_value != 0) { n->group_value = strdup(group_value); n->required = 0; groups_collection_t::const_iterator it = gengetopt_groups.find(string(n->group_value)); if (it == gengetopt_groups.end()) return GROUP_UNDEFINED; n->group_desc = strdup (it->second.desc.c_str ()); } else { n->group_value = 0; } if (mode_value != 0) { n->mode_value = strdup(mode_value); modes_collection_t::const_iterator it = gengetopt_modes.find(string(n->mode_value)); if (it == gengetopt_modes.end()) return MODE_UNDEFINED; n->mode_desc = strdup (it->second.desc.c_str ()); } else { n->mode_value = 0; } if (n->group_value && n->mode_value) return FOUND_BUG; n->acceptedvalues = acceptedvalues; // if (acceptedvalues && type != ARG_NO) // return NOT_REQUESTED_TYPE; if (acceptedvalues && ! (n->type)) n->type = ARG_STRING; n->default_string = 0; n->default_given = (default_value != 0); if (n->default_given) { n->default_string = strdup (default_value); if ( ! check_numeric_validity(default_value, n->type) ) { free (n); return INVALID_DEFAULT_VALUE; } if (acceptedvalues) { if (! acceptedvalues->contains(n->default_string)) return INVALID_DEFAULT_VALUE; } } if (acceptedvalues) { if (!check_values(acceptedvalues, n->type)) return INVALID_NUMERIC_VALUE; } n->var_arg = NULL; return 0; } int gengetopt_check_option (gengetopt_option *n, bool groupoption, bool modeoption) { if ((n->long_opt == NULL) || (n->long_opt[0] == 0) || (n->desc == NULL)) return FOUND_BUG; bool no_help = (args_info.no_help_given || string_contains(current_args, "--no-help")); bool no_version = (args_info.no_version_given || string_contains(current_args, "--no-version")); if (strcmp(n->long_opt, HELP_LONG_OPT) == 0 && !no_help) return HELP_REDEFINED; if (strcmp(n->long_opt, VERSION_LONG_OPT) == 0 && !no_version) return VERSION_REDEFINED; n->section = 0; n->section_desc = 0; if (current_section) n->section = strdup (current_section); if (current_section_desc) n->section_desc = strdup (current_section_desc); n->text_before = current_text; // reset the description gengetopt_set_text(0); if (n->group_value != 0) { if (! groupoption) return NOT_GROUP_OPTION; n->required = 0; n->required_set = true; groups_collection_t::const_iterator it = gengetopt_groups.find(string(n->group_value)); if (it == gengetopt_groups.end()) return GROUP_UNDEFINED; n->group_desc = strdup (it->second.desc.c_str ()); } else { if (groupoption) return SPECIFY_GROUP; } if (n->mode_value != 0) { if (! modeoption) return NOT_MODE_OPTION; modes_collection_t::const_iterator it = gengetopt_modes.find(string(n->mode_value)); if (it == gengetopt_modes.end()) return MODE_UNDEFINED; n->mode_desc = strdup (it->second.desc.c_str ()); } else { if (modeoption) return SPECIFY_MODE; } if (n->group_value && n->mode_value) return FOUND_BUG; // now we have to check for flag options if (n->type == ARG_FLAG) { if (n->flagstat < 0) return SPECIFY_FLAG_STAT; if (n->default_string || n->multiple || n->arg_is_optional || n->type_str || n->acceptedvalues || n->required_set) return NOT_VALID_SPECIFICATION; n->required = 0; n->required_set = true; } else { if (n->flagstat >= 0) return NOT_VALID_SPECIFICATION; } // enum type can only be specified with options with values if (n->type == ARG_ENUM && !(n->acceptedvalues)) { return INVALID_ENUM_TYPE_USE; } // if (acceptedvalues && type != ARG_NO) // return NOT_REQUESTED_TYPE; if (n->acceptedvalues && ! (n->type)) n->type = ARG_STRING; n->default_given = (n->default_string != 0); if (n->default_given) { if ( !check_numeric_validity(n->default_string, n->type) ) { return INVALID_DEFAULT_VALUE; } if (n->acceptedvalues) { if (! n->acceptedvalues->contains(n->default_string)) return INVALID_DEFAULT_VALUE; } } if (n->acceptedvalues) { if (!check_values(n->acceptedvalues, n->type)) return INVALID_NUMERIC_VALUE; } n->var_arg = NULL; return 0; } int gengetopt_add_option (const char * long_opt, char short_opt, const char * desc, int type, int flagstat, int required, const char * default_value, const char * group_value, const char * mode_value, const char * type_str, const AcceptedValues *acceptedvalues, int multiple, int argoptional) { gengetopt_option * n; /* search for collisions */ int res = gengetopt_has_option(long_opt, short_opt); if (res != 0) return res; res = gengetopt_create_option(n, long_opt, short_opt, desc, type, flagstat, required, default_value, group_value, mode_value, type_str, acceptedvalues, multiple, argoptional); if (res != 0) return res; gengetopt_options.push_back(n); return 0; } int gengetopt_add_option (gengetopt_option * n) { /* search for collisions */ int res = gengetopt_has_option(n); if (res != 0) return res; gengetopt_options.push_back(n); return 0; } int gengetopt_has_option (gengetopt_option * opt) { gengetopt_option * n; for (gengetopt_option_list::const_iterator it = gengetopt_options.begin(); it != gengetopt_options.end(); ++it) { n = *it; if (!strcmp (n->long_opt, opt->long_opt)) return REQ_LONG_OPTION; if (opt->short_opt && n->short_opt == opt->short_opt) return REQ_SHORT_OPTION; } return 0; } bool check_dependencies() { gengetopt_option * n; bool result = true; for (gengetopt_option_list::const_iterator it = gengetopt_options.begin(); it != gengetopt_options.end(); ++it) { n = *it; if (n->dependon) { if (strcmp(n->dependon, n->long_opt) == 0) { yyerror(n, "option depends on itself"); result = false; continue; } bool found = false; for (gengetopt_option_list::const_iterator it2 = gengetopt_options.begin(); it2 != gengetopt_options.end(); ++it2) { if (strcmp(n->dependon, (*it2)->long_opt) == 0) { found = true; break; } } if (! found) { yyerror (n, "option depends on undefined option"); result = false; } } } return result; } void gengetopt_free (void) { gengetopt_option *p; if (gengetopt_package != NULL) free (gengetopt_package); for (gengetopt_option_list::iterator it = gengetopt_options.begin(); it != gengetopt_options.end(); ++it) { p = *it; if (p->long_opt != NULL) free (p->long_opt); if (p->desc != NULL) free (p->desc); if (p->var_arg != NULL) free (p->var_arg); if (p->acceptedvalues) delete p->acceptedvalues; delete p; } } static void canonize_var (gengetopt_option *p) { char *pvar; p->var_arg = strdup (p->long_opt); if (p->var_arg == NULL) { printf ("gengetopt: not enough memory to canonize vars\n"); abort(); } for (pvar = p->var_arg; *pvar; pvar++) if (*pvar == '.' || *pvar == '-') *pvar = '_'; } int canonize_vars (void) { for_each(gengetopt_options.begin(), gengetopt_options.end(), canonize_var); return 0; } static void set_default_required_prop (gengetopt_option *p) { if (!p->required_set) p->required = (default_to_optional ? 0 : 1); } static void set_default_required_properties(void) { for_each(gengetopt_options.begin(), gengetopt_options.end(), set_default_required_prop); } void print_copyright() { copyright_gen_class copyright_g; copyright_g.set_year ("1999-2011"); copyright_g.generate_copyright (cout); } void print_reportbugs() { cout << endl; cout << "Maintained by Lorenzo Bettini " << endl; //cout << "Report bugs to " << endl; } gengetopt-2.22.6/src/ggos.cpp0000664000175000017500000000207412045003074012752 00000000000000// // C++ Implementation: ggos // // Description: // // // Author: Lorenzo Bettini , (C) 2005-2007 // // Copyright: See COPYING file that comes with this distribution // // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ggos.h" using namespace std; gengetopt_option::gengetopt_option() : short_opt(0), long_opt(0), desc(0), type(ARG_NO), flagstat(-1), required(1), required_set(false), var_arg(0), default_given(0), default_string(0), group_value(0), group_desc(0), mode_value(0), mode_desc(0), multiple(false), multiple_min(0), multiple_max(0), arg_is_optional(false), hidden(false), type_str(0), acceptedvalues(0), section(0), section_desc(0), dependon(0), text_before(0), text_after(0), details(0), filename(0), linenum(0) { } ostream & operator <<(std::ostream &s, gengetopt_option &opt) { s << "long: " << opt.long_opt << ", short: " << opt.short_opt << "\n" << "desc: " << opt.desc; s << endl; return s; } gengetopt-2.22.6/src/scanner.cc0000664000175000017500000017504212045003074013255 00000000000000#line 2 "./scanner.cc" #line 4 "./scanner.cc" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 63 #define YY_END_OF_BUFFER 64 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[250] = { 0, 0, 0, 0, 0, 0, 0, 64, 62, 58, 60, 61, 57, 49, 59, 44, 43, 48, 42, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 63, 47, 45, 46, 56, 52, 56, 55, 56, 58, 60, 57, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 52, 53, 0, 54, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 50, 0, 41, 0, 0, 0, 0, 0, 0, 0, 9, 17, 0, 0, 0, 4, 28, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 36, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 1, 0, 35, 0, 0, 23, 0, 30, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 10, 20, 0, 34, 24, 11, 0, 27, 37, 0, 0, 0, 0, 8, 29, 0, 31, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 7, 13, 0, 0, 32, 21, 12, 33, 40, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 6, 7, 1, 1, 1, 1, 8, 9, 1, 1, 10, 11, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 13, 1, 14, 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 16, 1, 1, 1, 1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 15, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 15, 38, 39, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[40] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int16_t yy_base[254] = { 0, 0, 0, 37, 47, 39, 57, 275, 276, 272, 0, 276, 268, 276, 0, 276, 276, 276, 276, 239, 32, 242, 243, 236, 243, 238, 236, 34, 235, 43, 30, 243, 47, 36, 229, 59, 241, 276, 276, 276, 249, 276, 257, 276, 276, 78, 257, 0, 253, 0, 234, 55, 220, 219, 61, 224, 233, 217, 222, 230, 222, 276, 226, 276, 212, 227, 212, 212, 224, 212, 208, 202, 208, 221, 210, 203, 201, 222, 230, 276, 64, 276, 203, 276, 58, 70, 210, 211, 212, 210, 199, 203, 208, 188, 203, 276, 199, 200, 185, 276, 194, 192, 186, 180, 180, 181, 188, 177, 190, 187, 173, 174, 276, 276, 176, 276, 170, 172, 174, 174, 169, 176, 173, 276, 276, 164, 167, 176, 75, 76, 171, 165, 177, 163, 167, 166, 155, 160, 276, 154, 166, 165, 160, 149, 156, 152, 161, 160, 154, 151, 156, 276, 79, 147, 145, 144, 152, 141, 140, 141, 146, 134, 134, 136, 276, 142, 129, 276, 129, 132, 136, 125, 123, 137, 127, 125, 121, 276, 133, 122, 276, 116, 122, 116, 114, 121, 130, 125, 124, 123, 114, 276, 109, 276, 112, 110, 276, 108, 276, 109, 102, 276, 102, 100, 116, 110, 113, 106, 109, 102, 276, 276, 108, 107, 276, 91, 96, 276, 276, 99, 104, 97, 94, 276, 276, 90, 276, 98, 97, 100, 86, 276, 85, 93, 79, 71, 66, 76, 72, 71, 276, 276, 78, 50, 276, 276, 276, 276, 276, 276, 109, 111, 78, 51 } ; static yyconst flex_int16_t yy_def[254] = { 0, 249, 1, 250, 250, 251, 251, 249, 249, 249, 252, 249, 249, 249, 253, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 252, 249, 253, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 0, 249, 249, 249, 249 } ; static yyconst flex_int16_t yy_nxt[316] = { 0, 8, 9, 10, 11, 12, 13, 14, 15, 8, 16, 17, 17, 18, 17, 17, 8, 19, 17, 17, 20, 21, 22, 23, 24, 25, 17, 26, 27, 28, 29, 30, 17, 31, 32, 33, 34, 35, 17, 36, 37, 11, 42, 43, 14, 44, 38, 65, 39, 40, 37, 11, 49, 51, 14, 45, 38, 71, 39, 40, 42, 43, 52, 44, 59, 62, 66, 79, 68, 80, 60, 69, 63, 45, 64, 72, 74, 85, 91, 47, 75, 79, 70, 80, 81, 248, 86, 116, 114, 87, 88, 92, 115, 117, 82, 154, 156, 247, 118, 178, 246, 245, 155, 244, 243, 242, 157, 83, 241, 179, 8, 8, 41, 41, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 112, 61, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 113, 78, 77, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 90, 89, 84, 48, 46, 78, 77, 76, 73, 67, 61, 58, 57, 56, 55, 54, 53, 50, 48, 46, 249, 7, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249 } ; static yyconst flex_int16_t yy_chk[316] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 5, 3, 5, 3, 30, 3, 3, 4, 4, 253, 20, 4, 5, 4, 33, 4, 4, 6, 6, 20, 6, 27, 29, 30, 80, 32, 80, 27, 32, 29, 6, 29, 33, 35, 51, 54, 252, 35, 45, 32, 45, 45, 243, 51, 85, 84, 51, 51, 54, 84, 85, 45, 128, 129, 242, 85, 152, 239, 238, 128, 237, 236, 235, 129, 45, 234, 152, 250, 250, 251, 251, 233, 232, 230, 229, 228, 227, 225, 222, 221, 220, 219, 216, 215, 213, 212, 209, 208, 207, 206, 205, 204, 203, 202, 200, 199, 197, 195, 194, 192, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 179, 178, 176, 175, 174, 173, 172, 171, 170, 169, 168, 166, 165, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 137, 136, 135, 134, 133, 132, 131, 130, 127, 126, 125, 122, 121, 120, 119, 118, 117, 116, 114, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 98, 97, 96, 94, 93, 92, 91, 90, 89, 88, 87, 86, 82, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 62, 60, 59, 58, 57, 56, 55, 53, 52, 50, 48, 46, 42, 40, 36, 34, 31, 28, 26, 25, 24, 23, 22, 21, 19, 12, 9, 7, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249 } ; /* Table of booleans, true if rule could match eol. */ static yyconst flex_int32_t yy_rule_can_match_eol[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "./scanner.ll" /** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #line 23 "./scanner.ll" #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "argsdef.h" #include "parser.h" extern int gengetopt_count_line; static void update_count_line (char *str); static void updateTokenInfo (int pos); // the buffer for strings (possibly spanning more lines) static std::ostringstream buff; static void buffer(const char *s); static char *flush_buffer(); #define LINEBUF_LEN 1024 #define PUSH(s) yy_push_state(s); #define POP() yy_pop_state(); int tokenpos = 0; char linebuf[LINEBUF_LEN] ; /* current line */ //#define DEBUG_SCANNER #ifdef DEBUG_SCANNER #include // for debug #define DEB(s) std::cerr << s << std::endl; #define DEB2(s,s2) std::cerr << s << ": " << s2 << std::endl; #else #define DEB(s) #define DEB2(s,s2) #endif #line 693 "./scanner.cc" #define INITIAL 0 #define SIZE_STATE 1 #define STRING_STATE 2 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * in_str ); FILE *yyget_out (void ); void yyset_out (FILE * out_str ); int yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = NULL; static void yy_push_state (int new_state ); static void yy_pop_state (void ); static int yy_top_state (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 70 "./scanner.ll" #line 894 "./scanner.cc" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 250 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 276 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) yylineno++; ; } do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 73 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_STRING; return TOK_ARGTYPE; YY_BREAK case 2: YY_RULE_SETUP #line 74 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_INT; return TOK_ARGTYPE; YY_BREAK case 3: YY_RULE_SETUP #line 75 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_SHORT; return TOK_ARGTYPE; YY_BREAK case 4: YY_RULE_SETUP #line 76 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_LONG; return TOK_ARGTYPE; YY_BREAK case 5: YY_RULE_SETUP #line 77 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_FLOAT; return TOK_ARGTYPE; YY_BREAK case 6: YY_RULE_SETUP #line 78 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_DOUBLE; return TOK_ARGTYPE; YY_BREAK case 7: YY_RULE_SETUP #line 79 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_LONGDOUBLE; return TOK_ARGTYPE; YY_BREAK case 8: YY_RULE_SETUP #line 80 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_LONGLONG; return TOK_ARGTYPE; YY_BREAK case 9: YY_RULE_SETUP #line 81 "./scanner.ll" updateTokenInfo (-1); yylval.argtype = ARG_ENUM; return TOK_ARGTYPE; YY_BREAK case 10: YY_RULE_SETUP #line 83 "./scanner.ll" updateTokenInfo (-1); return TOK_PACKAGE; YY_BREAK case 11: YY_RULE_SETUP #line 84 "./scanner.ll" updateTokenInfo (-1); return TOK_VERSION; YY_BREAK case 12: YY_RULE_SETUP #line 85 "./scanner.ll" updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_GROUPOPTION; YY_BREAK case 13: YY_RULE_SETUP #line 86 "./scanner.ll" updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_MODEOPTION; YY_BREAK case 14: YY_RULE_SETUP #line 87 "./scanner.ll" updateTokenInfo (-1); return TOK_YES; YY_BREAK case 15: YY_RULE_SETUP #line 88 "./scanner.ll" updateTokenInfo (-1); return TOK_NO; YY_BREAK case 16: YY_RULE_SETUP #line 89 "./scanner.ll" updateTokenInfo (-1); yylloc.first_line = gengetopt_count_line; return TOK_OPTION; YY_BREAK case 17: YY_RULE_SETUP #line 90 "./scanner.ll" updateTokenInfo (-1); return TOK_FLAG; YY_BREAK case 18: YY_RULE_SETUP #line 91 "./scanner.ll" updateTokenInfo (-1); return TOK_ON; YY_BREAK case 19: YY_RULE_SETUP #line 92 "./scanner.ll" updateTokenInfo (-1); return TOK_OFF; YY_BREAK case 20: YY_RULE_SETUP #line 93 "./scanner.ll" updateTokenInfo (-1); return TOK_PURPOSE; YY_BREAK case 21: YY_RULE_SETUP #line 94 "./scanner.ll" updateTokenInfo (-1); return TOK_DESCRIPTION; YY_BREAK case 22: YY_RULE_SETUP #line 95 "./scanner.ll" updateTokenInfo (-1); return TOK_USAGE; YY_BREAK case 23: YY_RULE_SETUP #line 96 "./scanner.ll" updateTokenInfo (-1); return TOK_DEFAULT; YY_BREAK case 24: YY_RULE_SETUP #line 97 "./scanner.ll" updateTokenInfo (-1); return TOK_TYPESTR; YY_BREAK case 25: YY_RULE_SETUP #line 98 "./scanner.ll" updateTokenInfo (-1); return TOK_GROUP; YY_BREAK case 26: YY_RULE_SETUP #line 99 "./scanner.ll" updateTokenInfo (-1); return TOK_GROUPDESC; YY_BREAK case 27: YY_RULE_SETUP #line 100 "./scanner.ll" updateTokenInfo (-1); return TOK_DEFGROUP; YY_BREAK case 28: YY_RULE_SETUP #line 101 "./scanner.ll" updateTokenInfo (-1); return TOK_MODE; YY_BREAK case 29: YY_RULE_SETUP #line 102 "./scanner.ll" updateTokenInfo (-1); return TOK_MODEDESC; YY_BREAK case 30: YY_RULE_SETUP #line 103 "./scanner.ll" updateTokenInfo (-1); return TOK_DEFMODE; YY_BREAK case 31: YY_RULE_SETUP #line 104 "./scanner.ll" updateTokenInfo (-1); return TOK_MULTIPLE; YY_BREAK case 32: YY_RULE_SETUP #line 105 "./scanner.ll" updateTokenInfo (-1); return TOK_ARGOPTIONAL; YY_BREAK case 33: YY_RULE_SETUP #line 106 "./scanner.ll" updateTokenInfo (-1); return TOK_SECTIONDESC; YY_BREAK case 34: YY_RULE_SETUP #line 107 "./scanner.ll" updateTokenInfo (-1); return TOK_SECTION; YY_BREAK case 35: YY_RULE_SETUP #line 108 "./scanner.ll" updateTokenInfo (-1); return TOK_VALUES; YY_BREAK case 36: YY_RULE_SETUP #line 109 "./scanner.ll" updateTokenInfo (-1); return TOK_HIDDEN; YY_BREAK case 37: YY_RULE_SETUP #line 110 "./scanner.ll" updateTokenInfo (-1); return TOK_DEPENDON; YY_BREAK case 38: YY_RULE_SETUP #line 111 "./scanner.ll" updateTokenInfo (-1); return TOK_DETAILS; YY_BREAK case 39: YY_RULE_SETUP #line 112 "./scanner.ll" updateTokenInfo (-1); return TOK_TEXT; YY_BREAK case 40: YY_RULE_SETUP #line 113 "./scanner.ll" updateTokenInfo (-1); return TOK_VERSIONTEXT; YY_BREAK case 41: YY_RULE_SETUP #line 114 "./scanner.ll" updateTokenInfo (-1); return TOK_ARGS; YY_BREAK case 42: YY_RULE_SETUP #line 116 "./scanner.ll" { updateTokenInfo (-1); return '='; } YY_BREAK case 43: YY_RULE_SETUP #line 117 "./scanner.ll" { updateTokenInfo (-1); return ','; } YY_BREAK case 44: YY_RULE_SETUP #line 119 "./scanner.ll" { PUSH(SIZE_STATE); updateTokenInfo (-1); return '('; } YY_BREAK case 45: YY_RULE_SETUP #line 120 "./scanner.ll" { updateTokenInfo (-1); return '-'; } YY_BREAK case 46: YY_RULE_SETUP #line 121 "./scanner.ll" { updateTokenInfo (-1); yylval.str = strdup(yytext); return TOK_SIZE; } YY_BREAK case 47: YY_RULE_SETUP #line 122 "./scanner.ll" { POP(); updateTokenInfo (-1); return ')'; } YY_BREAK case 48: YY_RULE_SETUP #line 124 "./scanner.ll" updateTokenInfo (-1); yylval.chr = yytext[0]; return TOK_CHAR; YY_BREAK case 49: YY_RULE_SETUP #line 126 "./scanner.ll" { updateTokenInfo (-1); DEB("start string"); PUSH(STRING_STATE) ; } YY_BREAK case 50: YY_RULE_SETUP #line 127 "./scanner.ll" { updateTokenInfo (2); buffer("\\\\n"); } YY_BREAK case 51: YY_RULE_SETUP #line 128 "./scanner.ll" { updateTokenInfo (1); buffer("\n"); } YY_BREAK case 52: /* rule 52 can match eol */ YY_RULE_SETUP #line 129 "./scanner.ll" { update_count_line (yytext); buffer( yytext ) ; } YY_BREAK case 53: /* rule 53 can match eol */ YY_RULE_SETUP #line 130 "./scanner.ll" { update_count_line (yytext); /* a line break */ } YY_BREAK case 54: YY_RULE_SETUP #line 131 "./scanner.ll" { updateTokenInfo (-1); buffer(yytext); } YY_BREAK case 55: YY_RULE_SETUP #line 132 "./scanner.ll" { updateTokenInfo (-1); DEB("end string"); POP() ; yylval.str = flush_buffer(); return TOK_STRING; } YY_BREAK case 56: YY_RULE_SETUP #line 133 "./scanner.ll" { updateTokenInfo (-1); buffer( yytext ) ; } YY_BREAK case 57: YY_RULE_SETUP #line 135 "./scanner.ll" updateTokenInfo (-1); YY_BREAK case 58: YY_RULE_SETUP #line 136 "./scanner.ll" updateTokenInfo (8*yyleng); YY_BREAK case 59: YY_RULE_SETUP #line 138 "./scanner.ll" /* comments begin with # in any place (but strings) */ YY_BREAK case 60: /* rule 60 can match eol */ YY_RULE_SETUP #line 139 "./scanner.ll" update_count_line (0); yyless(1) ; /* give back all but the \n to rescan */ YY_BREAK case 61: YY_RULE_SETUP #line 141 "./scanner.ll" {} YY_BREAK case 62: YY_RULE_SETUP #line 143 "./scanner.ll" { return 1000; /* little hack to produce a parse error too. */ } YY_BREAK case 63: YY_RULE_SETUP #line 147 "./scanner.ll" ECHO; YY_BREAK #line 1307 "./scanner.cc" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SIZE_STATE): case YY_STATE_EOF(STRING_STATE): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 250 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 250 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 249); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) yylineno++; ; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } static void yy_push_state (int new_state ) { if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) { yy_size_t new_size; (yy_start_stack_depth) += YY_START_STACK_INCR; new_size = (yy_start_stack_depth) * sizeof( int ); if ( ! (yy_start_stack) ) (yy_start_stack) = (int *) yyalloc(new_size ); else (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size ); if ( ! (yy_start_stack) ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; BEGIN(new_state); } static void yy_pop_state (void) { if ( --(yy_start_stack_ptr) < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); } static int yy_top_state (void) { return (yy_start_stack)[(yy_start_stack_ptr) - 1]; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ /* We do not touch yylineno unless the option is enabled. */ yylineno = 1; (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; (yy_start_stack_ptr) = 0; (yy_start_stack_depth) = 0; (yy_start_stack) = NULL; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Destroy the start condition stack. */ yyfree((yy_start_stack) ); (yy_start_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 147 "./scanner.ll" /* Otherwise '\n' within a TOK_MLSTRING would not be counted */ void update_count_line (char *str) { if (str) { char *p; for (p = str; *p; ++p) if (*p == '\n') { ++gengetopt_count_line; tokenpos = 0 ; /* reset token position */ strncpy (linebuf, ( (p+1) ? p+1 : ""), LINEBUF_LEN - 1); } } else { ++gengetopt_count_line; tokenpos = 0 ; /* reset token position */ strncpy (linebuf, yytext+1, LINEBUF_LEN - 1); /* save the next line */ } } void updateTokenInfo( int pos ) { if ( pos >= 0 ) tokenpos += pos ; else tokenpos += yyleng ; } void buffer(const char *s) { buff << s; } char *flush_buffer() { char *ret = strdup(buff.str().c_str()); buff.str(""); return ret; } gengetopt-2.22.6/src/fileutils.cpp0000664000175000017500000000171512044755512014026 00000000000000// // C++ Implementation: fileutils // // Description: // // // Author: Lorenzo Bettini , (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "fileutils.h" using namespace std; char * create_filename (char *name, char *ext) { char *filename ; filename = (char *) malloc (strlen (name) + strlen (ext) + 2); /* 2 = 1 for the . and one for the '\0' */ if (! filename) { fprintf (stderr, "Error in memory allocation! %s %d\n", __FILE__, __LINE__); abort (); } sprintf (filename, "%s.%s", name, ext); return filename ; } ofstream * open_fstream (const char *filename) { ofstream *fstream = new ofstream (filename); if ( ! (*fstream) ) { fprintf( stderr, "Error creating %s\n", filename ) ; abort() ; } return fstream; } gengetopt-2.22.6/src/gengetopt.h0000664000175000017500000000527212045003074013457 00000000000000/** * Copyright (C) 1999-2007 Free Software Foundation, Inc. * * This file is part of GNU gengetopt * * GNU gengetopt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU gengetopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with gengetopt; see the file COPYING. If not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GENGETOPT_H #define _GENGETOPT_H #include "acceptedvalues.h" #include "ggos.h" int gengetopt_define_package (char * s) ; int gengetopt_define_version (char * s) ; int gengetopt_define_purpose (char * s) ; int gengetopt_define_versiontext (char * s) ; int gengetopt_define_description (char * s) ; int gengetopt_define_usage (char * s) ; /** * Sets the "global" section specification that will be then set * in the following options * @param s The section * @param sd The section description */ void gengetopt_set_section (const char * s, const char *sd) ; /** * Sets the "global" text string that will be inserted in * a specific field of the next option * @param desc The text string */ void gengetopt_set_text (const char * desc) ; /** * Sets the "global" text string containing the arguments * that complement the command line arguments of gengetopt. * @param args */ void gengetopt_set_args (const char *args); int gengetopt_add_group (const char * s, const char *desc, int required) ; int gengetopt_add_mode (const char * s, const char *desc) ; int gengetopt_has_option (const char * long_opt, char short_opt); int gengetopt_add_option (const char * long_opt, char short_opt, const char * desc, int type, int flagstat, int required, const char *default_value, const char * group_value, const char * mode_value, const char * type_str, const AcceptedValues *acceptedvalues, int multiple = 0, int argoptional = 0); int gengetopt_has_option (gengetopt_option *opt); int gengetopt_check_option (gengetopt_option *opt, bool groupoption = false, bool modeoption = false); int gengetopt_add_option (gengetopt_option *opt); #endif /* _GENGETOPT_H */ gengetopt-2.22.6/build-aux/0000775000175000017500000000000012046541043012473 500000000000000gengetopt-2.22.6/build-aux/mdate-sh0000755000175000017500000001371712044745227014062 00000000000000#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2010-08-21.06; # UTC # Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009, 2010 # Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST fi case $1 in '') echo "$0: No file. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification day of FILE, in the format: 1 January 1970 Report bugs to . EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac error () { echo "$0: $1" >&2 exit 1 } # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume `unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # Avoid user/group names that might have spaces, when possible. if ls -n /dev/null 1>/dev/null 2>&1; then ls_command="$ls_command -n" fi # A `ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named `Jan', or `Feb', etc. However, it's unlikely that `/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`$ls_command /` # Find which argument is the month. month= command= until test $month do test $# -gt 0 || error "failed parsing \`$ls_command /' output" shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done test -n "$month" || error "failed parsing \`$ls_command /' output" # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\\\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: gengetopt-2.22.6/build-aux/config.sub0000755000175000017500000010532712044745223014410 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gengetopt-2.22.6/build-aux/ltmain.sh0000644000175000017500000105204012044745223014237 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1ubuntu2" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 gengetopt-2.22.6/build-aux/warn-on-use.h0000664000175000017500000001202012044745036014740 00000000000000/* A C macro for emitting warnings if a function is used. Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* _GL_WARN_ON_USE (function, "literal string") issues a declaration for FUNCTION which will then trigger a compiler warning containing the text of "literal string" anywhere that function is called, if supported by the compiler. If the compiler does not support this feature, the macro expands to an unused extern declaration. This macro is useful for marking a function as a potential portability trap, with the intent that "literal string" include instructions on the replacement function that should be used instead. However, one of the reasons that a function is a portability trap is if it has the wrong signature. Declaring FUNCTION with a different signature in C is a compilation error, so this macro must use the same type as any existing declaration so that programs that avoid the problematic FUNCTION do not fail to compile merely because they included a header that poisoned the function. But this implies that _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already have a declaration. Use of this macro implies that there must not be any other macro hiding the declaration of FUNCTION; but undefining FUNCTION first is part of the poisoning process anyway (although for symbols that are provided only via a macro, the result is a compilation error rather than a warning containing "literal string"). Also note that in C++, it is only safe to use if FUNCTION has no overloads. For an example, it is possible to poison 'getline' by: - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], [getline]) in configure.ac, which potentially defines HAVE_RAW_DECL_GETLINE - adding this code to a header that wraps the system : #undef getline #if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" "not universally present; use the gnulib module getline"); #endif It is not possible to directly poison global variables. But it is possible to write a wrapper accessor function, and poison that (less common usage, like &environ, will cause a compilation error rather than issue the nice warning, but the end result of informing the developer about their portability problem is still achieved): #if HAVE_RAW_DECL_ENVIRON static inline char ***rpl_environ (void) { return &environ; } _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); # undef environ # define environ (*rpl_environ ()) #endif */ #ifndef _GL_WARN_ON_USE # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") is like _GL_WARN_ON_USE (function, "string"), except that the function is declared with the given prototype, consisting of return type, parameters, and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ extern rettype function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ extern rettype function parameters_and_attributes # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use # endif #endif /* _GL_WARN_EXTERN_C declaration; performs the declaration with C linkage. */ #ifndef _GL_WARN_EXTERN_C # if defined __cplusplus # define _GL_WARN_EXTERN_C extern "C" # else # define _GL_WARN_EXTERN_C extern # endif #endif gengetopt-2.22.6/build-aux/c++defs.h0000664000175000017500000002675512044745036014023 00000000000000/* C++ compatible function declaration macros. Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some platforms, but is declared and works fine on the platforms on which it exists: #if @GNULIB_FOO@ # if !@HAVE_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on all platforms, but is broken/insufficient and needs to be replaced on some platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif * For providing a replacement for a function that exists on some platforms but is broken/insufficient and needs to be replaced on some of them and is additionally either missing or undeclared on some other platforms: #if @GNULIB_FOO@ # if @REPLACE_FOO@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef foo # define foo rpl_foo # endif _GL_FUNCDECL_RPL (foo, ...); _GL_CXXALIAS_RPL (foo, ...); # else # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ _GL_FUNCDECL_SYS (foo, ...); # endif _GL_CXXALIAS_SYS (foo, ...); # endif _GL_CXXALIASWARN (foo); #elif defined GNULIB_POSIXCHECK ... #endif */ /* _GL_EXTERN_C declaration; performs the declaration with C linkage. */ #if defined __cplusplus # define _GL_EXTERN_C extern "C" #else # define _GL_EXTERN_C extern #endif /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); declares a replacement function, named rpl_func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype rpl_func parameters_and_attributes /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. Example: _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C rettype func parameters_and_attributes /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ rettype (*const func) parameters = ::rpl_func; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); except that the C function rpl_func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ rettype (*const func) parameters = \ reinterpret_cast(::rpl_func); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* If we were to write rettype (*const func) parameters = ::func; like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls better (remove an indirection through a 'static' pointer variable), but then the _GL_CXXALIASWARN macro below would cause a warning not only for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = ::func; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function func may have a slightly different declaration. A cast is used to silence the "invalid conversion" error that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = \ reinterpret_cast(::func); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); is like _GL_CXXALIAS_SYS (func, rettype, parameters); except that the C function is picked among a set of overloaded functions, namely the one with rettype2 and parameters2. Two consecutive casts are used to silence the "cannot find a match" and "invalid conversion" errors that would otherwise occur. */ #if defined __cplusplus && defined GNULIB_NAMESPACE /* The outer cast must be a reinterpret_cast. The inner cast: When the function is defined as a set of overloaded functions, it works as a static_cast<>, choosing the designated variant. When the function is defined as a single variant, it works as a reinterpret_cast<>. The parenthesized cast syntax works both ways. */ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ static rettype (*func) parameters = \ reinterpret_cast( \ (rettype2(*)parameters2)(::func)); \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN (func); causes a warning to be emitted when ::func is used but not when GNULIB_NAMESPACE::func is used. func must be defined without overloaded variants. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN(func) \ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) /* To work around GCC bug , we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN_2(func,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN(func) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); causes a warning to be emitted when the given overloaded variant of ::func is used but not when GNULIB_NAMESPACE::func is used. */ #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) /* To work around GCC bug , we enable the warning only when not optimizing. */ # if !__OPTIMIZE__ # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ extern __typeof__ (func) func # else # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy # endif #else # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ _GL_EXTERN_C int _gl_cxxalias_dummy #endif #endif /* _GL_CXXDEFS_H */ gengetopt-2.22.6/build-aux/install-sh0000755000175000017500000003325612044745223014432 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: gengetopt-2.22.6/build-aux/arg-nonnull.h0000664000175000017500000000231012044745036015022 00000000000000/* A C macro for declaring that specific arguments must not be NULL. Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. n = 1 stands for the first argument, n = 2 for the second argument etc. */ #ifndef _GL_ARG_NONNULL # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) # else # define _GL_ARG_NONNULL(params) # endif #endif gengetopt-2.22.6/build-aux/texinfo.tex0000644000175000017500000116130512044745227014626 00000000000000% texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2012-03-11.15} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as % published by the Free Software Foundation, either version 3 of the % License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. (This has been our intent since Texinfo was invented.) % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org). % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % Since the category of space is not known, we have to be careful. \chardef\spacecat = 10 \def\spaceisspace{\catcode`\ =\spacecat} % sometimes characters are active, so we need control sequences. \chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! \chardef\hashChar = `\# \chardef\lquoteChar= `\` \chardef\questChar = `\? \chardef\rquoteChar= `\' \chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % @errormsg{MSG}. Do the index-like expansions on MSG, but if things % aren't perfect, it's not the end of the world, being an error message, % after all. % \def\errormsg{\begingroup \indexnofonts \doerrormsg} \def\doerrormsg#1{\errmessage{#1}} % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % Do @cropmarks to get crop marks. % \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % % Dimensions to add cropmarks at corners. % Added by P. A. MacKay, 12 Nov. 1986 % \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\cornerlong \cornerlong=1pc \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. % % A mark contains a subexpression of the \ifcase ... \fi construct. % \get*marks macros below extract the needed part using \ifcase. % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top % of a page, or that at the bottom of a page. The solution is % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% \the\toks0 \the\toks2 \noexpand\or \the\toks4 \the\toks6 \noexpand\else \the\toks8 }% } % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% \ifcase0\topmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} \def\getcolormarks{\ifcase2\topmark\fi} % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox % \onepageout takes a vbox as an argument. Note that \pagecontents % does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin \vtop to0pt{% \line{\ewtop\hfil\ewtop}% \nointerlineskip \line{% \vbox{\moveleft\cornerthick\nstop}% \hfill \vbox{\moveright\cornerthick\nstop}% }% \vss}% \vskip\topandbottommargin \line\bgroup \hfil % center the page within the outer (page) hsize. \ifodd\pageno\hskip\bindingoffset\fi \vbox\bgroup \fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 24pt \unvbox\footlinebox \fi % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup \vskip\topandbottommargin plus1fill minus1fill \boxmaxdepth = \cornerthick \vbox to0pt{\vss \line{% \vbox{\moveleft\cornerthick\nsbot}% \hfill \vbox{\moveright\cornerthick\nsbot}% }% \nointerlineskip \line{\ewbot\hfil\ewbot}% }% \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Here are the rules for the cropmarks. Note that they are % offset so that the space between them is truly \outerhsize or \outervsize % (P. A. MacKay, 12 November, 1986) % \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} \def\nstop{\vbox {\hrule height\cornerthick depth\cornerlong width\cornerthick}} \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\argtorun{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} % % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my % favourite TeX trick. --kasal, 16nov03 \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty outside of any environment% \else in environment \expandafter\string#1% \fi } % @end foo executes the definition of \Efoo. % But first, it executes a specialized version of \checkenv % \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would % have adopt a much more difficult approach (putting marks into the main % vertical list for the beginning and end of each change). This command % is not documented, not supported, and doesn't work. % \def\|{% % \vadjust can only be used in horizontal mode. \leavevmode % % Append this vertical mode material after the current line in the output. \vadjust{% % We want to insert a rule with the height and depth of the current % leading; that is exactly what \strutbox is supposed to record. \vskip-\baselineskip % % \vadjust-items are inserted at the left edge of the type. So % the \llap here moves out into the left-hand margin. \llap{% % % For a thicker or thinner bar, change the `1pt'. \vrule height\baselineskip width1pt % % This is the space between the bar and the text. \hskip 12pt }% }% } % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes % definitions, etc. \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other \catcode`\`=\other \catcode`\'=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} % \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\centersub\centerH \else \let\centersub\centerV \fi \centersub{\hfil \ignorespaces#1\unskip \hfil}% \let\centersub\relax % don't let the definition persist, just in case } \def\centerH#1{{% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }} % \newcount\centerpenalty \def\centerV#1{% % The idea here is the same as in \startdefun, \cartouche, etc.: if % @center is the first thing after a section heading, we need to wipe % out the negative parskip inserted by \sectionheading, but still % prevent a page break here. \centerpenalty = \lastpenalty \ifnum\centerpenalty>10000 \vskip\parskip \fi \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi \line{\kern\leftskip #1\kern\rightskip}% } % @sp n outputs n lines of vertical space % \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment % \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} % \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% \restorefirstparagraphindent \indent }% \gdef\noindent{% \restorefirstparagraphindent \noindent }% \global\everypar = {% \kern -\parindent \restorefirstparagraphindent }% } \gdef\restorefirstparagraphindent{% \global \let \indent = \ptexindent \global \let \noindent = \ptexnoindent \global \everypar = {}% } % @refill is a no-op. \let\refill=\relax % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate (before @setfilename). % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % @setfilename is done at the beginning of every texinfo file. % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. \openin 1 texinfo.cnf \ifeof 1 \else \input texinfo.cnf \fi \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. % \def\openindices{% \newindex{cp}% \newcodeindex{fn}% \newcodeindex{vr}% \newcodeindex{tp}% \newcodeindex{ky}% \newcodeindex{pg}% } % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % related messages. The final outcome is that it is up to the TeX user % to double the backslashes and otherwise make the string valid, so % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to % do this reliably, so we use it. % #1 is a control sequence in which to do the replacements, % which we \xdef. \def\txiescapepdf#1{% \ifx\pdfescapestring\relax % No primitive available; should we give a warning or log? % Many times it won't matter. \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} \ifpdf % % Color manipulation macros based on pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead % of actual black. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % % k sets the color for filling (usual text, etc.); % K sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\lastcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % pdftex (and the PDF format) support .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. \let\pdfimgext=\empty \begingroup \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% \else \gdef\pdfimgext{JPG}% \fi \else \gdef\pdfimgext{jpeg}% \fi \else \gdef\pdfimgext{jpg}% \fi \else \gdef\pdfimgext{png}% \fi \else \gdef\pdfimgext{PDF}% \fi \else \gdef\pdfimgext{pdf}% \fi \closein 1 \endgroup % % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifdim \wd0 >0pt width \pdfimagewidth \fi \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 #1.\pdfimgext \else {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \turnoffactive \makevalueexpandable \def\pdfdestname{#1}% \txiescapepdf\pdfdestname \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % % by default, use a color that is dark enough to print on paper as % nearly black, but still distinguishable for online viewing. \def\urlcolor{\rgbDarkRed} \def\linkcolor{\rgbDarkRed} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else \txiescapepdf\pdfoutlinedest \fi % % Also escape PDF chars in the display string. \edef\pdfoutlinetext{#1}% \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % TODO this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Too % much work for too little return. Just use the ASCII equivalents % we use for the index sort strings. % \indexnofonts \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% \gdef\rbracecharliteral[}]% ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \ifx\p\space\else\addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \fi \nextsp} \def\getfilename#1{% \filenamelength=0 % If we don't expand the argument now, \skipspaces will get % snagged on things like "@value{foo}". \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput \message{fonts,} % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname ten#1\endcsname % change the current font } % Select #1 fonts with the current style. % \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} % Unfortunately, we have to override this for titles and the like, since % in those cases "rm" is bold. Sigh. \def\rmisbold{\rm\def\curfontstyle{bf}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % Default leading. \newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % % can get a sort of poor man's double spacing by redefining this. \def\baselinefactor{1} % \def\setleading#1{% \dimen0 = #1\relax \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % PDF CMaps. See also LaTeX's t1.cmap. % % do nothing with this by default. \expandafter\let\csname cmapOT1\endcsname\gobble \expandafter\let\csname cmapOT1IT\endcsname\gobble \expandafter\let\csname cmapOT1TT\endcsname\gobble % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) \ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1-0) %%Title: (TeX-OT1-0 TeX OT1 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1) /Supplement 0 >> def /CMapName /TeX-OT1-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <23> <26> <0023> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 40 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1IT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1IT-0) %%Title: (TeX-OT1IT-0 TeX OT1IT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1IT) /Supplement 0 >> def /CMapName /TeX-OT1IT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <25> <26> <0025> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 42 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <23> <0023> <24> <00A3> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1IT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1TT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1TT-0) %%Title: (TeX-OT1TT-0 TeX OT1TT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1TT) /Supplement 0 >> def /CMapName /TeX-OT1TT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 5 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <21> <26> <0021> <28> <5F> <0028> <61> <7E> <0061> endbfrange 32 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <2191> <0C> <2193> <0D> <0027> <0E> <00A1> <0F> <00BF> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <20> <2423> <27> <2019> <60> <2018> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1TT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% \fi\fi % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). % #3 is the font's design size, #4 is a scale factor, #5 is the CMap % encoding (currently only OT1, OT1IT and OT1TT are allowed, pass % empty to omit). \def\setfont#1#2#3#4#5{% \font#1=\fontprefix#2#3 scaled #4 \csname cmap#5\endcsname#1% } % This is what gets called when #5 of \setfont is empty. \let\cmap\gobble % emacs-page end of cmaps % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} %where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Definitions for a main text size of 11pt. This is the default in % Texinfo. % \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep3}{OT1} \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} \setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 \def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 \def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} \setfont\ssecit\itbshape{10}{1315}{OT1IT} \setfont\ssecsl\slbshape{10}{1315}{OT1} \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{1000}{OT1} \setfont\reducedit\itshape{10}{1000}{OT1IT} \setfont\reducedsl\slshape{10}{1000}{OT1} \setfont\reducedsf\sfshape{10}{1000}{OT1} \setfont\reducedsc\scshape{10}{1000}{OT1} \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 \def\reducedecsize{1000} \textleading = 13.2pt % line spacing for 11pt CM \textfonts % reset the current fonts \rm } % end of 11pt text font size definitions % Definitions to make the main text be 10pt Computer Modern, with % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. % \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep2}{OT1} \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 \def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} \setfont\secrm\rmbshape{12}{1000}{OT1} \setfont\secit\itbshape{10}{\magstep1}{OT1IT} \setfont\secsl\slbshape{10}{\magstep1}{OT1} \setfont\sectt\ttbshape{12}{1000}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} \setfont\ssecrm\rmbshape{10}{1000}{OT1} \setfont\ssecit\itbshape{10}{1000}{OT1IT} \setfont\ssecsl\slbshape{10}{1000}{OT1} \setfont\ssectt\ttbshape{10}{1000}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} \setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 \def\ssececsize{1000} % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{900}{OT1} \setfont\reducedit\itshape{9}{1000}{OT1IT} \setfont\reducedsl\slshape{9}{1000}{OT1} \setfont\reducedsf\sfshape{9}{1000}{OT1} \setfont\reducedsc\scshape{10}{900}{OT1} \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 \def\reducedecsize{0900} \divide\parskip by 2 % reduce space between paragraphs \textleading = 12pt % line spacing for 10pt CM \textfonts % reset the current fonts \rm } % end of 10pt text font size definitions % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. % \def\xiword{11} \def\xword{10} \def\xwordpt{10pt} % \parseargdef\fonttextsize{% \def\textsizearg{#1}% %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi \else \errhelp=\EMsimple \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} \fi\fi \endgroup } % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts except % in the main text, we don't bother to reset \scriptfont and % \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf \textfont\ttfam=\tentt \textfont\sffam=\tensf } % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this because \STYLE needs to also set the % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire % \tenSTYLE to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used in % the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \def\curfontsize{text}% \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{27pt}} \def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl \def\curfontsize{chap}% \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl \def\curfontsize{sec}% \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl \def\curfontsize{ssec}% \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} \let\subsubsecfonts = \subsecfonts \def\reducedfonts{% \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy \let\tenttsl=\reducedttsl \def\curfontsize{reduced}% \def\lsize{small}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl \def\curfontsize{small}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \def\curfontsize{smaller}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000}{OT1} \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000}{OT1} \setfont\shortconttt\ttshape{12}{1000}{OT1TT} % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \definetextfontsizexi \message{markup,} % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will % define and register \INITMACRO to be called on markup style changes. % \INITMACRO can check \currentmarkupstyle for the innermost % style and the set of \ifmarkupSTYLE switches for all styles % currently in effect. \newif\ifmarkupvar \newif\ifmarkupsamp \newif\ifmarkupkey %\newif\ifmarkupfile % @file == @samp. %\newif\ifmarkupoption % @option == @samp. \newif\ifmarkupcode \newif\ifmarkupkbd %\newif\ifmarkupenv % @env == @code. %\newif\ifmarkupcommand % @command == @code. \newif\ifmarkuptex % @tex (and part of @math, for now). \newif\ifmarkupexample \newif\ifmarkupverb \newif\ifmarkupverbatim \let\currentmarkupstyle\empty \def\setupmarkupstyle#1{% \csname markup#1true\endcsname \def\currentmarkupstyle{#1}% \markupstylesetup } \let\markupstylesetup\empty \def\defmarkupstylesetup#1{% \expandafter\def\expandafter\markupstylesetup \expandafter{\markupstylesetup #1}% \def#1% } % Markup style setup for left and right quotes. \defmarkupstylesetup\markupsetuplq{% \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuplqdefault \else \temp \fi } \defmarkupstylesetup\markupsetuprq{% \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuprqdefault \else \temp \fi } { \catcode`\'=\active \catcode`\`=\active \gdef\markupsetuplqdefault{\let`\lq} \gdef\markupsetuprqdefault{\let'\rq} \gdef\markupsetcodequoteleft{\let`\codequoteleft} \gdef\markupsetcodequoteright{\let'\codequoteright} \gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft} } \let\markupsetuplqcode \markupsetcodequoteleft \let\markupsetuprqcode \markupsetcodequoteright % \let\markupsetuplqexample \markupsetcodequoteleft \let\markupsetuprqexample \markupsetcodequoteright % \let\markupsetuplqsamp \markupsetcodequoteleft \let\markupsetuprqsamp \markupsetcodequoteright % \let\markupsetuplqverb \markupsetcodequoteleft \let\markupsetuprqverb \markupsetcodequoteright % \let\markupsetuplqverbatim \markupsetcodequoteleft \let\markupsetuprqverbatim \markupsetcodequoteright \let\markupsetuplqkbd \markupsetnoligaturesquoteleft % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it % works for pasting with more pdf viewers (at least evince), the % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else \char'15 \fi \else \char'15 \fi } % % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. % \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax % [Knuth] pp. 380,381,391 % \relax disables Spanish ligatures ?` and !` of \tt font. \relax`% \else \char'22 \fi \else \char'22 \fi } % Commands to set the quote options. % \parseargdef\codequoteundirected{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequoteundirected\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequoteundirected\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% \fi\fi } % \parseargdef\codequotebacktick{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequotebacktick\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequotebacktick\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% \fi\fi } % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Font commands. % #1 is the font command (\sl or \it), #2 is the text to slant. % If we are in a monospaced environment, however, 1) always use \ttsl, % and 2) do not add an italic correction. \def\dosmartslant#1#2{% \ifusingtt {{\ttsl #2}\let\next=\relax}% {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% \next } \def\smartslanted{\dosmartslant\sl} \def\smartitalic{\dosmartslant\it} % Output an italic correction unless \next (presumed to be the following % character) is such as not to need one. \def\smartitaliccorrection{% \ifx\next,% \else\ifx\next-% \else\ifx\next.% \else\ptexslash \fi\fi\fi \aftersmartic } % like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. \def\ttslanted#1{{\ttsl #1}} % @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% \smartslanted{#1}% } \let\i=\smartitalic \let\slanted=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default % @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } % @samp. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} % definition of @key that produces a lozenge. Doesn't adjust to text size. %\setfont\keyrm\rmshape{8}{1000}{OT1} %\font\keysy=cmsy9 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% % \vbox{\hrule\kern-0.4pt % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% % \kern-0.4pt\hrule}% % \kern-.06em\raise0.4pt\hbox{\angleright}}}} % definition of @key with no lozenge. If the current font is already % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % \def\key#1{{\setupmarkupstyle{key}% \nohyphenation \ifmonospace\else\tt\fi #1}\null} % ctrl is no longer a Texinfo command. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. \let\file=\samp \let\option=\samp % @code is a modification of @t, % which makes spaces the same size as normal in the surrounding text. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \rawbackslash \plainfrenchspacing #1% }% \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. % -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup \setupmarkupstyle{code}% % The following should really be moved into \setupmarkupstyle handlers. \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\realdash \let_\realunder \fi \codex } } \def\codex #1{\tclose{#1}\endgroup} \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url % itself. First (mandatory) arg is the url. % (This \urefnobreak definition isn't used now, leaving it for a while % for comparison.) \def\urefnobreak#1{\dourefnobreak #1,,,\finish} \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url \fi \else \code{#1}% only url given, so show it \fi \fi \endlink \endgroup} % This \urefbreak definition is the active one. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url \fi \else \urefcode{#1}% only url given, so show it \fi \fi \endlink \endgroup} % Allow line breaks around only a few characters (only). \def\urefcatcodes{% \catcode\ampChar=\active \catcode\dotChar=\active \catcode\hashChar=\active \catcode\questChar=\active \catcode\slashChar=\active } { \urefcatcodes % \global\def\urefcode{\begingroup \setupmarkupstyle{code}% \urefcatcodes \let&\urefcodeamp \let.\urefcodedot \let#\urefcodehash \let?\urefcodequest \let/\urefcodeslash \codex } % % By default, they are just regular characters. \global\def&{\normalamp} \global\def.{\normaldot} \global\def#{\normalhash} \global\def?{\normalquest} \global\def/{\normalslash} } % we put a little stretch before and after the breakable chars, to help % line breaking of long url's. The unequal skips make look better in % cmtt at least, especially for dots. \def\urefprestretch{\urefprebreak \hskip0pt plus.13em } \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } % \def\urefcodeamp{\urefprestretch \&\urefpoststretch} \def\urefcodedot{\urefprestretch .\urefpoststretch} \def\urefcodehash{\urefprestretch \#\urefpoststretch} \def\urefcodequest{\urefprestretch ?\urefpoststretch} \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} { \catcode`\/=\active \global\def\urefcodeslashfinish{% \urefprestretch \slashChar % Allow line break only after the final / in a sequence of % slashes, to avoid line break between the slashes in http://. \ifx\next/\else \urefpoststretch \fi } } % One more complication: by default we'll break after the special % characters, but some people like to break before the special chars, so % allow that. Also allow no breaking at all, for manual control. % \parseargdef\urefbreakstyle{% \def\txiarg{#1}% \ifx\txiarg\wordnone \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordbefore \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordafter \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} \else \errhelp = \EMsimple \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% \fi\fi\fi } \def\wordafter{after} \def\wordbefore{before} \def\wordnone{none} \urefbreakstyle after % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. \def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct'. \kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} % For @indicateurl, @env, @command quotes seem unnecessary, so use \code. \let\indicateurl=\code \let\env=\code \let\command=\code % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} % @clickstyle @arrow (by default) \parseargdef\clickstyle{\def\click{#1}} \def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode`\_ = \active \gdef\mathunderscore{% \catcode`\_=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a math (or tt) \. % FYI, plain.tex uses \\ as a temporary control sequence (for no % particular reason), but this is not advertised and we don't care. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \tex \mathunderscore \let\\ = \mathbackslash \mathactive % make the texinfo accent commands work in math mode \let\"=\ddot \let\'=\acute \let\==\bar \let\^=\hat \let\`=\grave \let\u=\breve \let\v=\check \let\~=\tilde \let\dotaccent=\dot $\finishmath } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \catcode`' = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus \let' = \ptexquoteright } } % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. % \def\outfmtnametex{tex} % \long\def\inlinefmt#1{\doinlinefmt #1,\finish} \long\def\doinlinefmt#1,#2,\finish{% \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi } % For raw, must switch into @tex before parsing the argument, to avoid % setting catcodes prematurely. Doing it this way means that, for % example, @inlineraw{html, foo{bar} gets a parse error instead of being % ignored. But this isn't important because if people want a literal % *right* brace they would have to use a command anyway, so they may as % well use a command to get a left brace too. We could re-use the % delimiter character idea from \verb, but it seems like overkill. % \long\def\inlineraw{\tex \doinlineraw} \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} \def\doinlinerawtwo#1,#2,\finish{% \def\inlinerawname{#1}% \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi \endgroup % close group opened by \tex. } \message{glyphs,} % and logos. % @@ prints an @, as does @atchar{}. \def\@{\char64 } \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. % Unless we're in typewriter, use \ecfont because the CM text fonts do % not have braces, and we don't want to switch into math. \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} \let\{=\mylbrace \let\lbracechar=\{ \let\}=\myrbrace \let\rbracechar=\} \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]% !endgroup % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \ptexc \let\dotaccent = \ptexdot \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \ptext \let\ubaraccent = \ptexb \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. \selectfonts\lllsize A% \fi }% \vss }}% \kern-.15em \TeX } % Some math mode symbols. \def\bullet{$\ptexbullet$} \def\geq{\ifmmode \ge\else $\ge$\fi} \def\leq{\ifmmode \le\else $\le$\fi} \def\minus{\ifmmode -\else $-$\fi} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm % typewriter fonts as three actual period characters; on the other hand, % in other typewriter fonts three periods are wider than 1.5em. So do % whichever is larger. % \def\dots{% \leavevmode \setbox0=\hbox{...}% get width of three periods \ifdim\wd0 > 1.5em \dimen0 = \wd0 \else \dimen0 = 1.5em \fi \hbox to \dimen0{% \hskip 0pt plus.25fil .\hskip 0pt plus1fil .\hskip 0pt plus1fil .\hskip 0pt plus.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, they should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{{\it\$}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % Glyphs from the EC fonts. We don't use \let for the aliases, because % sometimes we redefine the original macro, and the alias should reflect % the redefinition. % % Use LaTeX names for the Icelandic letters. \def\DH{{\ecfont \char"D0}} % Eth \def\dh{{\ecfont \char"F0}} % eth \def\TH{{\ecfont \char"DE}} % Thorn \def\th{{\ecfont \char"FE}} % thorn % \def\guillemetleft{{\ecfont \char"13}} \def\guillemotleft{\guillemetleft} \def\guillemetright{{\ecfont \char"14}} \def\guillemotright{\guillemetright} \def\guilsinglleft{{\ecfont \char"0E}} \def\guilsinglright{{\ecfont \char"0F}} \def\quotedblbase{{\ecfont \char"12}} \def\quotesinglbase{{\ecfont \char"0D}} % % This positioning is not perfect (see the ogonek LaTeX package), but % we have the precomposed glyphs for the most common cases. We put the % tests to use those glyphs in the single \ogonek macro so we have fewer % dummy definitions to worry about for index entries, etc. % % ogonek is also used with other letters in Lithuanian (IOU), but using % the precomposed glyphs for those is not so easy since they aren't in % the same EC font. \def\ogonek#1{{% \def\temp{#1}% \ifx\temp\macrocharA\Aogonek \else\ifx\temp\macrochara\aogonek \else\ifx\temp\macrocharE\Eogonek \else\ifx\temp\macrochare\eogonek \else \ecfont \setbox0=\hbox{#1}% \ifdim\ht0=1ex\accent"0C #1% \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% \fi \fi\fi\fi\fi }% } \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % % Use the ec* fonts (cm-super in outline format) for non-CM glyphs. \def\ecfont{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifx\curfontstyle\bfstylename % bold: \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \thisecfont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% \hfil\crcr\Orb}}% }$% } % @textdegree - the normal degrees sign. % \def\textdegree{$^\circ$} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi % Quotes. \chardef\quotedblleft="5C \chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. % \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents \contents \global\let\shortcontents = \relax \global\let\contents = \relax \fi % \ifsetcontentsaftertitlepage \contents \global\let\contents = \relax \global\let\shortcontents = \relax \fi } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } % Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% \checkenv\titlepage \leftline{\titlefonts\rmisbold #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\secfonts\rmisbold \leftline{#1}}% \fi } % Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\pageheight by -12pt \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @evenheadingmarks top \thischapter <- chapter at the top of a page % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page % % The same set of arguments for: % % @oddheadingmarks % @evenfootingmarks % @oddfootingmarks % @everyheadingmarks % @everyfootingmarks \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname \global\expandafter\let\csname get#1#2marks\endcsname \temp } \everyheadingmarks bottom \everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \def\headings #1 {\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}% \oddheadline={\hfil}\oddfootline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % % Try typesetting the item mark that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% \setbox0 = \hbox{\itemcontents}% % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi % \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a . % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg % to @enumerate. % \def\alphaenumerate{\enumerate{a}} \def\capsenumerate{\enumerate{A}} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 % % @multitable ... @end multitable will make as many columns as desired. % Contents of each column will wrap at width given in preamble. Width % can be specified either with sample text given in a template line, % or in percent of \hsize, the current width of text on page. % Table can continue over pages but will only break between lines. % To make preamble: % % Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % % Numbers following @columnfractions are the percent of the total % current hsize to be used for each column. You may use as many % columns as desired. % Or use a template: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. % @item, @tab do not need to be on their own lines, but it will not hurt % if they are. % Sample multitable: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col % @item % first col stuff % @tab % second col stuff % @tab % third col % @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. % % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable % Default dimensions may be reset by user. % @multitableparskip is vertical space between paragraphs in table. % @multitableparindent is paragraph indent in table. % @multitablecolmargin is horizontal space to be left between columns. % @multitablelinespace is space to leave between table items, baseline % to baseline. % 0pt means it depends on current normal line spacing. % \newskip\multitableparskip \newskip\multitableparindent \newdimen\multitablecolspace \newskip\multitablelinespace \multitableparskip=0pt \multitableparindent=6pt \multitablecolspace=12pt \multitablelinespace=0pt % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % multitable-only commands. % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group % of an alignment entry. \everycr resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we again encounter the problem the 1sp was intended to solve. % --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \setmultitablespacing \parskip=\multitableparskip \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% \global\colcount=0 % Reset the column counter. % Check for saved footnotes, etc. \checkinserts % Keeps underfull box messages off when table breaks over pages. %\filbreak % Maybe so, but it also creates really weird page breaks when the % table breaks over pages. Wouldn't \vfil be better? Wait until the % problem manifests itself, so it can be fixed for real --karl. }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \multistrut \vtop{% % Use the current \colcount to find the correct column width: \hsize=\expandafter\csname col\the\colcount\endcsname % % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. % % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % % If the user has set preamble in terms of percent of \hsize we will % use that dimension as the width of the column, and the \leftskip % will keep entries from bumping into each other. Table will start at % left margin and final column will justify at right margin. % % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 % The first column will be indented with the surrounding text. \advance\hsize by\leftskip \else \ifsetpercent \else % If user has not set preamble in terms of percent of \hsize % we will advance \hsize by \multitablecolspace. \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: \leftskip=\multitablecolspace \fi % Ignoring space at the beginning and end avoids an occasional spurious % blank line, when TeX decides to break the line at the space before the % box from the multistrut, so the strut ends up on a line by itself. % For example: % @multitable @columnfractions .11 .89 % @item @code{#} % @tab Legal holiday which is valid in major parts of the whole country. % Is automatically provided with highlighting sequences respectively % marking characters. \noindent\ignorespaces##\unskip\multistrut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \def\setmultitablespacing{% \def\multistrut{\strut}% just use the standard line spacing % % Compute \multitablelinespace (if not defined by user) for use in % \multitableparskip calculation. We used define \multistrut based on % this, but (ironically) that caused the spacing to be off. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi % Test to see if parskip is larger than space between lines of % table. If not, do nothing. % If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi} \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1'. \long\def\doignoretext##1^^M@end #1{% \doignoretextyyy##1^^M@#1\_STOP_}% % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. { \obeylines% % Ignore anything after the last `@end #1'; this matters in verbatim % environments, where otherwise the newline after an ignored conditional % would result in a blank line in the output. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\- = \active \catcode`\_ = \active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\realdash \let_\normalunderscore } } % We have this subroutine so that we can handle at least some @value's % properly in indexes (we call \makevalueexpandable in \indexdummies). % The command has to be fully expandable (if the variable is set), since % the result winds up in the index file. This means that if the % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get special treatment of `@end ifset,' call \makeond and the redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that % \fooindex ...rest of line... puts an entry in the index foo. % It also defines \fooindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 % Open the file \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, % and it is "foo", the name of the index. % \doindex just uses \parsearg; it calls \doind for the actual work. % This is because \doind is more useful to call from other macros. % There is also \dosubind {index}{topic}{subtopic} % which makes an entry in a two-level index such as the operation index. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} \def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} % Take care of Texinfo commands that can appear in an index entry. % Since there are some commands we want to expand, and others we don't, % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % % Need these unexpandable (because we define \tt as a dummy) % definitions when @{ or @} appear in index entry text. Also, more % complicated, when \tex is in effect and \{ is a \delimiter again. % We can't use \lbracecmd and \rbracecmd because texindex assumes % braces and backslashes are used only as delimiters. Perhaps we % should define @lbrace and @rbrace commands a la @comma. \def\{{{\tt\char123}}% \def\}{{\tt\char125}}% % % I don't entirely understand this, but when an index entry is % generated from a macro call, the \endinput which \scanmacro inserts % causes processing to be prematurely terminated. This is, % apparently, because \indexsorttmp is fully expanded, and \endinput % is an expandable command. The redefinition below makes \endinput % disappear altogether for that purpose -- although logging shows that % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} % @findex xyz % @end macro % ... % @funindex commtest % % The above is not enough to reproduce the bug, but it gives the flavor. % % Sample whatsit resulting: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} % % So: \let\endinput = \empty % % Do the redefinitions. \commondummies } % For the aux and toc files, @ is the escape character. So we want to % redefine everything using @ as the escape character (instead of % \realbackslash, still used for index files). When everything uses @, % this will be simpler. % \def\atdummies{% \def\@{@@}% \def\ {@ }% \let\{ = \lbraceatcmd \let\} = \rbraceatcmd % % Do the redefinitions. \commondummies \otherbackslash } % Called from \indexdummies and \atdummies. % \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the % space. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % \def\definedummyword ##1{\def##1{\string##1\space}}% \def\definedummyletter##1{\def##1{\string##1}}% \let\definedummyaccent\definedummyletter % \commondummiesnofonts % \definedummyletter\_% \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\DH \definedummyword\L \definedummyword\O \definedummyword\OE \definedummyword\TH \definedummyword\aa \definedummyword\ae \definedummyword\dh \definedummyword\exclamdown \definedummyword\l \definedummyword\o \definedummyword\oe \definedummyword\ordf \definedummyword\ordm \definedummyword\questiondown \definedummyword\ss \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\geq \definedummyword\guillemetleft \definedummyword\guillemetright \definedummyword\guilsinglleft \definedummyword\guilsinglright \definedummyword\leq \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\quotedblbase \definedummyword\quotedblleft \definedummyword\quotedblright \definedummyword\quoteleft \definedummyword\quoteright \definedummyword\quotesinglbase \definedummyword\result \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist % \normalturnoffactive % % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. % \def\commondummiesnofonts{% % Control letters and accents. \definedummyletter\!% \definedummyaccent\"% \definedummyaccent\'% \definedummyletter\*% \definedummyaccent\,% \definedummyletter\.% \definedummyletter\/% \definedummyletter\:% \definedummyaccent\=% \definedummyletter\?% \definedummyaccent\^% \definedummyaccent\`% \definedummyaccent\~% \definedummyword\u \definedummyword\v \definedummyword\H \definedummyword\dotaccent \definedummyword\ogonek \definedummyword\ringaccent \definedummyword\tieaccent \definedummyword\ubaraccent \definedummyword\udotaccent \definedummyword\dotless % % Texinfo font commands. \definedummyword\b \definedummyword\i \definedummyword\r \definedummyword\sansserif \definedummyword\sc \definedummyword\slanted \definedummyword\t % % Commands that take arguments. \definedummyword\acronym \definedummyword\anchor \definedummyword\cite \definedummyword\code \definedummyword\command \definedummyword\dfn \definedummyword\dmn \definedummyword\email \definedummyword\emph \definedummyword\env \definedummyword\file \definedummyword\indicateurl \definedummyword\kbd \definedummyword\key \definedummyword\math \definedummyword\option \definedummyword\pxref \definedummyword\ref \definedummyword\samp \definedummyword\strong \definedummyword\tie \definedummyword\uref \definedummyword\url \definedummyword\var \definedummyword\verb \definedummyword\w \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % % Unfortunately, texindex is not prepared to handle braces in the % content at all. So for index sorting, we map @{ and @} to strings % starting with |, since that ASCII character is between ASCII { and }. \def\{{|a}% \def\}{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% \def\ordf{a}% \def\ordm{o}% \def\o{o}% \def\questiondown{?}% \def\ss{ss}% \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% \def\geq{>=}% \def\guillemetleft{<<}% \def\guillemetright{>>}% \def\guilsinglleft{<}% \def\guilsinglright{>}% \def\leq{<=}% \def\minus{-}% \def\point{.}% \def\pounds{pounds}% \def\print{-|}% \def\quotedblbase{"}% \def\quotedblleft{"}% \def\quotedblright{"}% \def\quoteleft{`}% \def\quoteright{'}% \def\quotesinglbase{,}% \def\registeredsymbol{R}% \def\result{=>}% \def\textdegree{o}% % \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist } % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us % ignore left quotes in the sort term. {\catcode`\`=\active \gdef\indexlquoteignore{\let`=\empty}} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). % \def\dosubind#1#2#3{% \iflinks {% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. \def\thirdarg{#3}% \ifx\thirdarg\empty \else \toks0 = \expandafter{\the\toks0 \space #3}% \fi % \edef\writeto{\csname#1indfile\endcsname}% % \safewhatsit\dosubindwrite }% \fi } % Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % % Process the index entry with all font commands turned off, to % get the string to sort by. {\indexnofonts \edef\temp{\the\toks0}% need full expansion \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. \edef\temp{% \write\writeto{% \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } % Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write or \pdfdest will make \lastskip zero. The result is that % sequences like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % \newskip\whatsitskip \newcount\whatsitpenalty % % ..., ready, GO: % \def\safewhatsit#1{\ifhmode #1% \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\whatsitskip \fi % #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\whatsitskip \fi \fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} \def\cindexsub {\begingroup\obeylines\cindexsub} {\obeylines % \gdef\cindexsub "#1" #2^^M{\endgroup % \dosubind{cp}{#2}{#1}}} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. \def\initial#1{{% % Some minor font changes for the special characters. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. \nobreak \vskip 0pt plus 3\baselineskip \penalty 0 \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip }} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % % A straightforward implementation would start like this: % \def\entry#1#2{... % But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % Do not fill out the last line with white space. \parfillskip = 0in % % No extra space above this paragraph. \parskip = 0in % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % \hangindent is only relevant when the entry text and page number % don't both fit on one line. In that case, bob suggests starting the % dots pretty far over on the line. Unfortunately, a large % indentation looks wrong when the entry text itself is broken across % lines. So we use a small indentation and put up with long leaders. % % \hangafter is reset to 1 (which is the value we want) at the start % of each paragraph, so we need not do anything with that. \hangindent = 2em % % When the entry text needs to be broken, just fill out the first line % with blank space. \rightskip = 0pt plus1fil % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus1pt % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. } \def\finishentry#1{% % #1 is the page number. % % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. \setbox\boxA = \hbox{#1}% \ifdim\wd\boxA = 0pt \ % \else % % If we must, put the page number on a line of its own, and fill out % this line with blank space. (The \hfil is overwhelmed with the % fill leaders glue in \indexdotfill if the page number does fit.) \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % % The `\ ' here is removed by the implicit \unskip that TeX does as % part of (the primitive) \par. Without it, a spurious underfull % \hbox ensues. \ifpdf \pdfgettoks#1.% \ \the\toksA \else \ #1% \fi \fi \par \endgroup } % Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm \def\secondary#1#2{{% \parfillskip=0in \parskip=0in \hangindent=1in \hangafter=1 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else #2 \fi \par }} % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In % that case we just ship out what is in \partialpage with the normal % output routine. Generally, \partialpage will be empty when this % runs and this will be a no-op. See the indexspread.tex test case. \ifvoid\partialpage \else \onepageout{\pagecontents\partialpage}% \fi % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \onepageout\pagesofar \unvbox255 \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } % % All done with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the % following situation: % % The last section of the index consists only of a single entry. % Before this section, \pagetotal is less than \pagegoal, so no % break occurs before the last section starts. However, the last % section, consisting of \initial and the single \entry, does not % fit on the page and has to be broken off. Without the following % penalty the page builder will not be exercised until \eject % below, and by that time we'll already have changed the output % routine to the \balancecolumns version, so the next-to-last % double-column page will be processed with \balancecolumns, which % is wrong: The two columns will go to the main vertical list, with % the broken-off section in the recent contributions. As soon as % the output routine finishes, TeX starts reconsidering the page % break. The two columns and the broken-off section both fit on the % page, because the two columns now take up only half of the page % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns % and the final section into the vbox of \pageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the % page builder, unlike penalties (see The TeXbook, pp. 280-281). \penalty0 % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. \balancecolumns % % If we end up splitting too much material for the current page, % though, there will be another page break right after this \output % invocation ends. Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. (We hope \balancecolumns will never be % called on to balance too much material, but if it is, this makes % the output somewhat more palatable.) \global\output = {\onepageout{\pagecontents\PAGE}}% }% \eject \endgroup % started in \begindoublecolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize (after the % \endgroup where \vsize got restored). \pagegoal = \vsize } % % Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% \splittopskip = \topskip % Loop until we get a decent breakpoint. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht3>\dimen@ \global\advance\dimen@ by 1pt \repeat }% %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% \setbox0=\vbox to\dimen@{\unvbox1}% \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % Let's start with @part. \outer\parseargdef\part{\partzzz{#1}} \def\partzzz#1{% \chapoddpage \null \vskip.3\vsize % move it down on the page a bit \begingroup \noindent \titlefonts\rmisbold #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page \chapoddpage \endgroup } % \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines these (using marks) as the number+name, number % and name of the chapter. Page headings and footings can use % these. @section does likewise. \def\thischapter{} \def\thischapternum{} \def\thischaptername{} \def\thissection{} \def\thissectionnum{} \def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} \let\up=\raisesections % original BFox name % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unnlevel \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else \chardef\unnlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % % \putwordChapter can contain complex things in translations. \toks0=\expandafter{\putwordChapter}% \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz % \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % % \putwordAppendix can contain complex things in translations. \toks0=\expandafter{\putwordAppendix}% \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } % normally unnmhead0 calls unnumberedzzz: \outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% % Well, we could do the following in a group, but that would break % an assumption that \chapmacro is called at the outermost level. % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. % \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } % normally calls appendixsectionzzz: \outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection % normally calls unnumberedseczzz: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. % % normally calls numberedsubseczzz: \outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } % normally calls appendixsubseczzz: \outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } % normally calls unnumberedsubseczzz: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. % % normally numberedsubsubseczzz: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally appendixsubsubseczzz: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally unnumberedsubsubseczzz: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading % NOTE on use of \vbox for chapter headings, section headings, and such: % 1) We use \vbox rather than the earlier \line to permit % overlong headings to fold. % 2) \hyphenpenalty is set to 10000 because hyphenation in a % heading is obnoxious; this forbids it. % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\ptexraggedright \rmisbold #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. % Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. \def\chapoddpage{% \chappager \ifodd\pageno \else \begingroup \headingsoff \null \chappager \endgroup \fi } \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\let\pagealignmacro=\chappager} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \else \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordChapter{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \fi\fi\fi % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert the chapter heading break. \pchapsepmacro % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \domark % {% \chapfonts \rmisbold % % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \nobreak % Avoid page breaks at the interline glue. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % I don't think this chapter style is supported any more, so I'm not % updating it with the new noderef stuff. We'll see. --karl, 11aug03. % \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\ptexraggedright \rmisbold #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen \global\let\centerchapmacro=\centerchfopen} % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% \checkenv{}% should not be in an environment. % % Switch to the right set of fonts. \csname #2fonts\endcsname \rmisbold % \def\sectionlevel{#2}% \def\temptype{#3}% % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword % Don't redefine \thissection. \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \else \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \fi\fi\fi % % Go into vertical mode. Usually we'll already be there, but we % don't want the following whatsit to end up in a preceding paragraph % if the document didn't happen to have a blank line. \par % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevsectiondefs=\lastsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\lastsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chapmacro. \donoderef{#3}% % % Interline glue will be inserted when the vbox is completed. % That glue will be a valid breakpoint for the page, since it'll be % preceded by a whatsit (usually from the \donoderef, or from the % \writetocentry if there was no node). We don't want to allow that % break, since then the whatsits could end up on page n while the % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. \nobreak % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) However, when a paragraph is not started next % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out % or the negative glue will cause weirdly wrong output, typically % obscuring the section heading with something else. \vskip-\parskip % % This is so the last item on the main vertical list is a known % \penalty > 10000, so \startdefun, etc., can recognize the situation % and do the needful. \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp }% \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdf \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. Thus, we maintain % \contentsalignmacro in parallel with \pagealignmacro. % From: Torbjorn Granlund \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % \def\tocreadfilename{\jobname.toc} % Normal (long) toc. % \def\contents{% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } \let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% \penalty-300 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain @ character. \envdef\tex{% \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \catcode`\`=\other \catcode`\'=\other \escapechar=`\\ % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} \let\afterenvbreak = \aboveenvbreak % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. \font\circle=lcircle10 \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \circthick=\fontdimen8\circle % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip \envdef\cartouche{% \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% % % If this cartouche directly follows a sectioning command, we need the % \parskip glue (backspaced over by default) or the cartouche can % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt % Turn off paragraph indentation but redefine \indent to emulate % the normal \indent. \nonfillparindent=\parindent \parindent = 0pt \let\indent\nonfillindent % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } \begingroup \obeyspaces % We want to swallow spaces (but not other tokens) after the fake % @indent in our nonfill-environments, where spaces are normally % active and set to @tie, resulting in them not being ignored after % @indent. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% \gdef\nonfillindentcheck{% \ifx\temp % \expandafter\nonfillindentgobble% \else% \leavevmode\nonfillindentbox% \fi% }% \endgroup \def\nonfillindentgobble#1{\nonfillindent} \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword % end paragraph for sake of leading, in case document has no blank % line. This is redundant with what happens in \aboveenvbreak, but % we need to do it before changing the fonts, and it's inconvenient % to change the fonts afterward. \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it in one command. #1 is the env name, #2 the definition. \def\makedispenvdef#1#2{% \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two environment synonyms (#1 and #2) for an environment. \def\maketwodispenvdef#1#2#3{% \makedispenvdef{#1}{#3}% \makedispenvdef{#2}{#3}% } % % @lisp: indented, narrowed, typewriter font; % @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvdef{lisp}{example}{% \nonfillstart \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak % @raggedright does more-or-less normal line breaking but no right % justification. From plain.tex. \envdef\raggedright{% \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax } \let\Eraggedright\par \envdef\raggedleft{% \parindent=0pt \leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedleft\par \envdef\raggedcenter{% \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedcenter\par % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \makedispenvdef{quotation}{\quotationstart} % \def\quotationstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \advance\rightskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } \def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % LaTeX-like @verbatim...@end verbatim and @verb{...} % If we want to allow any as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% % Don't do the quotes -- if we do, @set txicodequoteundirected and % @set txicodequotebacktick will not have effect on @verb and % @verbatim, and ?` and !` ligatures won't get disabled. %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle % tabs. The \global is in case the verbatim line starts with an accent, % or some other command that starts with a begin-group. Otherwise, the % entire \verbbox would disappear at the corresponding end-group, before % it is typeset. Meanwhile, we can't have nested verbatim commands % (can we?), so the \global won't be overwriting itself. \newbox\verbbox \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup % start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim % The \leavevmode here is for blank lines. Otherwise, we would % never \starttabox and the \egroup would end verbatim mode. \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'#1'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. \endgroup % \envdef\verbatim{% \setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \defunpenalty=10003 % Will keep this @deffn together with the % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } \newif\ifdoingtypefn % doing typed function? \newif\ifrettypeownline % typeset return type on its own line? % @deftypefnnewline on|off says whether the return type of typed functions % are printed on their own line. This affects @deftypefn, @deftypefun, % @deftypeop, and @deftypemethod. % \parseargdef\deftypefnnewline{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxideftypefnnl\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETtxideftypefnnl\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @txideftypefnnl value `\temp', must be on|off}% \fi\fi } % Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } % Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } % Types: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % Determine if we are typesetting the return type of a typed function % on a line by itself. \rettypeownlinefalse \ifdoingtypefn % doing a typed function specifically? % then check user option for putting return type on its own line: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else \rettypeownlinetrue \fi \fi % % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. We'll always have at % least two. \tempnum = 2 % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % % If doing a return type on its own line, we'll have another line. \ifrettypeownline \advance\tempnum by 1 \def\maybeshapeline{0in \hsize}% \else \def\maybeshapeline{}% \fi % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % % The final paragraph shape: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 % % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% text of the return type \ifx\temp\empty\else \tclose{\temp}% typeset the return type \ifrettypeownline % put return type on its own line; prohibit line break following: \hfil\vadjust{\nobreak}\break \else \space % type on same line, so just followed by a space \fi \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } % these should not use \errmessage; the glibc manual, at least, actually % has such constructs (when documenting function pointers). \def\badparencount{% \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \def\scanmacro#1{\begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces % % Undo catcode changes of \startcontents and \doprintindex % When called from @insertcopying or (short)caption, we need active % backslash to get it printed correctly. Previously, we had % \catcode`\\=\other instead. We'll see whether a problem appears % with macro expansion. --kasal, 19aug04 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % % ... and for \example: \spaceisspace % % The \empty here causes a following catcode 5 newline to be eaten as % part of reading whitespace after a control sequence. It does not % eat a catcode 13 newline. There's no good way to handle the two % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX % would then have different behavior). See the Macro Details node in % the manual for the workaround we recommend for macros and % line-oriented commands. % \scantokens{#1\empty}% \endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% \temp } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \definedummyword\macro1\definedummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\definedummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \ % to recognize macro arguments; this is the job of \mbodybackslash. % % Non-ASCII encodings make 8-bit characters active, so un-activate % them to avoid their expansion. Must do this non-globally, to % confine the change to the current group. % % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. % \def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } \def\macroargctxt{% used when scanning invocations \scanctxt \catcode`\\=0 } % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" % for the single characters \ { }. Thus, we end up with the "commands" % that would be written @\ @{ @} in a Texinfo document. % % We already have @{ and @}. For @\, we define it here, and only for % this purpose, to produce a typewriter backslash (so, the @\ that we % define for @math can't be used with @macro calls): % \def\\{\normalbackslash}% % % We would like to do this for \, too, since that is what makeinfo does. % But it is not possible, because Texinfo already has a command @, for a % cedilla accent. Documents must use @comma{} instead. % % \anythingelse will almost certainly be an error of some kind. % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. % {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\margbackslash#1{\char`\#1 } \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0\relax \else \expandafter\parsemargdef \argl;% \if\paramno>256\relax \ifx\eTeXversion\thisisundefined \errhelp = \EMsimple \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} \fi \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\definedummyword \noexpand#1% \fi } % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % For macro processing make @ a letter so that we can make Texinfo private macro names. \edef\texiatcatcode{\the\catcode`\@} \catcode `@=11\relax % Parse the optional {params} list. Set up \paramno and \paramlist % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH % in the params list to some hook where the argument si to be expanded. If % there are less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % % We need to get `macro parameter char #' into several definitions. % The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. % % If there are 10 or more arguments, a different technique is used, where the % hook remains in the body, and when macro is to be expanded the body is % processed again to replace the arguments. % % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the % argument N value and then \edef the body (nothing else will expand because of % the catcode regime underwhich the body was input). % % If you compile with TeX (not eTeX), and you have macros with 10 or more % arguments, you need that no macro has more than 256 arguments, otherwise an % error is produced. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax \let\xeatspaces\relax \parsemargdefxxx#1,;,% % In case that there are 10 or more arguments we parse again the arguments % list to set new definitions for the \macarg.BLAH macros corresponding to % each BLAH argument. It was anyhow needed to parse already once this list % in order to count the arguments, and as macros with at most 9 arguments % are by far more frequent than macro with 10 or more arguments, defining % twice the \macarg.BLAH macros does not cost too much processing power. \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments \fi } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else \let\next=\parsemmanyargdef@@ \edef\tempb{\eatspaces{#1}}% \expandafter\def\expandafter\tempa \expandafter{\csname macarg.\tempb\endcsname}% % Note that we need some extra \noexpand\noexpand, this is because we % don't want \the to be expanded in the \parsermacbody as it uses an % \xdef . \expandafter\edef\tempa {\noexpand\noexpand\noexpand\the\toks\the\paramno}% \advance\paramno by 1\relax \fi\next} % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % \catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \catcode `\@=11\relax \let\endargs@\relax \let\nil@\relax \def\nilm@{\nil@}% \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its % definition. It gets all the arguments values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name % #2 is the list of argument names % #3 is the list of argument values \def\getargvals@#1#2#3{% \def\macargdeflist@{}% \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. \def\paramlist{#2,\nil@}% \def\macroname{#1}% \begingroup \macroargctxt \def\argvaluelist{#3,\nil@}% \def\@tempa{#3}% \ifx\@tempa\empty \setemptyargvalues@ \else \getargvals@@ \fi } % \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. \ifx\argvaluelist\nillm@ \else \errhelp = \EMsimple \errmessage{Too many arguments in macro `\macroname'!}% \fi \let\next\macargexpandinbody@ \else \ifx\argvaluelist\nillm@ % No more arguments values passed to macro. Set remaining named-arg % macros to empty. \let\next\setemptyargvalues@ \else % pop current arg name into \@tempb \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% \expandafter\@tempa\expandafter{\paramlist}% % pop current argument value into \@tempc \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% \expandafter\@tempa\expandafter{\argvaluelist}% % Here \@tempb is the current arg name and \@tempc is the current arg value. % First place the new argument macro definition into \@tempd \expandafter\macname\expandafter{\@tempc}% \expandafter\let\csname macarg.\@tempb\endcsname\relax \expandafter\def\expandafter\@tempe\expandafter{% \csname macarg.\@tempb\endcsname}% \edef\@tempd{\long\def\@tempe{\the\macname}}% \push@\@tempd\macargdeflist@ \let\next\getargvals@@ \fi \fi \next } \def\push@#1#2{% \expandafter\expandafter\expandafter\def \expandafter\expandafter\expandafter#2% \expandafter\expandafter\expandafter{% \expandafter#1#2}% } % Replace arguments by their values in the macro body, and place the result % in macro \@tempa \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument % values into respective token registers. % % First we save the token context, and initialize argument numbering. \begingroup \paramno0\relax % Then, for each argument number #N, we place the corresponding argument % value into a new token list register \toks#N \expandafter\putargsintokens@\saveparamlist@,;,% % Then, we expand the body so that argument are replaced by their % values. The trick for values not to be expanded themselves is that they % are within tokens and that tokens expand only once in an \edef . \edef\@tempc{\csname mac.\macroname .body\endcsname}% % Now we restore the token stack pointer to free the token list registers % which we have used, but we make sure that expanded body is saved after % group. \expandafter \endgroup \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } \def\macargexpandinbody@{% %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ % First the replace in body the macro arguments by their values, the result % is in \@tempa . \macvalstoargs@ % Then we point at the \norecurse or \gobble (for recursive) macro value % with \@tempb . \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname % Depending on whether it is recursive or not, we need some tailing % \egroup . \ifx\@tempb\gobble \let\@tempc\relax \else \let\@tempc\egroup \fi % And now we do the real job: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% \@tempd } \def\putargsintokens@#1,{% \if#1;\let\next\relax \else \let\next\putargsintokens@ % First we allocate the new token list register, and give it a temporary % alias \@tempb . \toksdef\@tempb\the\paramno % Then we place the argument value into that token list register. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname \expandafter\@tempb\expandafter{\@tempa}% \advance\paramno by 1\relax \fi \next } % Save the token stack pointer into macro #1 \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} % Restore the token stack pointer from number in macro #1 \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} % newtoks that can be used non \outer . \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} % Tailing missing arguments are set to empty \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ \else \expandafter\setemptyargvaluesparser@\paramlist\endargs@ \let\next\setemptyargvalues@ \fi \next } \def\setemptyargvaluesparser@#1,#2\endargs@{% \expandafter\def\expandafter\@tempa\expandafter{% \expandafter\def\csname macarg.#1\endcsname{}}% \push@\@tempa\macargdeflist@ \def\paramlist{#2}% } % #1 is the element target macro % #2 is the list macro % #3,#4\endargs@ is the list value \def\pop@#1#2#3,#4\endargs@{% \def#1{#3}% \def#2{#4}% } \long\def\longpop@#1#2#3,#4\endargs@{% \long\def#1{#3}% \long\def#2{#4}% } % This defines a Texinfo @macro. There are eight cases: recursive and % nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else \ifnum\paramno<10\relax % at most 9 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \else % 10 or more \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % at most 9 \ifnum\paramno<10\relax \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse \fi \fi \fi} \catcode `\@\texiatcatcode\relax \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence % as an argument (by \parsebrace or \parsearg). % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Make them active and then expand them all to nothing. % \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{% \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } % @xrefautosectiontitle on|off says whether @section(ing) names are used % automatically in xrefs, if the third arg is not explicitly specified. % This was provided as a "secret" @set xref-automatic-section-title % variable, now it's official. % \parseargdef\xrefautomaticsectiontitle{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', must be on|off}% \fi\fi } % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} % \newbox\topbox \newbox\printedrefnamebox \newbox\printedmanualbox % \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces % \def\printedrefname{\ignorespaces #3}% \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% % \def\printedmanual{\ignorespaces #5}% \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% % % If the printed reference name (arg #3) was not explicitly given in % the @xref, figure out what we want to use. \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Auto section-title: use chapter/section title inside % the square brackets if we have it. \ifdim \wd\printedmanualbox > 0pt % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf {\indexnofonts \turnoffactive \makevalueexpandable % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. \getfilename{#4}% % \edef\pdfxrefdest{#1}% \txiescapepdf\pdfxrefdest % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 goto file{\the\filename.pdf} name{\pdfxrefdest}% \else goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". We distinguish them by the % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt \refx{#1-snt}{}% \else \printedrefname \fi % % if the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox to print the node names, TeX does not insert % empty discretionaries after hyphens, which means that it will not % find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, % this is a loss. Therefore, we give the text of the node name % again, so it is as if TeX is seeing it for the first time. % % Cross-manual reference. Only include the "Section ``foo'' in" if % the foo is neither missing or Top. Thus, @xref{,,,foo,The Foo Manual} % outputs simply "see The Foo Manual". \ifdim \wd\printedmanualbox > 0pt % What is the 7sp about? The idea is that we also want to omit % the Section part if we would be printing "Top", since they are % clearly trying to refer to the whole manual. But, this being % TeX, we can't easily compare strings while ignoring the possible % spaces before and after in the input. By adding the arbitrary % 7sp, we make it much less likely that a real node name would % happen to have the same width as "Top" (e.g., in a monospaced font). % I hope it will never happen in practice. % % For the same basic reason, we retypeset the "Top" at every % reference, since the current font is indeterminate. % \setbox\topbox = \hbox{Top\kern7sp}% \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% \ifdim \wd2 > 7sp \ifdim \wd2 = \wd\topbox \else \putwordSection{} ``\printedrefname'' \putwordin{}\space \fi \fi \cite{\printedmanual}% \else % Reference in this manual. % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. {\turnoffactive % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi \fi \endlink \endgroup} % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% {% \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs {\toks0 = {#1}% avoid expansion of possibly-complex value \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Usually it's % just a \def (we prepend XR to the control sequence name to avoid % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% {% The node name might contain 8-bit characters, which in our current % implementation are changed to commands like @'e. Don't let these % mess up the control sequence name. \indexnofonts \turnoffactive \xdef\safexrefname{#1}% }% % \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 {\safexrefname}}% \fi } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ % character, we would end up writing a line like this: 'xrdef {'hat % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % % This is to support \ in node names and titles, since the \ % characters end up in a \csname. It's easier than % leaving it active and making its active definition an actual \ % character. What I don't understand is why it works in the *value* % of the xrdef. Seems like it should be a catcode12 \, and that % should not typeset properly. But it works, so I'm moving on for % now. --karl, 15jan04. \catcode`\\=\other % % Make the characters 128-255 be printing characters. {% \count1=128 \def\loop{% \catcode\count1=\other \advance\count1 by 1 \ifnum \count1<256 \loop \fi }% }% % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut % % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } }%end \catcode `\@=11 % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode \imagevmodetrue \else \ifx\centersub\centerV % for @center @image, we need a vbox so we can have our vertical space \imagevmodetrue \vbox\bgroup % vbox has better behavior than vtop herev \fi\fi % \ifimagevmode \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \fi % % Leave vertical mode so that indentation from an enclosing % environment such as @quotation is respected. % However, if we're at the top level, we don't want the % normal paragraph indentation. % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. \ifx\centersub\centerV\else \noindent \fi % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi % \ifimagevmode \medskip % space after a standalone image \fi \ifx\centersub\centerV \egroup \fi \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \atdummies % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. \scanexp{% \xdef\noexpand\gtemp{% \ifx\thisshortcaption\empty \thiscaption \else \thisshortcaption \fi }% }% \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % % place the captured inserts % % BEWARE: when the floats start floating, we have to issue warning % whenever an insert appears inside a float which could possibly % float. --kasal, 26may04 % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % For single-language documents, @documentlanguage is usually given very % early, just after @documentencoding. Single argument is the language % (de) or locale (de_DE) abbreviation. % { \catcode`\_ = \active \globaldefs=1 \parseargdef\documentlanguage{\begingroup \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 \documentlanguagetrywithoutunderscore{#1_\finish}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX \endgroup} % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. % \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 } }% end of special _ catcode % \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? Putting it in the current directory should work if nowhere else does.} % This macro is called from txi-??.tex files; the first argument is the % \language name to set (without the "\lang@" prefix), the second and % third args are \{left,right}hyphenmin. % % The language names to pass are determined when the format is built. % See the etex.log file created at that time, e.g., % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. % % With TeX Live 2008, etex now includes hyphenation patterns for all % available languages. This means we can support hyphenation in % Texinfo, at least to some extent. (This still doesn't solve the % accented characters problem.) % \catcode`@=11 \def\txisetlanguage#1#2#3{% % do not set the language if the name is undefined in the current TeX. \expandafter\ifx\csname lang@#1\endcsname \relax \message{no patterns for #1}% \else \global\language = \csname lang@#1\endcsname \fi % but there is no harm in adjusting the hyphenmin values regardless. \global\lefthyphenmin = #2\relax \global\righthyphenmin = #3\relax } % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 \global\catcode\count255=#1\relax \advance\count255 by 1 \repeat } \def\setnonasciicharscatcodenonglobal#1{% \count255=128 \loop\ifnum\count255<256 \catcode\count255=#1\relax \advance\count255 by 1 \repeat } % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % \parseargdef\documentencoding{% % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % % Supported encodings: names converted to tokens in order to be able % to compare them with \ifx. \def\ascii{\csname US-ASCII.enc\endcsname}% \def\latnine{\csname ISO-8859-15.enc\endcsname}% \def\latone{\csname ISO-8859-1.enc\endcsname}% \def\lattwo{\csname ISO-8859-2.enc\endcsname}% \def\utfeight{\csname UTF-8.enc\endcsname}% % \ifx \declaredencoding \ascii \asciichardefs % \else \ifx \declaredencoding \lattwo \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight \setnonasciicharscatcode\active \utfeightchardefs % \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii } % A message to be logged when using a character that isn't available % the default font encoding (OT1). % \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} % First, make active non-ASCII characters in order for them to be % correctly categorized when TeX reads the replacement text of % macros containing the character definitions. \setnonasciicharscatcode\active % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\copyright} \gdef^^aa{\ordf} \gdef^^ab{\guillemetleft} \gdef^^ac{$\lnot$} \gdef^^ad{\-} \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} \gdef^^b1{$\pm$} \gdef^^b2{$^2$} \gdef^^b3{$^3$} \gdef^^b4{\'{}} \gdef^^b5{$\mu$} \gdef^^b6{\P} % \gdef^^b7{$^.$} \gdef^^b8{\cedilla\ } \gdef^^b9{$^1$} \gdef^^ba{\ordm} % \gdef^^bb{\guillemetright} \gdef^^bc{$1\over4$} \gdef^^bd{$1\over2$} \gdef^^be{$3\over4$} \gdef^^bf{\questiondown} % \gdef^^c0{\`A} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} \gdef^^c9{\'E} \gdef^^ca{\^E} \gdef^^cb{\"E} \gdef^^cc{\`I} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\"I} % \gdef^^d0{\DH} \gdef^^d1{\~N} \gdef^^d2{\`O} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\~O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\O} \gdef^^d9{\`U} \gdef^^da{\'U} \gdef^^db{\^U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\TH} \gdef^^df{\ss} % \gdef^^e0{\`a} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\~a} \gdef^^e4{\"a} \gdef^^e5{\ringaccent a} \gdef^^e6{\ae} \gdef^^e7{\cedilla c} \gdef^^e8{\`e} \gdef^^e9{\'e} \gdef^^ea{\^e} \gdef^^eb{\"e} \gdef^^ec{\`{\dotless i}} \gdef^^ed{\'{\dotless i}} \gdef^^ee{\^{\dotless i}} \gdef^^ef{\"{\dotless i}} % \gdef^^f0{\dh} \gdef^^f1{\~n} \gdef^^f2{\`o} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\~o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\o} \gdef^^f9{\`u} \gdef^^fa{\'u} \gdef^^fb{\^u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\th} \gdef^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. \def\latninechardefs{% % Encoding is almost identical to Latin1. \latonechardefs % \gdef^^a4{\euro} \gdef^^a6{\v S} \gdef^^a8{\v s} \gdef^^b4{\v Z} \gdef^^b8{\v z} \gdef^^bc{\OE} \gdef^^bd{\oe} \gdef^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\v L} \gdef^^a6{\'S} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\v S} \gdef^^aa{\cedilla S} \gdef^^ab{\v T} \gdef^^ac{\'Z} \gdef^^ad{\-} \gdef^^ae{\v Z} \gdef^^af{\dotaccent Z} % \gdef^^b0{\textdegree} \gdef^^b1{\ogonek{a}} \gdef^^b2{\ogonek{ }} \gdef^^b3{\l} \gdef^^b4{\'{}} \gdef^^b5{\v l} \gdef^^b6{\'s} \gdef^^b7{\v{}} \gdef^^b8{\cedilla\ } \gdef^^b9{\v s} \gdef^^ba{\cedilla s} \gdef^^bb{\v t} \gdef^^bc{\'z} \gdef^^bd{\H{}} \gdef^^be{\v z} \gdef^^bf{\dotaccent z} % \gdef^^c0{\'R} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\u A} \gdef^^c4{\"A} \gdef^^c5{\'L} \gdef^^c6{\'C} \gdef^^c7{\cedilla C} \gdef^^c8{\v C} \gdef^^c9{\'E} \gdef^^ca{\ogonek{E}} \gdef^^cb{\"E} \gdef^^cc{\v E} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\v D} % \gdef^^d0{\DH} \gdef^^d1{\'N} \gdef^^d2{\v N} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\H O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\cedilla T} \gdef^^df{\ss} % \gdef^^e0{\'r} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\u a} \gdef^^e4{\"a} \gdef^^e5{\'l} \gdef^^e6{\'c} \gdef^^e7{\cedilla c} \gdef^^e8{\v c} \gdef^^e9{\'e} \gdef^^ea{\ogonek{e}} \gdef^^eb{\"e} \gdef^^ec{\v e} \gdef^^ed{\'{\dotless{i}}} \gdef^^ee{\^{\dotless{i}}} \gdef^^ef{\v d} % \gdef^^f0{\dh} \gdef^^f1{\'n} \gdef^^f2{\v n} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\H o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\v r} \gdef^^f9{\ringaccent u} \gdef^^fa{\'u} \gdef^^fb{\H u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\cedilla t} \gdef^^ff{\dotaccent{}} } % UTF-8 character definitions. % % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. % \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz \gdef\UTFviiiTwoOctets#1#2{\expandafter \UTFviiiDefined\csname u8:#1\string #2\endcsname} % \gdef\UTFviiiThreeOctets#1#2#3{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} % \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} \gdef\UTFviiiDefined#1{% \ifx #1\relax \message{\linenumber Unicode char \string #1 not defined for Texinfo}% \else \expandafter #1% \fi } \begingroup \catcode`\~13 \catcode`\"12 \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiTwoOctets\string~}} \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiThreeOctets\string~}} \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiFourOctets\string~}} \UTFviiiLoop \endgroup \begingroup \catcode`\"=12 \catcode`\<=12 \catcode`\.=12 \catcode`\,=12 \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 \gdef\DeclareUnicodeCharacter#1#2{% \countUTFz = "#1\relax %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref \def\UTFviiiTwoOctets##1##2{% \csname u8:##1\string ##2\endcsname}% \def\UTFviiiThreeOctets##1##2##3{% \csname u8:##1\string ##2\string ##3\endcsname}% \def\UTFviiiFourOctets##1##2##3##4{% \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% \expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter \gdef\UTFviiiTmp{#2}% \endgroup} \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% \parseUTFviiiB C\UTFviiiTwoOctets.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% \fi\fi\fi } \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 \countUTFy = \countUTFz \multiply\countUTFz by 64 \advance\countUTFx by -\countUTFz \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup \def\utfeightchardefs{% \DeclareUnicodeCharacter{00A0}{\tie} \DeclareUnicodeCharacter{00A1}{\exclamdown} \DeclareUnicodeCharacter{00A3}{\pounds} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} \DeclareUnicodeCharacter{00AA}{\ordf} \DeclareUnicodeCharacter{00AB}{\guillemetleft} \DeclareUnicodeCharacter{00AD}{\-} \DeclareUnicodeCharacter{00AE}{\registeredsymbol} \DeclareUnicodeCharacter{00AF}{\={ }} \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} \DeclareUnicodeCharacter{00B4}{\'{ }} \DeclareUnicodeCharacter{00B8}{\cedilla{ }} \DeclareUnicodeCharacter{00BA}{\ordm} \DeclareUnicodeCharacter{00BB}{\guillemetright} \DeclareUnicodeCharacter{00BF}{\questiondown} \DeclareUnicodeCharacter{00C0}{\`A} \DeclareUnicodeCharacter{00C1}{\'A} \DeclareUnicodeCharacter{00C2}{\^A} \DeclareUnicodeCharacter{00C3}{\~A} \DeclareUnicodeCharacter{00C4}{\"A} \DeclareUnicodeCharacter{00C5}{\AA} \DeclareUnicodeCharacter{00C6}{\AE} \DeclareUnicodeCharacter{00C7}{\cedilla{C}} \DeclareUnicodeCharacter{00C8}{\`E} \DeclareUnicodeCharacter{00C9}{\'E} \DeclareUnicodeCharacter{00CA}{\^E} \DeclareUnicodeCharacter{00CB}{\"E} \DeclareUnicodeCharacter{00CC}{\`I} \DeclareUnicodeCharacter{00CD}{\'I} \DeclareUnicodeCharacter{00CE}{\^I} \DeclareUnicodeCharacter{00CF}{\"I} \DeclareUnicodeCharacter{00D0}{\DH} \DeclareUnicodeCharacter{00D1}{\~N} \DeclareUnicodeCharacter{00D2}{\`O} \DeclareUnicodeCharacter{00D3}{\'O} \DeclareUnicodeCharacter{00D4}{\^O} \DeclareUnicodeCharacter{00D5}{\~O} \DeclareUnicodeCharacter{00D6}{\"O} \DeclareUnicodeCharacter{00D8}{\O} \DeclareUnicodeCharacter{00D9}{\`U} \DeclareUnicodeCharacter{00DA}{\'U} \DeclareUnicodeCharacter{00DB}{\^U} \DeclareUnicodeCharacter{00DC}{\"U} \DeclareUnicodeCharacter{00DD}{\'Y} \DeclareUnicodeCharacter{00DE}{\TH} \DeclareUnicodeCharacter{00DF}{\ss} \DeclareUnicodeCharacter{00E0}{\`a} \DeclareUnicodeCharacter{00E1}{\'a} \DeclareUnicodeCharacter{00E2}{\^a} \DeclareUnicodeCharacter{00E3}{\~a} \DeclareUnicodeCharacter{00E4}{\"a} \DeclareUnicodeCharacter{00E5}{\aa} \DeclareUnicodeCharacter{00E6}{\ae} \DeclareUnicodeCharacter{00E7}{\cedilla{c}} \DeclareUnicodeCharacter{00E8}{\`e} \DeclareUnicodeCharacter{00E9}{\'e} \DeclareUnicodeCharacter{00EA}{\^e} \DeclareUnicodeCharacter{00EB}{\"e} \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} \DeclareUnicodeCharacter{00F0}{\dh} \DeclareUnicodeCharacter{00F1}{\~n} \DeclareUnicodeCharacter{00F2}{\`o} \DeclareUnicodeCharacter{00F3}{\'o} \DeclareUnicodeCharacter{00F4}{\^o} \DeclareUnicodeCharacter{00F5}{\~o} \DeclareUnicodeCharacter{00F6}{\"o} \DeclareUnicodeCharacter{00F8}{\o} \DeclareUnicodeCharacter{00F9}{\`u} \DeclareUnicodeCharacter{00FA}{\'u} \DeclareUnicodeCharacter{00FB}{\^u} \DeclareUnicodeCharacter{00FC}{\"u} \DeclareUnicodeCharacter{00FD}{\'y} \DeclareUnicodeCharacter{00FE}{\th} \DeclareUnicodeCharacter{00FF}{\"y} \DeclareUnicodeCharacter{0100}{\=A} \DeclareUnicodeCharacter{0101}{\=a} \DeclareUnicodeCharacter{0102}{\u{A}} \DeclareUnicodeCharacter{0103}{\u{a}} \DeclareUnicodeCharacter{0104}{\ogonek{A}} \DeclareUnicodeCharacter{0105}{\ogonek{a}} \DeclareUnicodeCharacter{0106}{\'C} \DeclareUnicodeCharacter{0107}{\'c} \DeclareUnicodeCharacter{0108}{\^C} \DeclareUnicodeCharacter{0109}{\^c} \DeclareUnicodeCharacter{0118}{\ogonek{E}} \DeclareUnicodeCharacter{0119}{\ogonek{e}} \DeclareUnicodeCharacter{010A}{\dotaccent{C}} \DeclareUnicodeCharacter{010B}{\dotaccent{c}} \DeclareUnicodeCharacter{010C}{\v{C}} \DeclareUnicodeCharacter{010D}{\v{c}} \DeclareUnicodeCharacter{010E}{\v{D}} \DeclareUnicodeCharacter{0112}{\=E} \DeclareUnicodeCharacter{0113}{\=e} \DeclareUnicodeCharacter{0114}{\u{E}} \DeclareUnicodeCharacter{0115}{\u{e}} \DeclareUnicodeCharacter{0116}{\dotaccent{E}} \DeclareUnicodeCharacter{0117}{\dotaccent{e}} \DeclareUnicodeCharacter{011A}{\v{E}} \DeclareUnicodeCharacter{011B}{\v{e}} \DeclareUnicodeCharacter{011C}{\^G} \DeclareUnicodeCharacter{011D}{\^g} \DeclareUnicodeCharacter{011E}{\u{G}} \DeclareUnicodeCharacter{011F}{\u{g}} \DeclareUnicodeCharacter{0120}{\dotaccent{G}} \DeclareUnicodeCharacter{0121}{\dotaccent{g}} \DeclareUnicodeCharacter{0124}{\^H} \DeclareUnicodeCharacter{0125}{\^h} \DeclareUnicodeCharacter{0128}{\~I} \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} \DeclareUnicodeCharacter{012A}{\=I} \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} \DeclareUnicodeCharacter{012C}{\u{I}} \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} \DeclareUnicodeCharacter{0130}{\dotaccent{I}} \DeclareUnicodeCharacter{0131}{\dotless{i}} \DeclareUnicodeCharacter{0132}{IJ} \DeclareUnicodeCharacter{0133}{ij} \DeclareUnicodeCharacter{0134}{\^J} \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} \DeclareUnicodeCharacter{0139}{\'L} \DeclareUnicodeCharacter{013A}{\'l} \DeclareUnicodeCharacter{0141}{\L} \DeclareUnicodeCharacter{0142}{\l} \DeclareUnicodeCharacter{0143}{\'N} \DeclareUnicodeCharacter{0144}{\'n} \DeclareUnicodeCharacter{0147}{\v{N}} \DeclareUnicodeCharacter{0148}{\v{n}} \DeclareUnicodeCharacter{014C}{\=O} \DeclareUnicodeCharacter{014D}{\=o} \DeclareUnicodeCharacter{014E}{\u{O}} \DeclareUnicodeCharacter{014F}{\u{o}} \DeclareUnicodeCharacter{0150}{\H{O}} \DeclareUnicodeCharacter{0151}{\H{o}} \DeclareUnicodeCharacter{0152}{\OE} \DeclareUnicodeCharacter{0153}{\oe} \DeclareUnicodeCharacter{0154}{\'R} \DeclareUnicodeCharacter{0155}{\'r} \DeclareUnicodeCharacter{0158}{\v{R}} \DeclareUnicodeCharacter{0159}{\v{r}} \DeclareUnicodeCharacter{015A}{\'S} \DeclareUnicodeCharacter{015B}{\'s} \DeclareUnicodeCharacter{015C}{\^S} \DeclareUnicodeCharacter{015D}{\^s} \DeclareUnicodeCharacter{015E}{\cedilla{S}} \DeclareUnicodeCharacter{015F}{\cedilla{s}} \DeclareUnicodeCharacter{0160}{\v{S}} \DeclareUnicodeCharacter{0161}{\v{s}} \DeclareUnicodeCharacter{0162}{\cedilla{t}} \DeclareUnicodeCharacter{0163}{\cedilla{T}} \DeclareUnicodeCharacter{0164}{\v{T}} \DeclareUnicodeCharacter{0168}{\~U} \DeclareUnicodeCharacter{0169}{\~u} \DeclareUnicodeCharacter{016A}{\=U} \DeclareUnicodeCharacter{016B}{\=u} \DeclareUnicodeCharacter{016C}{\u{U}} \DeclareUnicodeCharacter{016D}{\u{u}} \DeclareUnicodeCharacter{016E}{\ringaccent{U}} \DeclareUnicodeCharacter{016F}{\ringaccent{u}} \DeclareUnicodeCharacter{0170}{\H{U}} \DeclareUnicodeCharacter{0171}{\H{u}} \DeclareUnicodeCharacter{0174}{\^W} \DeclareUnicodeCharacter{0175}{\^w} \DeclareUnicodeCharacter{0176}{\^Y} \DeclareUnicodeCharacter{0177}{\^y} \DeclareUnicodeCharacter{0178}{\"Y} \DeclareUnicodeCharacter{0179}{\'Z} \DeclareUnicodeCharacter{017A}{\'z} \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} \DeclareUnicodeCharacter{017C}{\dotaccent{z}} \DeclareUnicodeCharacter{017D}{\v{Z}} \DeclareUnicodeCharacter{017E}{\v{z}} \DeclareUnicodeCharacter{01C4}{D\v{Z}} \DeclareUnicodeCharacter{01C5}{D\v{z}} \DeclareUnicodeCharacter{01C6}{d\v{z}} \DeclareUnicodeCharacter{01C7}{LJ} \DeclareUnicodeCharacter{01C8}{Lj} \DeclareUnicodeCharacter{01C9}{lj} \DeclareUnicodeCharacter{01CA}{NJ} \DeclareUnicodeCharacter{01CB}{Nj} \DeclareUnicodeCharacter{01CC}{nj} \DeclareUnicodeCharacter{01CD}{\v{A}} \DeclareUnicodeCharacter{01CE}{\v{a}} \DeclareUnicodeCharacter{01CF}{\v{I}} \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} \DeclareUnicodeCharacter{01D1}{\v{O}} \DeclareUnicodeCharacter{01D2}{\v{o}} \DeclareUnicodeCharacter{01D3}{\v{U}} \DeclareUnicodeCharacter{01D4}{\v{u}} \DeclareUnicodeCharacter{01E2}{\={\AE}} \DeclareUnicodeCharacter{01E3}{\={\ae}} \DeclareUnicodeCharacter{01E6}{\v{G}} \DeclareUnicodeCharacter{01E7}{\v{g}} \DeclareUnicodeCharacter{01E8}{\v{K}} \DeclareUnicodeCharacter{01E9}{\v{k}} \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} \DeclareUnicodeCharacter{01F1}{DZ} \DeclareUnicodeCharacter{01F2}{Dz} \DeclareUnicodeCharacter{01F3}{dz} \DeclareUnicodeCharacter{01F4}{\'G} \DeclareUnicodeCharacter{01F5}{\'g} \DeclareUnicodeCharacter{01F8}{\`N} \DeclareUnicodeCharacter{01F9}{\`n} \DeclareUnicodeCharacter{01FC}{\'{\AE}} \DeclareUnicodeCharacter{01FD}{\'{\ae}} \DeclareUnicodeCharacter{01FE}{\'{\O}} \DeclareUnicodeCharacter{01FF}{\'{\o}} \DeclareUnicodeCharacter{021E}{\v{H}} \DeclareUnicodeCharacter{021F}{\v{h}} \DeclareUnicodeCharacter{0226}{\dotaccent{A}} \DeclareUnicodeCharacter{0227}{\dotaccent{a}} \DeclareUnicodeCharacter{0228}{\cedilla{E}} \DeclareUnicodeCharacter{0229}{\cedilla{e}} \DeclareUnicodeCharacter{022E}{\dotaccent{O}} \DeclareUnicodeCharacter{022F}{\dotaccent{o}} \DeclareUnicodeCharacter{0232}{\=Y} \DeclareUnicodeCharacter{0233}{\=y} \DeclareUnicodeCharacter{0237}{\dotless{j}} \DeclareUnicodeCharacter{02DB}{\ogonek{ }} \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} \DeclareUnicodeCharacter{1E20}{\=G} \DeclareUnicodeCharacter{1E21}{\=g} \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} \DeclareUnicodeCharacter{1E26}{\"H} \DeclareUnicodeCharacter{1E27}{\"h} \DeclareUnicodeCharacter{1E30}{\'K} \DeclareUnicodeCharacter{1E31}{\'k} \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} \DeclareUnicodeCharacter{1E3E}{\'M} \DeclareUnicodeCharacter{1E3F}{\'m} \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} \DeclareUnicodeCharacter{1E54}{\'P} \DeclareUnicodeCharacter{1E55}{\'p} \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} \DeclareUnicodeCharacter{1E7C}{\~V} \DeclareUnicodeCharacter{1E7D}{\~v} \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} \DeclareUnicodeCharacter{1E80}{\`W} \DeclareUnicodeCharacter{1E81}{\`w} \DeclareUnicodeCharacter{1E82}{\'W} \DeclareUnicodeCharacter{1E83}{\'w} \DeclareUnicodeCharacter{1E84}{\"W} \DeclareUnicodeCharacter{1E85}{\"w} \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} \DeclareUnicodeCharacter{1E8C}{\"X} \DeclareUnicodeCharacter{1E8D}{\"x} \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} \DeclareUnicodeCharacter{1E90}{\^Z} \DeclareUnicodeCharacter{1E91}{\^z} \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} \DeclareUnicodeCharacter{1E97}{\"t} \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} \DeclareUnicodeCharacter{1EBC}{\~E} \DeclareUnicodeCharacter{1EBD}{\~e} \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} \DeclareUnicodeCharacter{1EF2}{\`Y} \DeclareUnicodeCharacter{1EF3}{\`y} \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} \DeclareUnicodeCharacter{1EF8}{\~Y} \DeclareUnicodeCharacter{1EF9}{\~y} \DeclareUnicodeCharacter{2013}{--} \DeclareUnicodeCharacter{2014}{---} \DeclareUnicodeCharacter{2018}{\quoteleft} \DeclareUnicodeCharacter{2019}{\quoteright} \DeclareUnicodeCharacter{201A}{\quotesinglbase} \DeclareUnicodeCharacter{201C}{\quotedblleft} \DeclareUnicodeCharacter{201D}{\quotedblright} \DeclareUnicodeCharacter{201E}{\quotedblbase} \DeclareUnicodeCharacter{2022}{\bullet} \DeclareUnicodeCharacter{2026}{\dots} \DeclareUnicodeCharacter{2039}{\guilsinglleft} \DeclareUnicodeCharacter{203A}{\guilsinglright} \DeclareUnicodeCharacter{20AC}{\euro} \DeclareUnicodeCharacter{2192}{\expansion} \DeclareUnicodeCharacter{21D2}{\result} \DeclareUnicodeCharacter{2212}{\minus} \DeclareUnicodeCharacter{2217}{\point} \DeclareUnicodeCharacter{2261}{\equiv} }% end of \utfeightchardefs % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } % Make non-ASCII characters printable again for compatibility with % existing Texinfo documents that may use them, even without declaring a % document encoding. % \setnonasciicharscatcode \other \message{formatting,} \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be very finicky about underfull hboxes, either. \hbadness = 6666 % Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \pageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \pagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax % if we don't reset these, they will remain at "1 true in" of % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize \advance\dimen2 by \normaloffset % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \def\normaldoublequote{"} \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix \catcode`\+=\other \def\normalplus{+} \catcode`\<=\other \def\normalless{<} \catcode`\>=\other \def\normalgreater{>} \catcode`\^=\other \def\normalcaret{^} \catcode`\_=\other \def\normalunderscore{_} \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def~{{\tt\char126}} \chardef\hat=`\^ \catcode`\^=\active \def^{{\tt \hat}} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def<{{\tt \less}} \chardef \gtr=`\> \catcode`\>=\active \def>{{\tt \gtr}} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% \normalturnoffactive \otherbackslash } \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} % In texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. % The story here is that in math mode, the \char of \backslashcurfont % ends up printing the roman \ from the math symbol font (because \char % in math mode uses the \mathcode, and plain.tex sets % \mathcode`\\="026E). It seems better for @backslashchar{} to always % print a typewriter backslash, hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. % On startup, @fixbackslash assigns: % @let \ = @normalbackslash % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. We switch back and forth between these. @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. % @def@normalturnoffactive{% @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % @gdef@eatinput input texinfo{@fixbackslash} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then % the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These (along with & and #) are made active for url-breaking, so need % active definitions as the normal characters. @def@normaldot{.} @def@normalquest{?} @def@normalslash{/} % These look ok in all fonts, so just make them not special. % @hashchar{} gets its own user-level command, because of #line. @catcode`@& = @other @def@normalamp{&} @catcode`@# = @other @def@normalhash{#} @catcode`@% = @other @def@normalpercent{%} @let @hashchar = @normalhash @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we @c don't make ` and ' active, @code will not get them as active chars. @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active @markupsetuplqdefault @markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore gengetopt-2.22.6/build-aux/compile0000755000175000017500000001615212044745227014004 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-03-05.13; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free # Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: gengetopt-2.22.6/build-aux/missing0000755000175000017500000002415212044745227014024 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: gengetopt-2.22.6/build-aux/depcomp0000755000175000017500000005064312044745227014006 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # A tabulation character. tab=' ' # A newline character. nl=' ' if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form 'foo.o: dependent.h', # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test "$stat" = 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: gengetopt-2.22.6/build-aux/config.guess0000755000175000017500000012743212044745223014746 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gengetopt-2.22.6/Makefile.in0000664000175000017500000010410212046536525012575 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2007 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, see . VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ THANKS TODO build-aux/compile build-aux/config.guess \ build-aux/config.sub build-aux/depcomp build-aux/install-sh \ build-aux/ltmain.sh build-aux/mdate-sh build-aux/missing \ build-aux/texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(gengetoptdocdir)" DATA = $(gengetoptdoc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 -I gl/m4 EXTRA_DIST = configure TODO LICENSE gl/m4/gnulib-cache.m4 SUBDIRS = gl src doc tests gengetoptdoc_DATA = ChangeLog COPYING NEWS THANKS INSTALL README LICENSE all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-gengetoptdocDATA: $(gengetoptdoc_DATA) @$(NORMAL_INSTALL) @list='$(gengetoptdoc_DATA)'; test -n "$(gengetoptdocdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gengetoptdocdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gengetoptdocdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gengetoptdocdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gengetoptdocdir)" || exit $$?; \ done uninstall-gengetoptdocDATA: @$(NORMAL_UNINSTALL) @list='$(gengetoptdoc_DATA)'; test -n "$(gengetoptdocdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(gengetoptdocdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(gengetoptdocdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-gengetoptdocDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-gengetoptdocDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am \ install-gengetoptdocDATA install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-gengetoptdocDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/TODO0000664000175000017500000000513512046537172011225 00000000000000This file is licensed to you under the license specified in the included file `COPYING'. Look there for further details. GENERAL TASKS: * Generate C++ code * Generate Java code The current maintainer is taking patches. See the file `AUTHORS'. Implement synonyms Should - be always interpreted as the standard output Generate code that uses Argp Duplicate options: A @dfn{duplicate option} is an option that, like a multiple option, may be specified more than once, but for which only the last use is significant. The classic example is the @option{-O} switch present in most C compilers: maintainer-mode CLEANING - code duplication in check_option and create_option in gengetopt.cc TESTS generate in the code also a test main with a string containing the test arguments and then in the main, check that the results are as expected. avoid to touch sample1.ggo and sample2.ggo for make check in doc. check whether --show-help correctly handles escaped newlines check also detailed and full help for \\n and text TEXT BUG: section "Section 1" option "str-opt" s "A string option, for a filename" optional string typestr="filename" text " explain more about the string option" section "Section 2" option "int-opt" i "A int option" int optional In this case text will be printed after Section 2 and before int-opt since the text is set in the option during gengetopt_check_option, while it should be set during the parsing: when text is encountered if there's already an option parsed we should set its text_after. But we should be careful not to set the same text after an option and before another one: after setting a text_after we should set current text to 0. And what if the text is after a section? If we had set the current text to 0 there should be no problems. Probably it's better to have "option parts" and distinguishing between standard options, sections, text, modes, etc. This requires some refactoring! But would this work for sections with only hidden options? No I guess. Possible fix found by setting the text in the parser - apply the current_option solution to other options (mode and group) - deal with text coming after a section (check current_section), but this would not work in case there more text occurrences? It should, test it. and reset to 0 parsed_a_section after having parsed an option. - but do this also for modes and groups? Probably we should avoid to check whether the option after a section is hidden: does a section with only hidden options make sense? Yes probably it's better to keep this feature. We do not need libtool gengetopt-2.22.6/INSTALL0000664000175000017500000001717212044745036011570 00000000000000Basic Installation ================== For more information specific to this package, please read the README file. This source code distribution is autoconfiguring and you should be able to compile it and install it without manual interventions such as editing Makefiles, configuration files, and so on. These are generic instructions for people who are not familiar with installing autoconfiguring software. The simplest way to compile this package is to enter the source code main directory and do the following: 1. Configure the source code by typing: % sh ./configure If you're planning to install the package into your home directory or to a location other than `/usr/local' then add the flag `--prefix=PATH' to `configure'. For example, if your home directory is `/home/luser' you can configure the package to install itself there by invoking: % sh ./configure --prefix=/home/luser While running, `configure' prints some messages telling which features is it checking for. 2. Compile the package by typing: % make Running `make' takes a while. If this is a very large package, now is the time to go make some coffee. 3. This package is bundled with self-tests for source-code verification. You can optionally run them after compilation by typing % make check 4. Type `make install' to install the programs and any data files and documentation. Type `make uninstall' to undo the installation. During installation, the following files go to the following directories: Executables -> /prefix/bin Libraries -> /prefix/lib Public header files -> /prefix/include Man pages -> /prefix/man/man? Info files -> /prefix/info Doc files -> /prefix/share/doc/ Share files -> /prefix/share/ where `prefix' is either `/usr/local' or the PATH that you specified in the `--prefix' flag. If any of these directories do not presently exist, they will be created on demand. If you are installing in your home directory make sure that `/home/luser/bin' is in your path. If you're using the bash shell add this line at the end of your .cshrc file: PATH="/home/luser/bin:${PATH}" export PATH If you are using csh or tcsh, then use this line instead: setenv PATH /home/luser/bin:${PATH} By prepending your home directory to the rest of the PATH you can override systemwide installed software with your own custom installation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. Known compilation problems ========================== Alpha OSF/1 4.0 cxx isn't up-to-date enough to build gengetopt, but gcc works fine on that system. Compiler configuration ====================== The `configure' shell script is responsible for choosing and configuring the compiler(s). The following options allow you to specify whether you want to enable or disable various debugging mechanisms: `--enable-warnings' Make the compilers very picky about warnings. Try this whenever you write new code since it may catch a few bugs. This is not active by default because all too often warnings can be too picky and scare the end-user. All programs are compiled with optimization level 2 by default (-O2). Occasionally that confuses the debugger when code is inlined. To disable optimization and enable debugging, set the shell environment variables CFLAGS, CXXFLAGS, FFLAGS to `-g'. On the bash shell, you can do this like this: $ export CFLAGS="-g" $ export CXXFLAGS="-g" $ export FFLAGS="-g" On the tcsh shell, use the `setenv' command instead: % setenv CFLAGS "-g" ...etc... For other shell, please consult your shell's documentation. Similarly, you can increase the optimization level by assigning these variables to "-g -O3". The following options allow you to reconsider the `configure' shell script's choice of Fortran compilers. `--with-f2c' Compile the Fortran code by translating it to C, even if a native Fortran compiler is available. A copy of the f2c translator should be bundled in the distribution. It will be compiled and then used to compile your Fortran code. `--with-g77' Compile the Fortran code with g77 even if a proprietary Fortran compiler is available `--with-f77=F77' Compile the Fortran code with the specified Fortran compiler. Depending on what languages the package uses, some of these options may or may not be available. To see what is available, type: % sh ./configure --help About the configure script ========================== The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. Advanced installation options. ============================== The `configure' script also understands the following more advanced options, to handle situations for which `--prefix' alone is not sufficient. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. gengetopt-2.22.6/COPYING0000664000175000017500000010451212044745036011565 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . gengetopt-2.22.6/gl/0000775000175000017500000000000012046541043011203 500000000000000gengetopt-2.22.6/gl/stddef.in.h0000664000175000017500000000517712044745036013172 00000000000000/* A substitute for POSIX 2008 , for platforms that have issues. Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Eric Blake. */ /* * POSIX 2008 for platforms that have issues. * */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif #if defined __need_wchar_t || defined __need_size_t \ || defined __need_ptrdiff_t || defined __need_NULL \ || defined __need_wint_t /* Special invocation convention inside gcc header files. In particular, gcc provides a version of that blindly redefines NULL even when __need_wint_t was defined, even though wint_t is not normally provided by . Hence, we must remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ # if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t # undef _GL_STDDEF_H # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ # endif #else /* Normal invocation convention. */ # ifndef _GL_STDDEF_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ # ifndef _GL_STDDEF_H # define _GL_STDDEF_H /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ #if @REPLACE_NULL@ # undef NULL # ifdef __cplusplus /* ISO C++ says that the macro NULL must expand to an integer constant expression, hence '((void *) 0)' is not allowed in C++. */ # if __GNUG__ >= 3 /* GNU C++ has a __null macro that behaves like an integer ('int' or 'long') but has the same size as a pointer. Use that, to avoid warnings. */ # define NULL __null # else # define NULL 0L # endif # else # define NULL ((void *) 0) # endif #endif /* Some platforms lack wchar_t. */ #if !@HAVE_WCHAR_T@ # define wchar_t int #endif # endif /* _GL_STDDEF_H */ # endif /* _GL_STDDEF_H */ #endif /* __need_XXX */ gengetopt-2.22.6/gl/Makefile.in0000664000175000017500000012712112046536525013205 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --libtool --macro-prefix=gl getopt strdup VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = gl DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = am_libgnu_la_OBJECTS = dummy.lo libgnu_la_OBJECTS = $(am_libgnu_la_OBJECTS) libgnu_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgnu_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libgnu_la_SOURCES) $(EXTRA_libgnu_la_SOURCES) DIST_SOURCES = $(libgnu_la_SOURCES) $(EXTRA_libgnu_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.5 gnits SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = noinst_LTLIBRARIES = libgnu.la EXTRA_DIST = m4/gnulib-cache.m4 $(top_srcdir)/build-aux/arg-nonnull.h \ $(top_srcdir)/build-aux/c++defs.h getopt.c getopt.in.h \ getopt1.c getopt_int.h stddef.in.h strdup.c string.in.h \ unistd.in.h $(top_srcdir)/build-aux/warn-on-use.h # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDDEF_H) \ string.h unistd.h warn-on-use.h SUFFIXES = MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ c++defs.h c++defs.h-t getopt.h getopt.h-t stddef.h stddef.h-t \ string.h string.h-t unistd.h unistd.h-t warn-on-use.h \ warn-on-use.h-t MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = AM_CFLAGS = libgnu_la_SOURCES = gettext.h dummy.c libgnu_la_LIBADD = $(gl_LTLIBOBJS) libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) EXTRA_libgnu_la_SOURCES = getopt.c getopt1.c strdup.c libgnu_la_LDFLAGS = $(AM_LDFLAGS) ARG_NONNULL_H = arg-nonnull.h CXXDEFS_H = c++defs.h WARN_ON_USE_H = warn-on-use.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits gl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnits gl/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libgnu.la: $(libgnu_la_OBJECTS) $(libgnu_la_DEPENDENCIES) $(EXTRA_libgnu_la_DEPENDENCIES) $(libgnu_la_LINK) $(libgnu_la_OBJECTS) $(libgnu_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ ctags-recursive install install-am install-strip \ tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-noinstLIBRARIES clean-noinstLTLIBRARIES ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am # The arg-nonnull.h that gets inserted into generated .h files is the same as # build-aux/arg-nonnull.h, except that it has the copyright header cut off. arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/GL_ARG_NONNULL/,$$p' \ < $(top_srcdir)/build-aux/arg-nonnull.h \ > $@-t && \ mv $@-t $@ # The c++defs.h that gets inserted into generated .h files is the same as # build-aux/c++defs.h, except that it has the copyright header cut off. c++defs.h: $(top_srcdir)/build-aux/c++defs.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/_GL_CXXDEFS/,$$p' \ < $(top_srcdir)/build-aux/c++defs.h \ > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt.in.h $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. stddef.h: stddef.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ } > $@-t && \ mv $@-t $@ # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ # The warn-on-use.h that gets inserted into generated .h files is the same as # build-aux/warn-on-use.h, except that it has the copyright header cut off. warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/^.ifndef/,$$p' \ < $(top_srcdir)/build-aux/warn-on-use.h \ > $@-t && \ mv $@-t $@ mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/gl/string.in.h0000664000175000017500000011003312044745036013213 00000000000000/* A GNU-like . Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GL_STRING_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ #ifndef _GL_STRING_H #define _GL_STRING_H /* NetBSD 5.0 mis-defines NULL. */ #include /* MirBSD defines mbslen as a macro. */ #if @GNULIB_MBSLEN@ && defined __MirBSD__ # include #endif #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) # define __attribute__(Spec) /* empty */ # endif #endif /* The attribute __pure__ was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else # define _GL_ATTRIBUTE_PURE /* empty */ #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ /* Return the first instance of C within N bytes of S, or NULL. */ #if @GNULIB_MEMCHR@ # if @REPLACE_MEMCHR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define memchr rpl_memchr # endif _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); # else # if ! @HAVE_MEMCHR@ _GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C" { const void * std::memchr (const void *, int, size_t); } extern "C++" { void * std::memchr (void *, int, size_t); } */ _GL_CXXALIAS_SYS_CAST2 (memchr, void *, (void const *__s, int __c, size_t __n), void const *, (void const *__s, int __c, size_t __n)); # endif # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); _GL_CXXALIASWARN1 (memchr, void const *, (void const *__s, int __c, size_t __n)); # else _GL_CXXALIASWARN (memchr); # endif #elif defined GNULIB_POSIXCHECK # undef memchr /* Assume memchr is always declared. */ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " "use gnulib module memchr for portability" ); #endif /* Return the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_MEMMEM@ # if @REPLACE_MEMMEM@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define memmem rpl_memmem # endif _GL_FUNCDECL_RPL (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len)); # else # if ! @HAVE_DECL_MEMMEM@ _GL_FUNCDECL_SYS (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS (memmem, void *, (void const *__haystack, size_t __haystack_len, void const *__needle, size_t __needle_len)); # endif _GL_CXXALIASWARN (memmem); #elif defined GNULIB_POSIXCHECK # undef memmem # if HAVE_RAW_DECL_MEMMEM _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " "use gnulib module memmem-simple for portability, " "and module memmem for speed" ); # endif #endif /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ #if @GNULIB_MEMPCPY@ # if ! @HAVE_MEMPCPY@ _GL_FUNCDECL_SYS (mempcpy, void *, (void *restrict __dest, void const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (mempcpy, void *, (void *restrict __dest, void const *restrict __src, size_t __n)); _GL_CXXALIASWARN (mempcpy); #elif defined GNULIB_POSIXCHECK # undef mempcpy # if HAVE_RAW_DECL_MEMPCPY _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " "use gnulib module mempcpy for portability"); # endif #endif /* Search backwards through a block for a byte (specified as an int). */ #if @GNULIB_MEMRCHR@ # if ! @HAVE_DECL_MEMRCHR@ _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const void * std::memrchr (const void *, int, size_t); } extern "C++" { void * std::memrchr (void *, int, size_t); } */ _GL_CXXALIAS_SYS_CAST2 (memrchr, void *, (void const *, int, size_t), void const *, (void const *, int, size_t)); # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); # else _GL_CXXALIASWARN (memrchr); # endif #elif defined GNULIB_POSIXCHECK # undef memrchr # if HAVE_RAW_DECL_MEMRCHR _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " "use gnulib module memrchr for portability"); # endif #endif /* Find the first occurrence of C in S. More efficient than memchr(S,C,N), at the expense of undefined behavior if C does not occur within N bytes. */ #if @GNULIB_RAWMEMCHR@ # if ! @HAVE_RAWMEMCHR@ _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const void * std::rawmemchr (const void *, int); } extern "C++" { void * std::rawmemchr (void *, int); } */ _GL_CXXALIAS_SYS_CAST2 (rawmemchr, void *, (void const *__s, int __c_in), void const *, (void const *__s, int __c_in)); # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); # else _GL_CXXALIASWARN (rawmemchr); # endif #elif defined GNULIB_POSIXCHECK # undef rawmemchr # if HAVE_RAW_DECL_RAWMEMCHR _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " "use gnulib module rawmemchr for portability"); # endif #endif /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ #if @GNULIB_STPCPY@ # if ! @HAVE_STPCPY@ _GL_FUNCDECL_SYS (stpcpy, char *, (char *restrict __dst, char const *restrict __src) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpcpy, char *, (char *restrict __dst, char const *restrict __src)); _GL_CXXALIASWARN (stpcpy); #elif defined GNULIB_POSIXCHECK # undef stpcpy # if HAVE_RAW_DECL_STPCPY _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " "use gnulib module stpcpy for portability"); # endif #endif /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if @GNULIB_STPNCPY@ # if @REPLACE_STPNCPY@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef stpncpy # define stpncpy rpl_stpncpy # endif _GL_FUNCDECL_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)); # else # if ! @HAVE_STPNCPY@ _GL_FUNCDECL_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)); # endif _GL_CXXALIASWARN (stpncpy); #elif defined GNULIB_POSIXCHECK # undef stpncpy # if HAVE_RAW_DECL_STPNCPY _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " "use gnulib module stpncpy for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strchr /* Assume strchr is always declared. */ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " "in some multibyte locales - " "use mbschr if you care about internationalization"); #endif /* Find the first occurrence of C in S or the final NUL byte. */ #if @GNULIB_STRCHRNUL@ # if ! @HAVE_STRCHRNUL@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * std::strchrnul (const char *, int); } extern "C++" { char * std::strchrnul (char *, int); } */ _GL_CXXALIAS_SYS_CAST2 (strchrnul, char *, (char const *__s, int __c_in), char const *, (char const *__s, int __c_in)); # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); # else _GL_CXXALIASWARN (strchrnul); # endif #elif defined GNULIB_POSIXCHECK # undef strchrnul # if HAVE_RAW_DECL_STRCHRNUL _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " "use gnulib module strchrnul for portability"); # endif #endif /* Duplicate S, returning an identical malloc'd string. */ #if @GNULIB_STRDUP@ # if @REPLACE_STRDUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strdup # define strdup rpl_strdup # endif _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); # else # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup /* strdup exists as a function and as a macro. Get rid of the macro. */ # undef strdup # endif # if !(@HAVE_DECL_STRDUP@ || defined strdup) _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif _GL_CXXALIASWARN (strdup); #elif defined GNULIB_POSIXCHECK # undef strdup # if HAVE_RAW_DECL_STRDUP _GL_WARN_ON_USE (strdup, "strdup is unportable - " "use gnulib module strdup for portability"); # endif #endif /* Append no more than N characters from SRC onto DEST. */ #if @GNULIB_STRNCAT@ # if @REPLACE_STRNCAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strncat # define strncat rpl_strncat # endif _GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); # else _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); # endif _GL_CXXALIASWARN (strncat); #elif defined GNULIB_POSIXCHECK # undef strncat # if HAVE_RAW_DECL_STRNCAT _GL_WARN_ON_USE (strncat, "strncat is unportable - " "use gnulib module strncat for portability"); # endif #endif /* Return a newly allocated copy of at most N bytes of STRING. */ #if @GNULIB_STRNDUP@ # if @REPLACE_STRNDUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strndup # define strndup rpl_strndup # endif _GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); # else # if ! @HAVE_DECL_STRNDUP@ _GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK # undef strndup # if HAVE_RAW_DECL_STRNDUP _GL_WARN_ON_USE (strndup, "strndup is unportable - " "use gnulib module strndup for portability"); # endif #endif /* Find the length (number of bytes) of STRING, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many bytes, return MAXLEN. */ #if @GNULIB_STRNLEN@ # if @REPLACE_STRNLEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strnlen # define strnlen rpl_strnlen # endif _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK # undef strnlen # if HAVE_RAW_DECL_STRNLEN _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " "use gnulib module strnlen for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strcspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strcspn /* Assume strcspn is always declared. */ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " "in multibyte locales - " "use mbscspn if you care about internationalization"); #endif /* Find the first occurrence in S of any character in ACCEPT. */ #if @GNULIB_STRPBRK@ # if ! @HAVE_STRPBRK@ _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif /* On some systems, this function is defined as an overloaded function: extern "C" { const char * strpbrk (const char *, const char *); } extern "C++" { char * strpbrk (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strpbrk, char *, (char const *__s, char const *__accept), const char *, (char const *__s, char const *__accept)); # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); _GL_CXXALIASWARN1 (strpbrk, char const *, (char const *__s, char const *__accept)); # else _GL_CXXALIASWARN (strpbrk); # endif # if defined GNULIB_POSIXCHECK /* strpbrk() assumes the second argument is a list of single-byte characters. Even in this simple case, it does not work with multibyte strings if the locale encoding is GB18030 and one of the characters to be searched is a digit. */ # undef strpbrk _GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings " "in multibyte locales - " "use mbspbrk if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strpbrk # if HAVE_RAW_DECL_STRPBRK _GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - " "use gnulib module strpbrk for portability"); # endif #endif #if defined GNULIB_POSIXCHECK /* strspn() assumes the second argument is a list of single-byte characters. Even in this simple case, it cannot work with multibyte strings. */ # undef strspn /* Assume strspn is always declared. */ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " "in multibyte locales - " "use mbsspn if you care about internationalization"); #endif #if defined GNULIB_POSIXCHECK /* strrchr() does not work with multibyte strings if the locale encoding is GB18030 and the character to be searched is a digit. */ # undef strrchr /* Assume strrchr is always declared. */ _GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings " "in some multibyte locales - " "use mbsrchr if you care about internationalization"); #endif /* Search the next delimiter (char listed in DELIM) starting at *STRINGP. If one is found, overwrite it with a NUL, and advance *STRINGP to point to the next char after it. Otherwise, set *STRINGP to NULL. If *STRINGP was already NULL, nothing happens. Return the old value of *STRINGP. This is a variant of strtok() that is multithread-safe and supports empty fields. Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. Caveat: It doesn't work with multibyte strings unless all of the delimiter characters are ASCII characters < 0x30. See also strtok_r(). */ #if @GNULIB_STRSEP@ # if ! @HAVE_STRSEP@ _GL_FUNCDECL_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strsep, char *, (char **restrict __stringp, char const *restrict __delim)); _GL_CXXALIASWARN (strsep); # if defined GNULIB_POSIXCHECK # undef strsep _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " "in multibyte locales - " "use mbssep if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strsep # if HAVE_RAW_DECL_STRSEP _GL_WARN_ON_USE (strsep, "strsep is unportable - " "use gnulib module strsep for portability"); # endif #endif #if @GNULIB_STRSTR@ # if @REPLACE_STRSTR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strstr rpl_strstr # endif _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); # else /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * strstr (const char *, const char *); } extern "C++" { char * strstr (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strstr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strstr, const char *, (const char *haystack, const char *needle)); # else _GL_CXXALIASWARN (strstr); # endif #elif defined GNULIB_POSIXCHECK /* strstr() does not work with multibyte strings if the locale encoding is different from UTF-8: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strstr /* Assume strstr is always declared. */ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " "work correctly on character strings in most " "multibyte locales - " "use mbsstr if you care about internationalization, " "or use strstr if you care about speed"); #endif /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive comparison. */ #if @GNULIB_STRCASESTR@ # if @REPLACE_STRCASESTR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strcasestr rpl_strcasestr # endif _GL_FUNCDECL_RPL (strcasestr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strcasestr, char *, (const char *haystack, const char *needle)); # else # if ! @HAVE_STRCASESTR@ _GL_FUNCDECL_SYS (strcasestr, char *, (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * strcasestr (const char *, const char *); } extern "C++" { char * strcasestr (char *, const char *); } */ _GL_CXXALIAS_SYS_CAST2 (strcasestr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strcasestr, const char *, (const char *haystack, const char *needle)); # else _GL_CXXALIASWARN (strcasestr); # endif #elif defined GNULIB_POSIXCHECK /* strcasestr() does not work with multibyte strings: It is a glibc extension, and glibc implements it only for unibyte locales. */ # undef strcasestr # if HAVE_RAW_DECL_STRCASESTR _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " "strings in multibyte locales - " "use mbscasestr if you care about " "internationalization, or use c-strcasestr if you want " "a locale independent function"); # endif #endif /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: char s[] = "-abc-=-def"; char *sp; x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" This is a variant of strtok() that is multithread-safe. For the POSIX documentation for this function, see: http://www.opengroup.org/susv3xsh/strtok.html Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. Caveat: It doesn't work with multibyte strings unless all of the delimiter characters are ASCII characters < 0x30. See also strsep(). */ #if @GNULIB_STRTOK_R@ # if @REPLACE_STRTOK_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strtok_r # define strtok_r rpl_strtok_r # endif _GL_FUNCDECL_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # else # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK # undef strtok_r # endif # if ! @HAVE_DECL_STRTOK_R@ _GL_FUNCDECL_SYS (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (strtok_r, char *, (char *restrict s, char const *restrict delim, char **restrict save_ptr)); # endif _GL_CXXALIASWARN (strtok_r); # if defined GNULIB_POSIXCHECK _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " "strings in multibyte locales - " "use mbstok_r if you care about internationalization"); # endif #elif defined GNULIB_POSIXCHECK # undef strtok_r # if HAVE_RAW_DECL_STRTOK_R _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " "use gnulib module strtok_r for portability"); # endif #endif /* The following functions are not specified by POSIX. They are gnulib extensions. */ #if @GNULIB_MBSLEN@ /* Return the number of multibyte characters in the character string STRING. This considers multibyte characters, unlike strlen, which counts bytes. */ # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ # undef mbslen # endif # if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); # else _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); # endif _GL_CXXALIASWARN (mbslen); #endif #if @GNULIB_MBSNLEN@ /* Return the number of multibyte characters in the character string starting at STRING and ending at STRING + LEN. */ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1)); #endif #if @GNULIB_MBSCHR@ /* Locate the first single-byte character C in the character string STRING, and return a pointer to it. Return NULL if C is not found in STRING. Unlike strchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ # if defined __hpux # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); # endif _GL_CXXALIASWARN (mbschr); #endif #if @GNULIB_MBSRCHR@ /* Locate the last single-byte character C in the character string STRING, and return a pointer to it. Return NULL if C is not found in STRING. Unlike strrchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ # if defined __hpux # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); # endif _GL_CXXALIASWARN (mbsrchr); #endif #if @GNULIB_MBSSTR@ /* Find the first occurrence of the character string NEEDLE in the character string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. Unlike strstr(), this function works correctly in multibyte locales with encodings different from UTF-8. */ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASECMP@ /* Compare the character strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function may, in multibyte locales, return 0 for strings of different lengths! Unlike strcasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSNCASECMP@ /* Compare the initial segment of the character string S1 consisting of at most N characters with the initial segment of the character string S2 consisting of at most N characters, ignoring case, returning less than, equal to or greater than zero if the initial segment of S1 is lexicographically less than, equal to or greater than the initial segment of S2. Note: This function may, in multibyte locales, return 0 for initial segments of different lengths! Unlike strncasecmp(), this function works correctly in multibyte locales. But beware that N is not a byte count but a character count! */ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPCASECMP@ /* Compare the initial segment of the character string STRING consisting of at most mbslen (PREFIX) characters with the character string PREFIX, ignoring case. If the two match, return a pointer to the first byte after this prefix in STRING. Otherwise, return NULL. Note: This function may, in multibyte locales, return non-NULL if STRING is of smaller length than PREFIX! Unlike strncasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCASESTR@ /* Find the first occurrence of the character string NEEDLE in the character string HAYSTACK, using case-insensitive comparison. Note: This function may, in multibyte locales, return success even if strlen (haystack) < strlen (needle) ! Unlike strcasestr(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSCSPN@ /* Find the first occurrence in the character string STRING of any character in the character string ACCEPT. Return the number of bytes from the beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strcspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSPBRK@ /* Find the first occurrence in the character string STRING of any character in the character string ACCEPT. Return the pointer to it, or NULL if none exists. Unlike strpbrk(), this function works correctly in multibyte locales. */ # if defined __hpux # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); # else _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); # endif _GL_CXXALIASWARN (mbspbrk); #endif #if @GNULIB_MBSSPN@ /* Find the first occurrence in the character string STRING of any character not in the character string REJECT. Return the number of bytes from the beginning of the string to this occurrence, or to the end of the string if none exists. Unlike strspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSSEP@ /* Search the next delimiter (multibyte character listed in the character string DELIM) starting at the character string *STRINGP. If one is found, overwrite it with a NUL, and advance *STRINGP to point to the next multibyte character after it. Otherwise, set *STRINGP to NULL. If *STRINGP was already NULL, nothing happens. Return the old value of *STRINGP. This is a variant of mbstok_r() that supports empty fields. Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. See also mbstok_r(). */ _GL_EXTERN_C char * mbssep (char **stringp, const char *delim) _GL_ARG_NONNULL ((1, 2)); #endif #if @GNULIB_MBSTOK_R@ /* Parse the character string STRING into tokens separated by characters in the character string DELIM. If STRING is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: char s[] = "-abc-=-def"; char *sp; x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL x = mbstok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" Caveat: It modifies the original string. Caveat: These functions cannot be used on constant strings. Caveat: The identity of the delimiting character is lost. See also mbssep(). */ _GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr) _GL_ARG_NONNULL ((2, 3)); #endif /* Map any int, typically from errno, into an error message. */ #if @GNULIB_STRERROR@ # if @REPLACE_STRERROR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef strerror # define strerror rpl_strerror # endif _GL_FUNCDECL_RPL (strerror, char *, (int)); _GL_CXXALIAS_RPL (strerror, char *, (int)); # else _GL_CXXALIAS_SYS (strerror, char *, (int)); # endif _GL_CXXALIASWARN (strerror); #elif defined GNULIB_POSIXCHECK # undef strerror /* Assume strerror is always declared. */ _GL_WARN_ON_USE (strerror, "strerror is unportable - " "use gnulib module strerror to guarantee non-NULL result"); #endif #if @GNULIB_STRSIGNAL@ # if @REPLACE_STRSIGNAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strsignal rpl_strsignal # endif _GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); _GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); # else # if ! @HAVE_DECL_STRSIGNAL@ _GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); # endif /* Need to cast, because on Cygwin 1.5.x systems, the return type is 'const char *'. */ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); # endif _GL_CXXALIASWARN (strsignal); #elif defined GNULIB_POSIXCHECK # undef strsignal # if HAVE_RAW_DECL_STRSIGNAL _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " "use gnulib module strsignal for portability"); # endif #endif #if @GNULIB_STRVERSCMP@ # if !@HAVE_STRVERSCMP@ _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); _GL_CXXALIASWARN (strverscmp); #elif defined GNULIB_POSIXCHECK # undef strverscmp # if HAVE_RAW_DECL_STRVERSCMP _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " "use gnulib module strverscmp for portability"); # endif #endif #endif /* _GL_STRING_H */ #endif /* _GL_STRING_H */ gengetopt-2.22.6/gl/strdup.c0000664000175000017500000000262112044745036012617 00000000000000/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBC # include #endif /* Get specification. */ #include #include #undef __strdup #ifdef _LIBC # undef strdup #endif #ifndef weak_alias # define __strdup strdup #endif /* Duplicate S, returning an identical malloc'd string. */ char * __strdup (const char *s) { size_t len = strlen (s) + 1; void *new = malloc (len); if (new == NULL) return NULL; return (char *) memcpy (new, s, len); } #ifdef libc_hidden_def libc_hidden_def (__strdup) #endif #ifdef weak_alias weak_alias (__strdup, strdup) #endif gengetopt-2.22.6/gl/getopt_int.h0000664000175000017500000001174312044745036013464 00000000000000/* Internal declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 #include extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ enum __ord { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER }; /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* See __ord above. */ enum __ord __ordering; /* If the POSIXLY_CORRECT environment variable is set or getopt was called. */ int __posixly_correct; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; # endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, struct _getopt_data *__data, int __posixly_correct); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */ gengetopt-2.22.6/gl/getopt1.c0000664000175000017500000001062712044745036012666 00000000000000/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifdef _LIBC # include #else # include # include "getopt.h" #endif #include "getopt_int.h" #include /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 0, d, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d, 0); } #ifdef TEST #include int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static const struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ gengetopt-2.22.6/gl/dummy.c0000664000175000017500000000325512044745036012435 00000000000000/* A dummy file, to prevent empty libraries from breaking builds. Copyright (C) 2004, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* Some systems, reportedly OpenBSD and Mac OS X, refuse to create libraries without any object files. You might get an error like: > ar cru .libs/libgl.a > ar: no archive members specified Compiling this file, and adding its object file to the library, will prevent the library from being empty. */ /* Some systems, such as Solaris with cc 5.0, refuse to work with libraries that don't export any symbol. You might get an error like: > cc ... libgnu.a > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a Compiling this file, and adding its object file to the library, will prevent the library from exporting no symbols. */ #ifdef __sun /* This declaration ensures that the library will export at least 1 symbol. */ int gl_dummy_symbol; #else /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; #endif gengetopt-2.22.6/gl/getopt.in.h0000664000175000017500000002124712044745036013217 00000000000000/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _GL_GETOPT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif /* The include_next requires a split double-inclusion guard. We must also inform the replacement unistd.h to not recursively use ; our definitions will be present soon enough. */ #if @HAVE_GETOPT_H@ # define _GL_SYSTEM_GETOPT # @INCLUDE_NEXT@ @NEXT_GETOPT_H@ # undef _GL_SYSTEM_GETOPT #endif #ifndef _GL_GETOPT_H #ifndef __need_getopt # define _GL_GETOPT_H 1 #endif /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in this header. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file (if the system had , we have already included it). Then systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #if defined __GETOPT_PREFIX && !defined __need_getopt # if !@HAVE_GETOPT_H@ # include # include # include # endif # undef __need_getopt # undef getopt # undef getopt_long # undef getopt_long_only # undef optarg # undef opterr # undef optind # undef optopt # undef option # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # define getopt __GETOPT_ID (getopt) # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) # define optarg __GETOPT_ID (optarg) # define opterr __GETOPT_ID (opterr) # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) # define option __GETOPT_ID (option) # define _getopt_internal __GETOPT_ID (getopt_internal) #endif /* Standalone applications get correct prototypes for getopt_long and getopt_long_only; they declare "char **argv". libc uses prototypes with "char *const *argv" that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1). This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', but it caused redefinition warnings if both unistd.h and getopt.h were included, since unistd.h includes getopt.h having previously defined __need_getopt. The only place where __getopt_argv_const is used is in definitions of getopt_long and getopt_long_only below, but these are visible only if __need_getopt is not defined, so it is quite safe to rewrite the conditional as follows: */ #if !defined __need_getopt # if defined __GETOPT_PREFIX # define __getopt_argv_const /* empty */ # else # define __getopt_argv_const const # endif #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif /* The definition of _GL_ARG_NONNULL is copied here. */ #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW _GL_ARG_NONNULL ((2, 3)); #ifndef __need_getopt extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW _GL_ARG_NONNULL ((2, 3)); extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW _GL_ARG_NONNULL ((2, 3)); #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ #endif /* getopt.h */ gengetopt-2.22.6/gl/Makefile.am0000664000175000017500000004103512044745036013170 00000000000000## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. # Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --libtool --macro-prefix=gl getopt strdup AUTOMAKE_OPTIONS = 1.5 gnits SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = noinst_LTLIBRARIES = EXTRA_DIST = BUILT_SOURCES = SUFFIXES = MOSTLYCLEANFILES = core *.stackdump MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = EXTRA_DIST += m4/gnulib-cache.m4 AM_CPPFLAGS = AM_CFLAGS = noinst_LTLIBRARIES += libgnu.la libgnu_la_SOURCES = libgnu_la_LIBADD = $(gl_LTLIBOBJS) libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) EXTRA_libgnu_la_SOURCES = libgnu_la_LDFLAGS = $(AM_LDFLAGS) ## begin gnulib module arg-nonnull # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. BUILT_SOURCES += arg-nonnull.h # The arg-nonnull.h that gets inserted into generated .h files is the same as # build-aux/arg-nonnull.h, except that it has the copyright header cut off. arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/GL_ARG_NONNULL/,$$p' \ < $(top_srcdir)/build-aux/arg-nonnull.h \ > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t ARG_NONNULL_H=arg-nonnull.h EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h ## end gnulib module arg-nonnull ## begin gnulib module c++defs # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. BUILT_SOURCES += c++defs.h # The c++defs.h that gets inserted into generated .h files is the same as # build-aux/c++defs.h, except that it has the copyright header cut off. c++defs.h: $(top_srcdir)/build-aux/c++defs.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/_GL_CXXDEFS/,$$p' \ < $(top_srcdir)/build-aux/c++defs.h \ > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += c++defs.h c++defs.h-t CXXDEFS_H=c++defs.h EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h ## end gnulib module c++defs ## begin gnulib module getopt-posix BUILT_SOURCES += $(GETOPT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt.in.h $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ } > $@-t && \ mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h EXTRA_libgnu_la_SOURCES += getopt.c getopt1.c ## end gnulib module getopt-posix ## begin gnulib module gettext-h libgnu_la_SOURCES += gettext.h ## end gnulib module gettext-h ## begin gnulib module stddef BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. stddef.h: stddef.in.h $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h ## end gnulib module stddef ## begin gnulib module strdup EXTRA_DIST += strdup.c EXTRA_libgnu_la_SOURCES += strdup.c ## end gnulib module strdup ## begin gnulib module string BUILT_SOURCES += string.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ < $(srcdir)/string.in.h; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += string.h string.h-t EXTRA_DIST += string.in.h ## end gnulib module string ## begin gnulib module unistd BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t EXTRA_DIST += unistd.in.h ## end gnulib module unistd ## begin gnulib module warn-on-use BUILT_SOURCES += warn-on-use.h # The warn-on-use.h that gets inserted into generated .h files is the same as # build-aux/warn-on-use.h, except that it has the copyright header cut off. warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/^.ifndef/,$$p' \ < $(top_srcdir)/build-aux/warn-on-use.h \ > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t WARN_ON_USE_H=warn-on-use.h EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h ## end gnulib module warn-on-use ## begin gnulib module dummy libgnu_la_SOURCES += dummy.c ## end gnulib module dummy mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done; \ : gengetopt-2.22.6/gl/getopt.c0000664000175000017500000011447712044745036012615 00000000000000/* Getopt for GNU. NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _LIBC # include #endif #include "getopt.h" #include #include #include #include #ifdef _LIBC # include #else # include "gettext.h" # define _(msgid) gettext (msgid) #endif #if defined _LIBC && defined USE_IN_LIBIO # include #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Using `getopt' or setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt_int.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; #if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV extern char *getenv (); #endif #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (d->__nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv, struct _getopt_data *d) { int bottom = d->__first_nonopt; int middle = d->__last_nonopt; int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, d->__nonoption_flags_max_len), '\0', top + 1 - d->__nonoption_flags_max_len); d->__nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->__first_nonopt += (d->optind - d->__last_nonopt); d->__last_nonopt = d->optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (int argc _GL_UNUSED, char **argv _GL_UNUSED, const char *optstring, struct _getopt_data *d, int posixly_correct) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ d->__first_nonopt = d->__last_nonopt = d->optind; d->__nextchar = NULL; d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { d->__ordering = REQUIRE_ORDER; ++optstring; } else if (d->__posixly_correct) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv) { if (d->__nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') d->__nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = d->__nonoption_flags_max_len = strlen (orig_str); if (d->__nonoption_flags_max_len < argc) d->__nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (d->__nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) d->__nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', d->__nonoption_flags_max_len - len); } } d->__nonoption_flags_len = d->__nonoption_flags_max_len; } else d->__nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, struct _getopt_data *d, int posixly_correct) { int print_errors = d->opterr; if (argc < 1) return -1; d->optarg = NULL; if (d->optind == 0 || !d->__initialized) { if (d->optind == 0) d->optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring, d, posixly_correct); d->__initialized = 1; } else if (optstring[0] == '-' || optstring[0] == '+') optstring++; if (optstring[0] == ':') print_errors = 0; /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ || (d->optind < d->__nonoption_flags_len \ && __getopt_nonoption_flags[d->optind] == '1')) #else # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') #endif if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__last_nonopt != d->optind) d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (d->optind < argc && NONOPTION_P) d->optind++; d->__last_nonopt = d->optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) { d->optind++; if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__first_nonopt == d->__last_nonopt) d->__first_nonopt = d->optind; d->__last_nonopt = argc; d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (d->__first_nonopt != d->__last_nonopt) d->optind = d->__first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (d->__ordering == REQUIRE_ORDER) return -1; d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ d->__nextchar = (argv[d->optind] + 1 + (longopts != NULL && argv[d->optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[d->optind][1] == '-' || (long_only && (argv[d->optind][2] || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option '%s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; d->optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option '--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option '%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option '--%s' requires an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option '--%s' requires an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[d->optind][1] == '-' || strchr (optstring, *d->__nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option '--%s'\n"), argv[0], d->__nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar = (char *) ""; d->optind++; d->optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *d->__nextchar++; const char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; if (temp == NULL || c == ':' || c == ';') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); #endif #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option requires an argument -- '%c'\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- '%c'\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `d->optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), argv[0], d->optarg) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option '-W %s' is ambiguous\n"), argv[0], d->optarg); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option '-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("\ %s: option '-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option '-W %s' requires an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("\ %s: option '-W %s' requires an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); return optstring[0] == ':' ? ':' : '?'; } } else d->optarg = NULL; d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } d->__nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; d->optind++; } else d->optarg = NULL; d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option requires an argument -- '%c'\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- '%c'\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; } } return c; } } int _getopt_internal (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, longind, long_only, &getopt_data, posixly_correct); optind = getopt_data.optind; optarg = getopt_data.optarg; optopt = getopt_data.optopt; return result; } /* glibc gets a LSB-compliant getopt. Standalone applications get a POSIX-compliant getopt. */ #if _LIBC enum { POSIXLY_CORRECT = 0 }; #else enum { POSIXLY_CORRECT = 1 }; #endif int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, (char **) argv, optstring, (const struct option *) 0, (int *) 0, 0, POSIXLY_CORRECT); } #ifdef _LIBC int __posix_getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0, 1); } #endif #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value '%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ gengetopt-2.22.6/gl/m4/0000775000175000017500000000000012046541043011523 500000000000000gengetopt-2.22.6/gl/m4/gnulib-cache.m40000664000175000017500000000235212044745036014236 00000000000000# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # # This file represents the specification of how gnulib-tool is used. # It acts as a cache: It is written and read by gnulib-tool. # In projects that use version control, this file is meant to be put under # version control, like the configure.ac and various Makefile.am files. # Specification in the form of a command-line invocation: # gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --libtool --macro-prefix=gl getopt strdup # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ getopt strdup ]) gl_AVOID([]) gl_SOURCE_BASE([gl]) gl_M4_BASE([gl/m4]) gl_PO_BASE([]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libgnu]) gl_MAKEFILE_NAME([]) gl_LIBTOOL gl_MACRO_PREFIX([gl]) gl_PO_DOMAIN([]) gengetopt-2.22.6/gl/m4/unistd_h.m40000664000175000017500000001646112044745036013540 00000000000000# unistd_h.m4 serial 46 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson, Bruno Haible. AC_DEFUN([gl_UNISTD_H], [ dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) AC_CHECK_HEADERS_ONCE([unistd.h]) if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include /* Some systems declare various items in the wrong headers. */ #ifndef __GLIBC__ # include # include # include # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # include # endif #endif ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell lchown link linkat lseek pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) ]) gengetopt-2.22.6/gl/m4/string_h.m40000664000175000017500000001177212044745036013540 00000000000000# Configure a GNU-like replacement for . # Copyright (C) 2007-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 17 # Written by Paul Eggert. AC_DEFUN([gl_HEADER_STRING_H], [ dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_HEADER_STRING_H_BODY]) ]) AC_DEFUN([gl_HEADER_STRING_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], [ GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) gengetopt-2.22.6/gl/m4/wchar_t.m40000664000175000017500000000146212044745036013345 00000000000000# wchar_t.m4 serial 4 (gettext-0.18.2) dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Test whether has the 'wchar_t' type. dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include wchar_t foo = (wchar_t)'\0';]], [[]])], [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) fi ]) gengetopt-2.22.6/gl/m4/gnulib-comp.m40000664000175000017500000002033212044745036014127 00000000000000# DO NOT EDIT! GENERATED AUTOMATICALLY! # Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. # # This file represents the compiled summary of the specification in # gnulib-cache.m4. It lists the computed macro invocations that need # to be invoked from configure.ac. # In projects that use version control, this file can be treated like # other built files. # This macro should be invoked from ./configure.ac, in the section # "Checks for programs", right after AC_PROG_CC, and certainly before # any checks for libraries, header files, types and library functions. AC_DEFUN([gl_EARLY], [ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) # Code from module arg-nonnull: # Code from module c++defs: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module getopt: # Code from module getopt-gnu: # Code from module getopt-posix: # Code from module gettext-h: # Code from module include_next: # Code from module stddef: # Code from module strdup: # Code from module string: # Code from module unistd: # Code from module warn-on-use: ]) # This macro should be invoked from ./configure.ac, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) gl_cond_libtool=true gl_m4_base='gl/m4' m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) m4_pushdef([gl_LIBSOURCES_LIST], []) m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='gl' # Code from module arg-nonnull: # Code from module c++defs: # Code from module extensions: # Code from module getopt: # Code from module getopt-gnu: gl_FUNC_GETOPT_GNU gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) # Code from module getopt-posix: gl_FUNC_GETOPT_POSIX # Code from module gettext-h: AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) # Code from module include_next: # Code from module stddef: gl_STDDEF_H # Code from module strdup: gl_FUNC_STRDUP gl_STRING_MODULE_INDICATOR([strdup]) # Code from module string: gl_HEADER_STRING_H # Code from module unistd: gl_UNISTD_H # Code from module warn-on-use: # Code from module dummy: # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || for gl_file in ]gl_LIBSOURCES_LIST[ ; do if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 exit 1 fi done])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) m4_popdef([gl_LIBSOURCES_DIR]) m4_popdef([gl_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) AC_CONFIG_COMMANDS_PRE([ gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done fi AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ]) gltests_libdeps= gltests_ltlibdeps= m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) m4_pushdef([gltests_LIBSOURCES_LIST], []) m4_pushdef([gltests_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='tests' changequote(,)dnl gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS changequote([, ])dnl AC_SUBST([gltests_WITNESS]) gl_module_indicator_condition=$gltests_WITNESS m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || for gl_file in ]gltests_LIBSOURCES_LIST[ ; do if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 exit 1 fi done])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) m4_popdef([gltests_LIBSOURCES_DIR]) m4_popdef([gltests_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) AC_CONFIG_COMMANDS_PRE([ gltests_libobjs= gltests_ltlibobjs= if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done fi AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ]) ]) # Like AC_LIBOBJ, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_LIBOBJ], [ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gl_REPLACE_FUNCS], [ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) ]) # Like AC_LIBSOURCES, except the directory where the source file is # expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gl_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ m4_define([gl_LIBSOURCES_DIR], [gl]) m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) # Like AC_LIBOBJ, except that the module name goes # into gltests_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gltests_LIBOBJ], [ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gltests_LIBOBJS instead of into LIBOBJS. AC_DEFUN([gltests_REPLACE_FUNCS], [ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) ]) # Like AC_LIBSOURCES, except the directory where the source file is # expected is derived from the gnulib-tool parameterization, # and alloca is special cased (for the alloca-opt module). # We could also entirely rely on EXTRA_lib..._SOURCES. AC_DEFUN([gltests_LIBSOURCES], [ m4_foreach([_gl_NAME], [$1], [ m4_if(_gl_NAME, [alloca.c], [], [ m4_define([gltests_LIBSOURCES_DIR], [tests]) m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ]) ]) ]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ build-aux/arg-nonnull.h build-aux/c++defs.h build-aux/warn-on-use.h lib/dummy.c lib/getopt.c lib/getopt.in.h lib/getopt1.c lib/getopt_int.h lib/gettext.h lib/stddef.in.h lib/strdup.c lib/string.in.h lib/unistd.in.h m4/00gnulib.m4 m4/extensions.m4 m4/getopt.m4 m4/gnulib-common.m4 m4/include_next.m4 m4/onceonly.m4 m4/stddef_h.m4 m4/strdup.m4 m4/string_h.m4 m4/unistd_h.m4 m4/warn-on-use.m4 m4/wchar_t.m4 ]) gengetopt-2.22.6/gl/m4/getopt.m40000664000175000017500000002251612044745036013223 00000000000000# getopt.m4 serial 29 dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Request a POSIX compliant getopt function. AC_DEFUN([gl_FUNC_GETOPT_POSIX], [ m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_GETOPT_IFELSE([ gl_REPLACE_GETOPT ], []) ]) # Request a POSIX compliant getopt function with GNU extensions (such as # options with optional arguments) and the functions getopt_long, # getopt_long_only. AC_DEFUN([gl_FUNC_GETOPT_GNU], [ m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) ]) # Request the gnulib implementation of the getopt functions unconditionally. # argp.m4 uses this. AC_DEFUN([gl_REPLACE_GETOPT], [ dnl Arrange for getopt.h to be created. gl_GETOPT_SUBSTITUTE_HEADER dnl Arrange for unistd.h to include getopt.h. GNULIB_UNISTD_H_GETOPT=1 dnl Arrange to compile the getopt implementation. AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) gl_PREREQ_GETOPT ]) # emacs' configure.in uses this. AC_DEFUN([gl_GETOPT_IFELSE], [ AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) AS_IF([test -n "$gl_replace_getopt"], [$1], [$2]) ]) # Determine whether to replace the entire getopt facility. AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade Solaris to declare optarg, optind, opterr, optopt. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) gl_CHECK_NEXT_HEADERS([getopt.h]) AC_CHECK_HEADERS_ONCE([getopt.h]) if test $ac_cv_header_getopt_h = yes; then HAVE_GETOPT_H=1 else HAVE_GETOPT_H=0 fi AC_SUBST([HAVE_GETOPT_H]) gl_replace_getopt= dnl Test whether is available. if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes]) fi dnl Test whether the function getopt_long is available. if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) fi dnl BSD getopt_long uses an incompatible method to reset option processing. dnl Existence of the variable, in and of itself, is not a reason to replace dnl getopt, but knowledge of the variable is needed to determine how to dnl reset and whether a reset reparses the environment. dnl Solaris supports neither optreset nor optind=0, but keeps no state that dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip. if test -z "$gl_replace_getopt"; then AC_CHECK_DECLS([optreset], [], [AC_CHECK_DECLS([getopt_clip], [], [], [[#include ]]) ], [[#include ]]) fi dnl mingw's getopt (in libmingwex.a) does weird things when the options dnl strings starts with '+' and it's not the first call. Some internal state dnl is left over from earlier calls, and neither setting optind = 0 nor dnl setting optreset = 1 get rid of this internal state. dnl POSIX is silent on optind vs. optreset, so we allow either behavior. dnl POSIX 2008 does not specify leading '+' behavior, but see dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on dnl the next version of POSIX. For now, we only guarantee leading '+' dnl behavior with getopt-gnu. if test -z "$gl_replace_getopt"; then AC_CACHE_CHECK([whether getopt is POSIX compatible], [gl_cv_func_getopt_posix], [ dnl This test fails on mingw and succeeds on many other platforms. AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include #if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP # define OPTIND_MIN 0 #else # define OPTIND_MIN 1 #endif int main () { { int argc = 0; char *argv[10]; int c; argv[argc++] = "program"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; c = getopt (argc, argv, "ab"); if (!(c == 'a')) return 1; c = getopt (argc, argv, "ab"); if (!(c == -1)) return 2; if (!(optind == 2)) return 3; } /* Some internal state exists at this point. */ { int argc = 0; char *argv[10]; int c; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; c = getopt (argc, argv, "+abp:q:"); if (!(c == -1)) return 4; if (!(strcmp (argv[0], "program") == 0)) return 5; if (!(strcmp (argv[1], "donald") == 0)) return 6; if (!(strcmp (argv[2], "-p") == 0)) return 7; if (!(strcmp (argv[3], "billy") == 0)) return 8; if (!(strcmp (argv[4], "duck") == 0)) return 9; if (!(strcmp (argv[5], "-a") == 0)) return 10; if (!(strcmp (argv[6], "bar") == 0)) return 11; if (!(optind == 1)) return 12; } /* Detect MacOS 10.5, AIX 7.1 bug. */ { char *argv[3] = { "program", "-ab", NULL }; optind = OPTIND_MIN; opterr = 0; if (getopt (2, argv, "ab:") != 'a') return 13; if (getopt (2, argv, "ab:") != '?') return 14; if (optopt != 'b') return 15; if (optind != 2) return 16; } return 0; } ]])], [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no], [case "$host_os" in mingw*) gl_cv_func_getopt_posix="guessing no";; darwin* | aix*) gl_cv_func_getopt_posix="guessing no";; *) gl_cv_func_getopt_posix="guessing yes";; esac ]) ]) case "$gl_cv_func_getopt_posix" in *no) gl_replace_getopt=yes ;; esac fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu], [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the # optstring is necessary for programs like m4 that have POSIX-mandated # semantics for supporting options interspersed with files. # Also, since getopt_long is a GNU extension, we require optind=0. gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes} POSIXLY_CORRECT=1 export POSIXLY_CORRECT AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include #include #include ]], [[ /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { char *myargv[3]; myargv[0] = "conftest"; myargv[1] = "-+"; myargv[2] = 0; opterr = 0; if (getopt (2, myargv, "+a") != '?') return 1; } /* This code succeeds on glibc 2.8, mingw, and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { char *argv[] = { "program", "-p", "foo", "bar", NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') return 2; if (optarg != NULL) return 3; if (getopt (4, argv, "p::") != -1) return 4; if (optind != 2) return 5; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { char *argv[] = { "program", "foo", "-p", NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) return 6; if (getopt (3, argv, "-p") != 'p') return 7; } /* This code fails on glibc 2.11. */ { char *argv[] = { "program", "-b", "-a", NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') return 8; if (getopt (3, argv, "+:a:b") != ':') return 9; } return 0; ]])], [gl_cv_func_getopt_gnu=yes], [gl_cv_func_getopt_gnu=no], [dnl Cross compiling. Guess based on host and declarations. case $host_os:$ac_cv_have_decl_optreset in *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; *:yes) gl_cv_func_getopt_gnu=no;; *) gl_cv_func_getopt_gnu=yes;; esac ]) if test "$gl_had_POSIXLY_CORRECT" != yes; then AS_UNSET([POSIXLY_CORRECT]) fi ]) if test "$gl_cv_func_getopt_gnu" = "no"; then gl_replace_getopt=yes fi fi ]) # emacs' configure.in uses this. AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ GETOPT_H=getopt.h AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables should be used.]) AC_SUBST([GETOPT_H]) ]) # Prerequisites of lib/getopt*. # emacs' configure.in uses this. AC_DEFUN([gl_PREREQ_GETOPT], [ AC_CHECK_DECLS_ONCE([getenv]) ]) gengetopt-2.22.6/gl/m4/00gnulib.m40000664000175000017500000000252212044745036013334 00000000000000# 00gnulib.m4 serial 2 dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This file must be named something that sorts before all other dnl gnulib-provided .m4 files. It is needed until such time as we can dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. # AC_DEFUN_ONCE([NAME], VALUE) # ---------------------------- # Define NAME to expand to VALUE on the first use (whether by direct # expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. # Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This # definition is slower than the version in Autoconf 2.64, because it # can only use interfaces that existed since 2.59; but it achieves the # same effect. Quoting is necessary to avoid confusing Automake. m4_version_prereq([2.63.263], [], [m4_define([AC][_DEFUN_ONCE], [AC][_DEFUN([$1], [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl [AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) # gl_00GNULIB # ----------- # Witness macro that this file has been included. Needed to force # Automake to include this file prior to all other gnulib .m4 files. AC_DEFUN([gl_00GNULIB]) gengetopt-2.22.6/gl/m4/include_next.m40000664000175000017500000001761412044745036014405 00000000000000# include_next.m4 serial 15 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Derek Price. dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. dnl dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to dnl 'include' otherwise. dnl dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler dnl supports it in the special case that it is the first include directive in dnl the given file, or to 'include' otherwise. dnl dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, dnl so as to avoid GCC warnings when the gcc option -pedantic is used. dnl '#pragma GCC system_header' has the same effect as if the file was found dnl through the include search path specified with '-isystem' options (as dnl opposed to the search path specified with '-I' options). Namely, gcc dnl does not warn about some things, and on some systems (Solaris and Interix) dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead dnl of plain '__STDC__'. AC_DEFUN([gl_INCLUDE_NEXT], [ AC_LANG_PREPROC_REQUIRE() AC_CACHE_CHECK([whether the preprocessor supports include_next], [gl_cv_have_include_next], [rm -rf conftestd1a conftestd1b conftestd2 mkdir conftestd1a conftestd1b conftestd2 dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on dnl AIX 6.1 support include_next when used as first preprocessor directive dnl in a file, but not when preceded by another include directive. Check dnl for this bug by including . dnl Additionally, with this same compiler, include_next is a no-op when dnl used in a header file that was included by specifying its absolute dnl file name. Despite these two bugs, include_next is used in the dnl compiler's . By virtue of the second bug, we need to use dnl include_next as well in this case. cat < conftestd1a/conftest.h #define DEFINED_IN_CONFTESTD1 #include_next #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat < conftestd1b/conftest.h #define DEFINED_IN_CONFTESTD1 #include #include_next #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat < conftestd2/conftest.h #ifndef DEFINED_IN_CONFTESTD1 #error "include_next test doesn't work" #endif #define DEFINED_IN_CONFTESTD2 EOF gl_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" dnl We intentionally avoid using AC_LANG_SOURCE here. AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], [gl_cv_have_include_next=yes], [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], [gl_cv_have_include_next=buggy], [gl_cv_have_include_next=no]) ]) CPPFLAGS="$gl_save_CPPFLAGS" rm -rf conftestd1a conftestd1b conftestd2 ]) PRAGMA_SYSTEM_HEADER= if test $gl_cv_have_include_next = yes; then INCLUDE_NEXT=include_next INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next if test -n "$GCC"; then PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' fi else if test $gl_cv_have_include_next = buggy; then INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next else INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include fi fi AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) ]) # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) # ------------------------------------------ # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be # ''; otherwise define it to be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # Also, if #include_next works as first preprocessing directive in a file, # define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be ''; otherwise define it to # be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # That way, a header file with the following line: # #@INCLUDE_NEXT@ @NEXT_FOO_H@ # or # #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ # behaves (after sed substitution) as if it contained # #include_next # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". # Use `""', not `<>', so that the /// cannot be confused with a C99 comment. # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_HEADERS_ONCE([$1]) m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], m4_defn([gl_next_header]), [AS_VAR_PUSHDEF([gl_header_exists], [ac_cv_header_]m4_defn([gl_HEADER_NAME])) if test AS_VAR_GET(gl_header_exists) = yes; then AC_LANG_CONFTEST( [AC_LANG_SOURCE( [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] )]) dnl AIX "xlc -E" and "cc -E" omit #line directives for header files dnl that contain only a #include of other header files and no dnl non-comment tokens of their own. This leads to a failure to dnl detect the absolute name of , , dnl and others. The workaround is to force preservation of comments dnl through option -C. This ensures all necessary #line directives dnl are present. GCC supports option -C as well. case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac dnl eval is necessary to expand gl_absname_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl so use subshell. AS_VAR_SET([gl_next_header], ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# s#^/[^/]#//&# p q }'`'"']) else AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) fi AS_VAR_POPDEF([gl_header_exists])]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), [AS_VAR_GET([gl_next_header])]) if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'gl_HEADER_NAME'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) fi AC_SUBST( AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), [$gl_next_as_first_directive]) AS_VAR_POPDEF([gl_next_header])]) ]) # Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; # this fallback is safe for all earlier autoconf versions. m4_define_default([AC_LANG_DEFINES_PROVIDED]) gengetopt-2.22.6/gl/m4/onceonly.m40000664000175000017500000000754612044745036013555 00000000000000# onceonly.m4 serial 7 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation, dnl Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl This file defines some "once only" variants of standard autoconf macros. dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL dnl The advantage is that the check for each of the headers/functions/decls dnl will be put only once into the 'configure' file. It keeps the size of dnl the 'configure' file down, and avoids redundant output when 'configure' dnl is run. dnl The drawback is that the checks cannot be conditionalized. If you write dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to dnl empty, and the check will be inserted before the body of the AC_DEFUNed dnl function. dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested dnl headers at once, thus reducing the size of 'configure'. It is known to work dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. dnl Autoconf version 2.59 plus gnulib is required; this file is not needed dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first dnl argument! AC_PREREQ([2.59]) # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ : m4_foreach_w([gl_HEADER_NAME], [$1], [ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, [./-], [___])), [ m4_divert_text([INIT_PREPARE], [gl_header_list="$gl_header_list gl_HEADER_NAME"]) gl_HEADERS_EXPANSION AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) ]) AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME, [./-], [___]))) ]) ]) m4_define([gl_HEADERS_EXPANSION], [ m4_divert_text([DEFAULTS], [gl_header_list=]) AC_CHECK_HEADERS([$gl_header_list]) m4_define([gl_HEADERS_EXPANSION], []) ]) # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of # AC_CHECK_FUNCS(FUNC1 FUNC2 ...). AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ : m4_foreach_w([gl_FUNC_NAME], [$1], [ AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ m4_divert_text([INIT_PREPARE], [gl_func_list="$gl_func_list gl_FUNC_NAME"]) gl_FUNCS_EXPANSION AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) ]) AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) ]) ]) m4_define([gl_FUNCS_EXPANSION], [ m4_divert_text([DEFAULTS], [gl_func_list=]) AC_CHECK_FUNCS([$gl_func_list]) m4_define([gl_FUNCS_EXPANSION], []) ]) # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of # AC_CHECK_DECLS(DECL1, DECL2, ...). AC_DEFUN([AC_CHECK_DECLS_ONCE], [ : m4_foreach_w([gl_DECL_NAME], [$1], [ AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) ]) AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) ]) ]) gengetopt-2.22.6/gl/m4/strdup.m40000664000175000017500000000216012044745036013233 00000000000000# strdup.m4 serial 12 dnl Copyright (C) 2002-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRDUP], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([strdup]) if test $ac_cv_func_strdup != yes; then AC_LIBOBJ([strdup]) gl_PREREQ_STRDUP fi AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi ]) AC_DEFUN([gl_FUNC_STRDUP_POSIX], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) AC_CHECK_FUNCS_ONCE([strdup]) if test $ac_cv_func_strdup = yes; then if test $gl_cv_func_malloc_posix != yes; then REPLACE_STRDUP=1 AC_LIBOBJ([strdup]) gl_PREREQ_STRDUP fi else AC_LIBOBJ([strdup]) gl_PREREQ_STRDUP fi AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi ]) # Prerequisites of lib/strdup.c. AC_DEFUN([gl_PREREQ_STRDUP], [:]) gengetopt-2.22.6/gl/m4/stddef_h.m40000664000175000017500000000270712044745036013501 00000000000000dnl A placeholder for POSIX 2008 , for platforms that have issues. # stddef_h.m4 serial 2 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include int test[2 * (sizeof NULL == sizeof (void *)) -1]; ]])], [gl_cv_decl_null_works=yes], [gl_cv_decl_null_works=no])]) if test $gl_cv_decl_null_works = no; then REPLACE_NULL=1 STDDEF_H=stddef.h fi if test -n "$STDDEF_H"; then gl_CHECK_NEXT_HEADERS([stddef.h]) fi ]) AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) STDDEF_H=''; AC_SUBST([STDDEF_H]) ]) gengetopt-2.22.6/gl/m4/warn-on-use.m40000664000175000017500000000402212044745036014064 00000000000000# warn-on-use.m4 serial 2 dnl Copyright (C) 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- # For each whitespace-separated element in the list of NAMES, define # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES # even after being undefined as a macro. # # See warn-on-use.h for some hints on how to poison function names, as # well as ideas on poisoning global variables and macros. NAMES may # include global variables, but remember that only functions work with # _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single # header, but if the replacement header pulls in other headers because # some systems declare functions in the wrong header, then INCLUDES # should do likewise. # # If you assume C89, then it is generally safe to assume declarations # for functions declared in that standard (such as gets) without # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ m4_foreach_w([gl_decl], [$2], [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), [Define to 1 if ]m4_defn([gl_decl])[ is declared even after undefining macros.])])dnl for gl_func in m4_flatten([$2]); do AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl AC_CACHE_CHECK([whether $gl_func is declared without a macro], gl_Symbol, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], [@%:@undef $gl_func (void) $gl_func;])], [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) AS_VAR_IF(gl_Symbol, [yes], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) dnl shortcut - if the raw declaration exists, then set a cache dnl variable to allow skipping any later AC_CHECK_DECL efforts eval ac_cv_have_decl_$gl_func=yes]) AS_VAR_POPDEF([gl_Symbol])dnl done ]) gengetopt-2.22.6/gl/m4/extensions.m40000664000175000017500000001052712044745036014117 00000000000000# serial 9 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf # 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. # If autoconf reports a warning # warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS # or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS # the fix is # 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked # but always AC_REQUIREd, # 2) to ensure that for each occurrence of # AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) # or # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # the corresponding gnulib module description has 'extensions' among # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS # invocation occurs in gl_EARLY, not in gl_INIT. # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. # Remember that #undef in AH_VERBATIM gets replaced with #define by # AC_DEFINE. The goal here is to define all known feature-enabling # macros, then, if reports of conflicts are made, disable macros that # cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], [Define to 1 if you need to in order for `stat' and other things to work.]) AC_DEFINE([_POSIX_1_SOURCE], [2], [Define to 2 if the system does not provide POSIX.1 features except with this defined.]) AC_DEFINE([_MINIX], [1], [Define to 1 if on MINIX.]) fi dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already dnl provided. case "$host_os" in hpux*) AC_DEFINE([_XOPEN_SOURCE], [500], [Define to 500 only on HP-UX.]) ;; esac AH_VERBATIM([__EXTENSIONS__], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif ]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ # define __EXTENSIONS__ 1 ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) ])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], [ dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. dnl gnulib does not need it. But if it gets required by third-party macros dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) gengetopt-2.22.6/gl/m4/gnulib-common.m40000664000175000017500000002023312044745036014461 00000000000000# gnulib-common.m4 serial 20 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # gl_COMMON # is expanded unconditionally through gnulib-tool magic. AC_DEFUN([gl_COMMON], [ dnl Use AC_REQUIRE here, so that the code is expanded once only. AC_REQUIRE([gl_00GNULIB]) AC_REQUIRE([gl_COMMON_BODY]) ]) AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([isoc99_inline], [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. __APPLE__ && __MACH__ test for MacOS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif]) AH_VERBATIM([unused_parameter], [/* Define as a marker that can be attached to declarations that might not be used. This helps to reduce warnings, such as from GCC -Wunused-parameter. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) # define _GL_UNUSED __attribute__ ((__unused__)) #else # define _GL_UNUSED #endif /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED ]) dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl to /dev/tty, so they can be redirected to log files. Such diagnostics dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ ]) # gl_MODULE_INDICATOR_CONDITION # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present # or not. AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) # gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) # sets the shell variable that indicates the presence of the given module to # a C preprocessor expression that will evaluate to 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ GNULIB_[]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION ]) # gl_MODULE_INDICATOR([modulename]) # defines a C macro indicating the presence of the given module # in a location where it can be used. # | Value | Value | # | in lib/ | in tests/ | # --------------------------------------------+---------+-----------+ # Module present among main modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module present among tests-related modules: | 0 | 1 | # --------------------------------------------+---------+-----------+ # Module not present at all: | 0 | 0 | # --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR], [ AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [gl_MODULE_INDICATOR_CONDITION], [Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module $1 shall be considered present.]) ]) # gl_MODULE_INDICATOR_FOR_TESTS([modulename]) # defines a C macro indicating the presence of the given module # in lib or tests. This is useful to determine whether the module # should be tested. # | Value | Value | # | in lib/ | in tests/ | # --------------------------------------------+---------+-----------+ # Module present among main modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module present among tests-related modules: | 1 | 1 | # --------------------------------------------+---------+-----------+ # Module not present at all: | 0 | 0 | # --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [ AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], [abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], [Define to 1 when the gnulib module $1 should be tested.]) ]) # m4_foreach_w # is a backport of autoconf-2.59c's m4_foreach_w. # Remove this macro when we can assume autoconf >= 2.60. m4_ifndef([m4_foreach_w], [m4_define([m4_foreach_w], [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) # AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) # ---------------------------------------------------- # Backport of autoconf-2.63b's macro. # Remove this macro when we can assume autoconf >= 2.64. m4_ifndef([AS_VAR_IF], [m4_define([AS_VAR_IF], [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix # for interoperability with automake-1.9.6 from autoconf-2.62. # Remove this macro when we can assume autoconf >= 2.62 or # autoconf >= 2.60 && automake >= 1.10. m4_ifdef([AC_PROG_MKDIR_P], [ dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. m4_define([AC_PROG_MKDIR_P], m4_defn([AC_PROG_MKDIR_P])[ AC_SUBST([MKDIR_P])])], [ dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. AC_DEFUN_ONCE([AC_PROG_MKDIR_P], [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' AC_SUBST([MKDIR_P])])]) # AC_C_RESTRICT # This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, # so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ # works. # This definition can be removed once autoconf >= 2.62 can be assumed. m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; }]], [[int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t)]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done ]) AH_VERBATIM([restrict], [/* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict /* Work around a bug in Sun C++: it does not support _Restrict, even though the corresponding Sun C compiler does, which causes "#define restrict _Restrict" in the previous line. Perhaps some future version of Sun C++ will work with _Restrict; if so, it'll probably define __RESTRICT, just as Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict #endif]) case $ac_cv_c_restrict in restrict) ;; no) AC_DEFINE([restrict], []) ;; *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac ]) ]) # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. # Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some # macros invoke AC_C_BIGENDIAN with arguments. AC_DEFUN([gl_BIGENDIAN], [ AC_C_BIGENDIAN ]) # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not # output a spurious "(cached)" mark in the midst of other configure output. # This macro should be used instead of AC_CACHE_VAL when it is not surrounded # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. AC_DEFUN([gl_CACHE_VAL_SILENT], [ saved_as_echo_n="$as_echo_n" as_echo_n=':' AC_CACHE_VAL([$1], [$2]) as_echo_n="$saved_as_echo_n" ]) gengetopt-2.22.6/gl/unistd.in.h0000664000175000017500000012777412044745036013237 00000000000000/* Substitute for and wrapper around . Copyright (C) 2003-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif /* Special invocation convention: - On mingw, several headers, including , include , but we need to ensure that both the system and are completely included before we replace gethostname. */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H /* is being indirectly included for the first time from ; avoid declaring any overrides. */ # if @HAVE_UNISTD_H@ # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ # else # error unexpected; report this to bug-gnulib@gnu.org # endif # define _GL_WINSOCK2_H_WITNESS /* Normal invocation. */ #elif !defined _GL_UNISTD_H /* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ #endif /* Get all possible declarations of gethostname(). */ #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ && !defined _GL_INCLUDING_WINSOCK2_H # define _GL_INCLUDING_WINSOCK2_H # include # undef _GL_INCLUDING_WINSOCK2_H #endif #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H #define _GL_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ #include /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ /* Cygwin 1.7.1 declares symlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \ && ! defined __GLIBC__ # include #endif /* Cygwin 1.7.1 declares unlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ # include #endif /* mingw fails to declare _exit in . */ /* mingw, BeOS, Haiku declare environ in , not in . */ /* Solaris declares getcwd not only in but also in . */ /* But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ # include #endif /* mingw declares getcwd in , not in . */ #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) # include #endif #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include #endif /* Get getopt(), optarg, optind, opterr, optopt. But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT # include #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #if @GNULIB_GETHOSTNAME@ /* Get all possible declarations of gethostname(). */ # if @UNISTD_H_HAVE_WINSOCK2_H@ # if !defined _GL_SYS_SOCKET_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef socket # define socket socket_used_without_including_sys_socket_h # undef connect # define connect connect_used_without_including_sys_socket_h # undef accept # define accept accept_used_without_including_sys_socket_h # undef bind # define bind bind_used_without_including_sys_socket_h # undef getpeername # define getpeername getpeername_used_without_including_sys_socket_h # undef getsockname # define getsockname getsockname_used_without_including_sys_socket_h # undef getsockopt # define getsockopt getsockopt_used_without_including_sys_socket_h # undef listen # define listen listen_used_without_including_sys_socket_h # undef recv # define recv recv_used_without_including_sys_socket_h # undef send # define send send_used_without_including_sys_socket_h # undef recvfrom # define recvfrom recvfrom_used_without_including_sys_socket_h # undef sendto # define sendto sendto_used_without_including_sys_socket_h # undef setsockopt # define setsockopt setsockopt_used_without_including_sys_socket_h # undef shutdown # define shutdown shutdown_used_without_including_sys_socket_h # else _GL_WARN_ON_USE (socket, "socket() used without including "); _GL_WARN_ON_USE (connect, "connect() used without including "); _GL_WARN_ON_USE (accept, "accept() used without including "); _GL_WARN_ON_USE (bind, "bind() used without including "); _GL_WARN_ON_USE (getpeername, "getpeername() used without including "); _GL_WARN_ON_USE (getsockname, "getsockname() used without including "); _GL_WARN_ON_USE (getsockopt, "getsockopt() used without including "); _GL_WARN_ON_USE (listen, "listen() used without including "); _GL_WARN_ON_USE (recv, "recv() used without including "); _GL_WARN_ON_USE (send, "send() used without including "); _GL_WARN_ON_USE (recvfrom, "recvfrom() used without including "); _GL_WARN_ON_USE (sendto, "sendto() used without including "); _GL_WARN_ON_USE (setsockopt, "setsockopt() used without including "); _GL_WARN_ON_USE (shutdown, "shutdown() used without including "); # endif # endif # if !defined _GL_SYS_SELECT_H # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef select # define select select_used_without_including_sys_select_h # else _GL_WARN_ON_USE (select, "select() used without including "); # endif # endif # endif #endif /* OS/2 EMX lacks these macros. */ #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #ifndef STDOUT_FILENO # define STDOUT_FILENO 1 #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif /* Ensure *_OK macros exist. */ #ifndef F_OK # define F_OK 0 # define X_OK 1 # define W_OK 2 # define R_OK 4 #endif /* Declare overridden functions. */ #if defined GNULIB_POSIXCHECK /* The access() function is a security risk. */ _GL_WARN_ON_USE (access, "the access function is a security risk - " "use the gnulib module faccessat instead"); #endif #if @GNULIB_CHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if @REPLACE_CHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef chown # define chown rpl_chown # endif _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); # else # if !@HAVE_CHOWN@ _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); # endif _GL_CXXALIASWARN (chown); #elif defined GNULIB_POSIXCHECK # undef chown # if HAVE_RAW_DECL_CHOWN _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " "doesn't treat a uid or gid of -1 on some systems - " "use gnulib module chown for portability"); # endif #endif #if @GNULIB_CLOSE@ # if @REPLACE_CLOSE@ /* Automatically included by modules that need a replacement for close. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef close # define close rpl_close # endif _GL_FUNCDECL_RPL (close, int, (int fd)); _GL_CXXALIAS_RPL (close, int, (int fd)); # else _GL_CXXALIAS_SYS (close, int, (int fd)); # endif _GL_CXXALIASWARN (close); #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ # undef close # define close close_used_without_requesting_gnulib_module_close #elif defined GNULIB_POSIXCHECK # undef close /* Assume close is always declared. */ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " "use gnulib module close for portability"); #endif #if @REPLACE_DUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup rpl_dup # endif _GL_FUNCDECL_RPL (dup, int, (int oldfd)); _GL_CXXALIAS_RPL (dup, int, (int oldfd)); #else _GL_CXXALIAS_SYS (dup, int, (int oldfd)); #endif _GL_CXXALIASWARN (dup); #if @GNULIB_DUP2@ /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if NEWFD = OLDFD, otherwise close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if @REPLACE_DUP2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 # endif _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); # else # if !@HAVE_DUP2@ _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); # endif _GL_CXXALIASWARN (dup2); #elif defined GNULIB_POSIXCHECK # undef dup2 # if HAVE_RAW_DECL_DUP2 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " "use gnulib module dup2 for portability"); # endif #endif #if @GNULIB_DUP3@ /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the specified flags. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). Close NEWFD first if it is open. Return newfd if successful, otherwise -1 and errno set. See the Linux man page at . */ # if @HAVE_DUP3@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup3 rpl_dup3 # endif _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); # else _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); # endif _GL_CXXALIASWARN (dup3); #elif defined GNULIB_POSIXCHECK # undef dup3 # if HAVE_RAW_DECL_DUP3 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " "use gnulib module dup3 for portability"); # endif #endif #if @GNULIB_ENVIRON@ # if !@HAVE_DECL_ENVIRON@ /* Set of environment variables and values. An array of strings of the form "VARIABLE=VALUE", terminated with a NULL. */ # if defined __APPLE__ && defined __MACH__ # include # define environ (*_NSGetEnviron ()) # else # ifdef __cplusplus extern "C" { # endif extern char **environ; # ifdef __cplusplus } # endif # endif # endif #elif defined GNULIB_POSIXCHECK # if HAVE_RAW_DECL_ENVIRON static inline char *** rpl_environ (void) { return &environ; } _GL_WARN_ON_USE (rpl_environ, "environ is unportable - " "use gnulib module environ for portability"); # undef environ # define environ (*rpl_environ ()) # endif #endif #if @GNULIB_EUIDACCESS@ /* Like access(), except that it uses the effective user id and group id of the current process. */ # if !@HAVE_EUIDACCESS@ _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); _GL_CXXALIASWARN (euidaccess); # if defined GNULIB_POSIXCHECK /* Like access(), this function is a security risk. */ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " "use the gnulib module faccessat instead"); # endif #elif defined GNULIB_POSIXCHECK # undef euidaccess # if HAVE_RAW_DECL_EUIDACCESS _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " "use gnulib module euidaccess for portability"); # endif #endif #if @GNULIB_FACCESSAT@ # if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, (int fd, char const *file, int mode, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); _GL_CXXALIASWARN (faccessat); #elif defined GNULIB_POSIXCHECK # undef faccessat # if HAVE_RAW_DECL_FACCESSAT _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " "use gnulib module faccessat for portability"); # endif #endif #if @GNULIB_FCHDIR@ /* Change the process' current working directory to the directory on which the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if ! @HAVE_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); /* Gnulib internal hooks needed to maintain the fchdir metadata. */ _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) _GL_ARG_NONNULL ((2)); _GL_EXTERN_C void _gl_unregister_fd (int fd); _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); # endif _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); #elif defined GNULIB_POSIXCHECK # undef fchdir # if HAVE_RAW_DECL_FCHDIR _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " "use gnulib module fchdir for portability"); # endif #endif #if @GNULIB_FCHOWNAT@ # if @REPLACE_FCHOWNAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fchownat # define fchownat rpl_fchownat # endif _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); # else # if !@HAVE_FCHOWNAT@ _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); # endif _GL_CXXALIASWARN (fchownat); #elif defined GNULIB_POSIXCHECK # undef fchownat # if HAVE_RAW_DECL_FCHOWNAT _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " "use gnulib module openat for portability"); # endif #endif #if @GNULIB_FSYNC@ /* Synchronize changes to a file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2001 specification . */ # if !@HAVE_FSYNC@ _GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif _GL_CXXALIAS_SYS (fsync, int, (int fd)); _GL_CXXALIASWARN (fsync); #elif defined GNULIB_POSIXCHECK # undef fsync # if HAVE_RAW_DECL_FSYNC _GL_WARN_ON_USE (fsync, "fsync is unportable - " "use gnulib module fsync for portability"); # endif #endif #if @GNULIB_FTRUNCATE@ /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if !@HAVE_FTRUNCATE@ _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); # endif _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); _GL_CXXALIASWARN (ftruncate); #elif defined GNULIB_POSIXCHECK # undef ftruncate # if HAVE_RAW_DECL_FTRUNCATE _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " "use gnulib module ftruncate for portability"); # endif #endif #if @GNULIB_GETCWD@ /* Get the name of the current working directory, and put it in SIZE bytes of BUF. Return BUF if successful, or NULL if the directory couldn't be determined or SIZE was too small. See the POSIX:2001 specification . Additionally, the gnulib module 'getcwd' guarantees the following GNU extension: If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ # if @REPLACE_GETCWD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getcwd rpl_getcwd # endif _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); # else /* Need to cast, because on mingw, the second parameter is int size. */ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); # endif _GL_CXXALIASWARN (getcwd); #elif defined GNULIB_POSIXCHECK # undef getcwd # if HAVE_RAW_DECL_GETCWD _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " "use gnulib module getcwd for portability"); # endif #endif #if @GNULIB_GETDOMAINNAME@ /* Return the NIS domain name of the machine. WARNING! The NIS domain name is unrelated to the fully qualified host name of the machine. It is also unrelated to email addresses. WARNING! The NIS domain name is usually the empty string or "(none)" when not using NIS. Put up to LEN bytes of the NIS domain name into NAME. Null terminate it if the name is shorter than LEN. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if !@HAVE_GETDOMAINNAME@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on MacOS X 10.5 systems, the second parameter is int len. */ _GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len)); _GL_CXXALIASWARN (getdomainname); #elif defined GNULIB_POSIXCHECK # undef getdomainname # if HAVE_RAW_DECL_GETDOMAINNAME _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " "use gnulib module getdomainname for portability"); # endif #endif #if @GNULIB_GETDTABLESIZE@ /* Return the maximum number of file descriptors in the current process. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ # if !@HAVE_GETDTABLESIZE@ _GL_FUNCDECL_SYS (getdtablesize, int, (void)); # endif _GL_CXXALIAS_SYS (getdtablesize, int, (void)); _GL_CXXALIASWARN (getdtablesize); #elif defined GNULIB_POSIXCHECK # undef getdtablesize # if HAVE_RAW_DECL_GETDTABLESIZE _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " "use gnulib module getdtablesize for portability"); # endif #endif #if @GNULIB_GETGROUPS@ /* Return the supplemental groups that the current process belongs to. It is unspecified whether the effective group id is in the list. If N is 0, return the group count; otherwise, N describes how many entries are available in GROUPS. Return -1 and set errno if N is not 0 and not large enough. Fails with ENOSYS on some systems. */ # if @REPLACE_GETGROUPS@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef getgroups # define getgroups rpl_getgroups # endif _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); # else # if !@HAVE_GETGROUPS@ _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); # endif _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); # endif _GL_CXXALIASWARN (getgroups); #elif defined GNULIB_POSIXCHECK # undef getgroups # if HAVE_RAW_DECL_GETGROUPS _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " "use gnulib module getgroups for portability"); # endif #endif #if @GNULIB_GETHOSTNAME@ /* Return the standard host name of the machine. WARNING! The host name may or may not be fully qualified. Put up to LEN bytes of the host name into NAME. Null terminate it if the name is shorter than LEN. If the host name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ # if @UNISTD_H_HAVE_WINSOCK2_H@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname rpl_gethostname # endif _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); # else # if !@HAVE_GETHOSTNAME@ _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Solaris 10 systems, the second parameter is int len. */ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif _GL_CXXALIASWARN (gethostname); #elif @UNISTD_H_HAVE_WINSOCK2_H@ # undef gethostname # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname #elif defined GNULIB_POSIXCHECK # undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " "use gnulib module gethostname for portability"); # endif #endif #if @GNULIB_GETLOGIN@ /* Returns the user's login name, or NULL if it cannot be found. Upon error, returns NULL with errno set. See . Most programs don't need to use this function, because the information is available through environment variables: ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ # if !@HAVE_GETLOGIN@ _GL_FUNCDECL_SYS (getlogin, char *, (void)); # endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); _GL_CXXALIASWARN (getlogin); #elif defined GNULIB_POSIXCHECK # undef getlogin # if HAVE_RAW_DECL_GETLOGIN _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " "use gnulib module getlogin for portability"); # endif #endif #if @GNULIB_GETLOGIN_R@ /* Copies the user's login name to NAME. The array pointed to by NAME has room for SIZE bytes. Returns 0 if successful. Upon error, an error number is returned, or -1 in the case that the login name cannot be found but no specific error is provided (this case is hopefully rare but is left open by the POSIX spec). See . Most programs don't need to use this function, because the information is available through environment variables: ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ # if !@HAVE_DECL_GETLOGIN_R@ _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Solaris 10 systems, the second argument is int size. */ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); _GL_CXXALIASWARN (getlogin_r); #elif defined GNULIB_POSIXCHECK # undef getlogin_r # if HAVE_RAW_DECL_GETLOGIN_R _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " "use gnulib module getlogin_r for portability"); # endif #endif #if @GNULIB_GETPAGESIZE@ # if @REPLACE_GETPAGESIZE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize rpl_getpagesize # endif _GL_FUNCDECL_RPL (getpagesize, int, (void)); _GL_CXXALIAS_RPL (getpagesize, int, (void)); # else # if !@HAVE_GETPAGESIZE@ # if !defined getpagesize /* This is for POSIX systems. */ # if !defined _gl_getpagesize && defined _SC_PAGESIZE # if ! (defined __VMS && __VMS_VER < 70000000) # define _gl_getpagesize() sysconf (_SC_PAGESIZE) # endif # endif /* This is for older VMS. */ # if !defined _gl_getpagesize && defined __VMS # ifdef __ALPHA # define _gl_getpagesize() 8192 # else # define _gl_getpagesize() 512 # endif # endif /* This is for BeOS. */ # if !defined _gl_getpagesize && @HAVE_OS_H@ # include # if defined B_PAGE_SIZE # define _gl_getpagesize() B_PAGE_SIZE # endif # endif /* This is for AmigaOS4.0. */ # if !defined _gl_getpagesize && defined __amigaos4__ # define _gl_getpagesize() 2048 # endif /* This is for older Unix systems. */ # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ # include # ifdef EXEC_PAGESIZE # define _gl_getpagesize() EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define CLSIZE 1 # endif # define _gl_getpagesize() (NBPG * CLSIZE) # else # ifdef NBPC # define _gl_getpagesize() NBPC # endif # endif # endif # endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize() _gl_getpagesize () # else static inline int getpagesize () { return _gl_getpagesize (); } # endif # endif # endif /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); # endif # if @HAVE_DECL_GETPAGESIZE@ _GL_CXXALIASWARN (getpagesize); # endif #elif defined GNULIB_POSIXCHECK # undef getpagesize # if HAVE_RAW_DECL_GETPAGESIZE _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " "use gnulib module getpagesize for portability"); # endif #endif #if @GNULIB_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (getusershell, char *, (void)); # endif _GL_CXXALIAS_SYS (getusershell, char *, (void)); _GL_CXXALIASWARN (getusershell); #elif defined GNULIB_POSIXCHECK # undef getusershell # if HAVE_RAW_DECL_GETUSERSHELL _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_GETUSERSHELL@ /* Rewind to pointer that is advanced at each getusershell() call. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (setusershell, void, (void)); # endif _GL_CXXALIAS_SYS (setusershell, void, (void)); _GL_CXXALIASWARN (setusershell); #elif defined GNULIB_POSIXCHECK # undef setusershell # if HAVE_RAW_DECL_SETUSERSHELL _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_GETUSERSHELL@ /* Free the pointer that is advanced at each getusershell() call and associated resources. */ # if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (endusershell, void, (void)); # endif _GL_CXXALIAS_SYS (endusershell, void, (void)); _GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK # undef endusershell # if HAVE_RAW_DECL_ENDUSERSHELL _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " "use gnulib module getusershell for portability"); # endif #endif #if @GNULIB_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if @REPLACE_LCHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lchown # define lchown rpl_lchown # endif _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); # else # if !@HAVE_LCHOWN@ _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif _GL_CXXALIASWARN (lchown); #elif defined GNULIB_POSIXCHECK # undef lchown # if HAVE_RAW_DECL_LCHOWN _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " "use gnulib module lchown for portability"); # endif #endif #if @GNULIB_LINK@ /* Create a new hard link for an existing file. Return 0 if successful, otherwise -1 and errno set. See POSIX:2001 specification . */ # if @REPLACE_LINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link # endif _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); # else # if !@HAVE_LINK@ _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif _GL_CXXALIASWARN (link); #elif defined GNULIB_POSIXCHECK # undef link # if HAVE_RAW_DECL_LINK _GL_WARN_ON_USE (link, "link is unportable - " "use gnulib module link for portability"); # endif #endif #if @GNULIB_LINKAT@ /* Create a new hard link for an existing file, relative to two directories. FLAG controls whether symlinks are followed. Return 0 if successful, otherwise -1 and errno set. */ # if @REPLACE_LINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef linkat # define linkat rpl_linkat # endif _GL_FUNCDECL_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag) _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag)); # else # if !@HAVE_LINKAT@ _GL_FUNCDECL_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag) _GL_ARG_NONNULL ((2, 4))); # endif _GL_CXXALIAS_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag)); # endif _GL_CXXALIASWARN (linkat); #elif defined GNULIB_POSIXCHECK # undef linkat # if HAVE_RAW_DECL_LINKAT _GL_WARN_ON_USE (linkat, "linkat is unportable - " "use gnulib module linkat for portability"); # endif #endif #if @GNULIB_LSEEK@ /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if @REPLACE_LSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek # endif _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); # else _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); # endif _GL_CXXALIASWARN (lseek); #elif defined GNULIB_POSIXCHECK # undef lseek # if HAVE_RAW_DECL_LSEEK _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " "systems - use gnulib module lseek for portability"); # endif #endif #if @GNULIB_PIPE2@ /* Create a pipe, applying the given flags when opening the read-end of the pipe and the write-end of the pipe. The flags are a bitmask, possibly including O_CLOEXEC (defined in ) and O_TEXT, O_BINARY (defined in "binary-io.h"). Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. See also the Linux man page at . */ # if @HAVE_PIPE2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pipe2 rpl_pipe2 # endif _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); # else _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); # endif _GL_CXXALIASWARN (pipe2); #elif defined GNULIB_POSIXCHECK # undef pipe2 # if HAVE_RAW_DECL_PIPE2 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " "use gnulib module pipe2 for portability"); # endif #endif #if @GNULIB_PREAD@ /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. Return the number of bytes placed into BUF if successful, otherwise set errno and return -1. 0 indicates EOF. See the POSIX:2001 specification . */ # if @REPLACE_PREAD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pread rpl_pread # endif _GL_FUNCDECL_RPL (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PREAD@ _GL_FUNCDECL_SYS (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); # endif _GL_CXXALIASWARN (pread); #elif defined GNULIB_POSIXCHECK # undef pread # if HAVE_RAW_DECL_PREAD _GL_WARN_ON_USE (pread, "pread is unportable - " "use gnulib module pread for portability"); # endif #endif #if @GNULIB_PWRITE@ /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. Return the number of bytes written if successful, otherwise set errno and return -1. 0 indicates nothing written. See the POSIX:2001 specification . */ # if @REPLACE_PWRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define pwrite rpl_pwrite # endif _GL_FUNCDECL_RPL (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PWRITE@ _GL_FUNCDECL_SYS (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); # endif _GL_CXXALIASWARN (pwrite); #elif defined GNULIB_POSIXCHECK # undef pwrite # if HAVE_RAW_DECL_PWRITE _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " "use gnulib module pwrite for portability"); # endif #endif #if @GNULIB_READLINK@ /* Read the contents of the symbolic link FILE and place the first BUFSIZE bytes of it into BUF. Return the number of bytes placed into BUF if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ # if @REPLACE_READLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlink rpl_readlink # endif _GL_FUNCDECL_RPL (readlink, ssize_t, (const char *file, char *buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (readlink, ssize_t, (const char *file, char *buf, size_t bufsize)); # else # if !@HAVE_READLINK@ _GL_FUNCDECL_SYS (readlink, ssize_t, (const char *file, char *buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (readlink, ssize_t, (const char *file, char *buf, size_t bufsize)); # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK # undef readlink # if HAVE_RAW_DECL_READLINK _GL_WARN_ON_USE (readlink, "readlink is unportable - " "use gnulib module readlink for portability"); # endif #endif #if @GNULIB_READLINKAT@ # if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len)); _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK # undef readlinkat # if HAVE_RAW_DECL_READLINKAT _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " "use gnulib module readlinkat for portability"); # endif #endif #if @GNULIB_RMDIR@ /* Remove the directory DIR. */ # if @REPLACE_RMDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define rmdir rpl_rmdir # endif _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); # else _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); # endif _GL_CXXALIASWARN (rmdir); #elif defined GNULIB_POSIXCHECK # undef rmdir # if HAVE_RAW_DECL_RMDIR _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " "use gnulib module rmdir for portability"); # endif #endif #if @GNULIB_SLEEP@ /* Pause the execution of the current thread for N seconds. Returns the number of seconds left to sleep. See the POSIX:2001 specification . */ # if @REPLACE_SLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sleep # define sleep rpl_sleep # endif _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); # else # if !@HAVE_SLEEP@ _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif _GL_CXXALIASWARN (sleep); #elif defined GNULIB_POSIXCHECK # undef sleep # if HAVE_RAW_DECL_SLEEP _GL_WARN_ON_USE (sleep, "sleep is unportable - " "use gnulib module sleep for portability"); # endif #endif #if @GNULIB_SYMLINK@ # if @REPLACE_SYMLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef symlink # define symlink rpl_symlink # endif _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); # else # if !@HAVE_SYMLINK@ _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); # endif _GL_CXXALIASWARN (symlink); #elif defined GNULIB_POSIXCHECK # undef symlink # if HAVE_RAW_DECL_SYMLINK _GL_WARN_ON_USE (symlink, "symlink is not portable - " "use gnulib module symlink for portability"); # endif #endif #if @GNULIB_SYMLINKAT@ # if !@HAVE_SYMLINKAT@ _GL_FUNCDECL_SYS (symlinkat, int, (char const *contents, int fd, char const *file) _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS (symlinkat, int, (char const *contents, int fd, char const *file)); _GL_CXXALIASWARN (symlinkat); #elif defined GNULIB_POSIXCHECK # undef symlinkat # if HAVE_RAW_DECL_SYMLINKAT _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " "use gnulib module symlinkat for portability"); # endif #endif #if @GNULIB_TTYNAME_R@ /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ # if @REPLACE_TTYNAME_R@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ttyname_r # define ttyname_r rpl_ttyname_r # endif _GL_FUNCDECL_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen)); # else # if !@HAVE_TTYNAME_R@ _GL_FUNCDECL_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen)); # endif _GL_CXXALIASWARN (ttyname_r); #elif defined GNULIB_POSIXCHECK # undef ttyname_r # if HAVE_RAW_DECL_TTYNAME_R _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " "use gnulib module ttyname_r for portability"); # endif #endif #if @GNULIB_UNLINK@ # if @REPLACE_UNLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlink # define unlink rpl_unlink # endif _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unlink, int, (char const *file)); # else _GL_CXXALIAS_SYS (unlink, int, (char const *file)); # endif _GL_CXXALIASWARN (unlink); #elif defined GNULIB_POSIXCHECK # undef unlink # if HAVE_RAW_DECL_UNLINK _GL_WARN_ON_USE (unlink, "unlink is not portable - " "use gnulib module unlink for portability"); # endif #endif #if @GNULIB_UNLINKAT@ # if @REPLACE_UNLINKAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef unlinkat # define unlinkat rpl_unlinkat # endif _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); # else # if !@HAVE_UNLINKAT@ _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); # endif _GL_CXXALIASWARN (unlinkat); #elif defined GNULIB_POSIXCHECK # undef unlinkat # if HAVE_RAW_DECL_UNLINKAT _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " "use gnulib module openat for portability"); # endif #endif #if @GNULIB_USLEEP@ /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. See the POSIX:2001 specification . */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep # define usleep rpl_usleep # endif _GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); # else # if !@HAVE_USLEEP@ _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); # endif _GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); # endif _GL_CXXALIASWARN (usleep); #elif defined GNULIB_POSIXCHECK # undef usleep # if HAVE_RAW_DECL_USLEEP _GL_WARN_ON_USE (usleep, "usleep is unportable - " "use gnulib module usleep for portability"); # endif #endif #if @GNULIB_WRITE@ /* Write up to COUNT bytes starting at BUF to file descriptor FD. See the POSIX:2001 specification . */ # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write rpl_write # endif _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); # else /* Need to cast, because on mingw, the third parameter is unsigned int count and the return type is 'int'. */ _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); # endif _GL_CXXALIASWARN (write); #endif #endif /* _GL_UNISTD_H */ #endif /* _GL_UNISTD_H */ gengetopt-2.22.6/gl/gettext.h0000664000175000017500000002311512044745036012770 00000000000000/* Convenience header for conditional use of GNU . Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 /* NLS can be disabled through the configure --disable-nls option. */ #if ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by the gettext() and ngettext() macros. This is an alternative to calling textdomain(), and is useful for libraries. */ # ifdef DEFAULT_TEXT_DOMAIN # undef gettext # define gettext(Msgid) \ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) # endif #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. We don't include as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas is OK. */ #if defined(__sun) # include #endif /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # undef gettext # define gettext(Msgid) ((const char *) (Msgid)) # undef dgettext # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) # undef dcgettext # define dcgettext(Domainname, Msgid, Category) \ ((void) (Category), dgettext (Domainname, Msgid)) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 \ ? ((void) (Msgid2), (const char *) (Msgid1)) \ : ((void) (Msgid1), (const char *) (Msgid2))) # undef dngettext # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # undef dcngettext # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) # undef textdomain # define textdomain(Domainname) ((const char *) (Domainname)) # undef bindtextdomain # define bindtextdomain(Domainname, Dirname) \ ((void) (Domainname), (const char *) (Dirname)) # undef bind_textdomain_codeset # define bind_textdomain_codeset(Domainname, Codeset) \ ((void) (Domainname), (const char *) (Codeset)) #endif /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. The argument, String, should be a literal string. Concatenated strings and other string expressions won't work. The macro's expansion is not parenthesized, so that it is suitable as initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String /* The separator between msgctxt and msgid in a .mo file. */ #define GETTEXT_CONTEXT_GLUE "\004" /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be short and rarely need to change. The letter 'p' stands for 'particular' or 'special'. */ #ifdef DEFAULT_TEXT_DOMAIN # define pgettext(Msgctxt, Msgid) \ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #else # define pgettext(Msgctxt, Msgid) \ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #endif #define dpgettext(Domainname, Msgctxt, Msgid) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) #ifdef DEFAULT_TEXT_DOMAIN # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #else # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #endif #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * pgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) return msgid; else return translation; } #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * npgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); if (translation == msg_ctxt_id || translation == msgid_plural) return (n == 1 ? msgid : msgid_plural); else return translation; } /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID can be arbitrary expressions. But for string literals these macros are less efficient than those above. */ #include #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include #endif #define pgettext_expr(Msgctxt, Msgid) \ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) #define dpgettext_expr(Domainname, Msgctxt, Msgid) \ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) return translation; } return msgid; } #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcnpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) return translation; } return (n == 1 ? msgid : msgid_plural); } #endif /* _LIBGETTEXT_H */ gengetopt-2.22.6/acinclude.m40000664000175000017500000001166012045003074012712 00000000000000dnl @synopsis AC_COMPILE_WARNINGS dnl dnl Set the maximum warning verbosity according to compiler used. dnl Currently supports g++ and gcc. dnl This macro must be put after AC_PROG_CC and AC_PROG_CXX in dnl configure.in dnl dnl @author Loic Dachary dnl AC_DEFUN([AC_COMPILE_WARNINGS], [AC_MSG_CHECKING(maximum warning verbosity option) if test -n "$CXX" then if test "$GXX" = "yes" then ac_compile_warnings_opt='-Wall -W -Wno-unused-parameter -fstrict-aliasing -Wshadow' fi CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_opt for C++" fi if test -n "$CC" then if test "$GCC" = "yes" then ac_compile_warnings_opt='-Wall -W -Wno-unused-parameter -fstrict-aliasing -Wshadow' fi CFLAGS="$CFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C" fi AC_MSG_RESULT($ac_compile_warnings_msg) unset ac_compile_warnings_msg unset ac_compile_warnings_opt ]) dnl Copyright (C) 2001 Lorenzo Bettini dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl @synopsis AC_NONGNU_FLAGS dnl dnl check if the non-GNU C compiler accepts -Aa (HP-UX) AC_DEFUN([AC_NONGNU_FLAGS], [ if test -z "$GCC"; then AC_CC_AA_FLAG if test $ac_cv_cc_aa_flag = yes; then CFLAGS="$CFLAGS -Aa" fi fi ]) dnl @synopsis AC_CC_AA_FLAG dnl dnl check if the C compiler accepts -Aa (HP-UX) AC_DEFUN([AC_CC_AA_FLAG], [AC_CACHE_CHECK(whether ${CC-cc} accepts -Aa, ac_cv_cc_aa_flag, [echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -Aa -c conftest.c 2>&1`"; then ac_cv_cc_aa_flag=yes else ac_cv_cc_aa_flag=no fi rm -f conftest* ])]) dnl @synopsis AC_CXX_NAMESPACES dnl dnl If the compiler can prevent names clashes using namespaces, define dnl HAVE_NAMESPACES. dnl dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_NAMESPACES], [AC_CACHE_CHECK(whether the compiler implements namespaces, ac_cv_cxx_namespaces, [AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], [using namespace Outer::Inner; return i;], ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_namespaces" = yes; then AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) fi ]) dnl @synopsis AC_CXX_HAVE_STL dnl dnl If the compiler supports the Standard Template Library, define HAVE_STL. dnl dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_HAVE_STL], [AC_CACHE_CHECK(whether the compiler supports Standard Template Library, ac_cv_cxx_have_stl, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #include #ifdef HAVE_NAMESPACES using namespace std; #endif],[list x; x.push_back(5); list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;], ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_stl" = yes; then AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library]) fi ]) dnl @synopsis AC_CXX_HAVE_SSTREAM dnl dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. dnl dnl @author Ben Stanley dnl AC_DEFUN([AC_CXX_HAVE_SSTREAM], [AC_CACHE_CHECK(whether the compiler has stringstream, ac_cv_cxx_have_sstream, [AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #ifdef HAVE_NAMESPACES using namespace std; #endif],[stringstream message; message << "Hello"; return 0;], ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) AC_LANG_RESTORE ]) if test "$ac_cv_cxx_have_sstream" = yes; then AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream]) fi ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/adl_func_getopt_long.html dnl AC_PREREQ(2.49) AC_DEFUN([adl_FUNC_GETOPT_LONG], [# clean out junk possibly left behind by a previous configuration rm -f lib/getopt.h # Check for getopt_long support AC_CHECK_HEADERS([getopt.h]) AC_CHECK_FUNCS([getopt_long],, [# FreeBSD has a gnugetopt library for this AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])], [# use the GNU replacement AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1) AC_CONFIG_LINKS([src/getopt.h:src/gnugetopt.h])])])]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_c_long_long.html dnl AC_DEFUN([AC_C_LONG_LONG], [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, [if test "$GCC" = yes; then ac_cv_c_long_long=yes else AC_TRY_COMPILE(,[long long int i;], ac_cv_c_long_long=yes, ac_cv_c_long_long=no) fi]) if test $ac_cv_c_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG) fi ]) gengetopt-2.22.6/configure0000775000175000017500000231612712046536526012456 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for GNU gengetopt 2.22.6. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GNU gengetopt' PACKAGE_TARNAME='gengetopt' PACKAGE_VERSION='2.22.6' PACKAGE_STRING='GNU gengetopt 2.22.6' PACKAGE_BUGREPORT='' PACKAGE_URL='http://www.gnu.org/software/gengetopt/' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" gl_getopt_required=POSIX gl_header_list= gl_getopt_required=POSIX gl_func_list= ac_subst_vars='gltests_LTLIBOBJS gltests_LIBOBJS gl_LTLIBOBJS gl_LIBOBJS am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS BASH_SHELL NO_CROSSCOMPILING_FALSE NO_CROSSCOMPILING_TRUE NO_GENGEN_FALSE NO_GENGEN_TRUE NO_SOURCEHIGHLIGHT_FALSE NO_SOURCEHIGHLIGHT_TRUE NO_STRDUP_FALSE NO_STRDUP_TRUE NO_HELP2MAN_FALSE NO_HELP2MAN_TRUE HELP2MAN VALGRIND GENGEN SOURCEHIGHLIGHT TAR gltests_WITNESS HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_STRING_H NEXT_STRING_H UNDEFINE_STRTOK_R REPLACE_STRTOK_R REPLACE_STRSIGNAL REPLACE_STRNLEN REPLACE_STRNDUP REPLACE_STRNCAT REPLACE_STRERROR REPLACE_STRCASESTR REPLACE_STRSTR REPLACE_STRDUP REPLACE_STPNCPY REPLACE_MEMMEM REPLACE_MEMCHR HAVE_STRVERSCMP HAVE_DECL_STRSIGNAL HAVE_DECL_STRTOK_R HAVE_STRCASESTR HAVE_STRSEP HAVE_STRPBRK HAVE_DECL_STRNLEN HAVE_DECL_STRNDUP HAVE_DECL_STRDUP HAVE_STRCHRNUL HAVE_STPNCPY HAVE_STPCPY HAVE_RAWMEMCHR HAVE_DECL_MEMRCHR HAVE_MEMPCPY HAVE_DECL_MEMMEM HAVE_MEMCHR HAVE_MBSLEN GNULIB_STRVERSCMP GNULIB_STRSIGNAL GNULIB_STRERROR GNULIB_MBSTOK_R GNULIB_MBSSEP GNULIB_MBSSPN GNULIB_MBSPBRK GNULIB_MBSCSPN GNULIB_MBSCASESTR GNULIB_MBSPCASECMP GNULIB_MBSNCASECMP GNULIB_MBSCASECMP GNULIB_MBSSTR GNULIB_MBSRCHR GNULIB_MBSCHR GNULIB_MBSNLEN GNULIB_MBSLEN GNULIB_STRTOK_R GNULIB_STRCASESTR GNULIB_STRSTR GNULIB_STRSEP GNULIB_STRPBRK GNULIB_STRNLEN GNULIB_STRNDUP GNULIB_STRNCAT GNULIB_STRDUP GNULIB_STRCHRNUL GNULIB_STPNCPY GNULIB_STPCPY GNULIB_RAWMEMCHR GNULIB_MEMRCHR GNULIB_MEMPCPY GNULIB_MEMMEM GNULIB_MEMCHR NEXT_AS_FIRST_DIRECTIVE_STDDEF_H NEXT_STDDEF_H STDDEF_H HAVE_WCHAR_T REPLACE_NULL LTLIBINTL LIBINTL GETOPT_H HAVE_GETOPT_H NEXT_AS_FIRST_DIRECTIVE_GETOPT_H NEXT_GETOPT_H PRAGMA_SYSTEM_HEADER INCLUDE_NEXT_AS_FIRST_DIRECTIVE INCLUDE_NEXT UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS UNISTD_H_HAVE_WINSOCK2_H REPLACE_WRITE REPLACE_USLEEP REPLACE_UNLINKAT REPLACE_UNLINK REPLACE_TTYNAME_R REPLACE_SYMLINK REPLACE_SLEEP REPLACE_RMDIR REPLACE_READLINK REPLACE_PWRITE REPLACE_PREAD REPLACE_LSEEK REPLACE_LINKAT REPLACE_LINK REPLACE_LCHOWN REPLACE_GETPAGESIZE REPLACE_GETGROUPS REPLACE_GETCWD REPLACE_FCHOWNAT REPLACE_DUP2 REPLACE_DUP REPLACE_CLOSE REPLACE_CHOWN HAVE_SYS_PARAM_H HAVE_OS_H HAVE_DECL_GETUSERSHELL HAVE_DECL_GETPAGESIZE HAVE_DECL_GETLOGIN_R HAVE_DECL_ENVIRON HAVE_USLEEP HAVE_UNLINKAT HAVE_TTYNAME_R HAVE_SYMLINKAT HAVE_SYMLINK HAVE_SLEEP HAVE_READLINKAT HAVE_READLINK HAVE_PWRITE HAVE_PREAD HAVE_PIPE2 HAVE_LINKAT HAVE_LINK HAVE_LCHOWN HAVE_GETPAGESIZE HAVE_GETLOGIN HAVE_GETHOSTNAME HAVE_GETGROUPS HAVE_GETDTABLESIZE HAVE_GETDOMAINNAME HAVE_FTRUNCATE HAVE_FSYNC HAVE_FCHOWNAT HAVE_FCHDIR HAVE_FACCESSAT HAVE_EUIDACCESS HAVE_DUP3 HAVE_DUP2 HAVE_CHOWN GNULIB_WRITE GNULIB_USLEEP GNULIB_UNLINKAT GNULIB_UNLINK GNULIB_UNISTD_H_SIGPIPE GNULIB_UNISTD_H_GETOPT GNULIB_TTYNAME_R GNULIB_SYMLINKAT GNULIB_SYMLINK GNULIB_SLEEP GNULIB_RMDIR GNULIB_READLINKAT GNULIB_READLINK GNULIB_PWRITE GNULIB_PREAD GNULIB_PIPE2 GNULIB_LSEEK GNULIB_LINKAT GNULIB_LINK GNULIB_LCHOWN GNULIB_GETUSERSHELL GNULIB_GETPAGESIZE GNULIB_GETLOGIN_R GNULIB_GETLOGIN GNULIB_GETHOSTNAME GNULIB_GETGROUPS GNULIB_GETDTABLESIZE GNULIB_GETDOMAINNAME GNULIB_GETCWD GNULIB_FTRUNCATE GNULIB_FSYNC GNULIB_FCHOWNAT GNULIB_FCHDIR GNULIB_FACCESSAT GNULIB_EUIDACCESS GNULIB_ENVIRON GNULIB_DUP3 GNULIB_DUP2 GNULIB_CLOSE GNULIB_CHOWN GL_COND_LIBTOOL_FALSE GL_COND_LIBTOOL_TRUE LEXLIB LEX_OUTPUT_ROOT LEX YFLAGS YACC CXXCPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX EGREP GREP CPP host_os host_vendor host_cpu host build_os build_vendor build_cpu build RANLIB am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC gengetoptexamplesdir gengetoptdocdir am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_warnings ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP YACC YFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures GNU gengetopt 2.22.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/gengetopt] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of GNU gengetopt 2.22.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-warnings enable compiler warnings Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. GNU gengetopt home page: . General help using GNU software: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF GNU gengetopt configure 2.22.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU gengetopt $as_me 2.22.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi gl_getopt_required=GNU gl_header_list="$gl_header_list getopt.h" gl_header_list="$gl_header_list stddef.h" gl_func_list="$gl_func_list strdup" gl_header_list="$gl_header_list string.h" gl_header_list="$gl_header_list unistd.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='gengetopt' VERSION='2.22.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' gengetoptdocdir=$docdir gengetoptexamplesdir=$gengetoptdocdir/examples ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi case "$host_os" in hpux*) $as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # Code from module arg-nonnull: # Code from module c++defs: # Code from module extensions: # Code from module getopt: # Code from module getopt-gnu: # Code from module getopt-posix: # Code from module gettext-h: # Code from module include_next: # Code from module stddef: # Code from module strdup: # Code from module string: # Code from module unistd: # Code from module warn-on-use: if test -z "$GCC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC-cc} accepts -Aa" >&5 $as_echo_n "checking whether ${CC-cc} accepts -Aa... " >&6; } if ${ac_cv_cc_aa_flag+:} false; then : $as_echo_n "(cached) " >&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -Aa -c conftest.c 2>&1`"; then ac_cv_cc_aa_flag=yes else ac_cv_cc_aa_flag=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_aa_flag" >&5 $as_echo "$ac_cv_cc_aa_flag" >&6; } if test $ac_cv_cc_aa_flag = yes; then CFLAGS="$CFLAGS -Aa" fi fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 $as_echo_n "checking for long long int... " >&6; } if ${ac_cv_c_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if test "$GCC" = yes; then ac_cv_c_long_long=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { long long int i; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_long_long=yes else ac_cv_c_long_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_long_long" >&5 $as_echo "$ac_cv_c_long_long" >&6; } if test $ac_cv_c_long_long = yes; then $as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test "$GCC" != "yes"; then case "$host_os" in irix6*) CXXFLAGS="-LANG:std $CXXFLAGS";; esac; fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: # Check whether --enable-warnings was given. if test "${enable_warnings+set}" = set; then : enableval=$enable_warnings; { $as_echo "$as_me:${as_lineno-$LINENO}: checking maximum warning verbosity option" >&5 $as_echo_n "checking maximum warning verbosity option... " >&6; } if test -n "$CXX" then if test "$GXX" = "yes" then ac_compile_warnings_opt='-Wall -W -Wno-unused-parameter -fstrict-aliasing -Wshadow' fi CXXFLAGS="$CXXFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_opt for C++" fi if test -n "$CC" then if test "$GCC" = "yes" then ac_compile_warnings_opt='-Wall -W -Wno-unused-parameter -fstrict-aliasing -Wshadow' fi CFLAGS="$CFLAGS $ac_compile_warnings_opt" ac_compile_warnings_msg="$ac_compile_warnings_msg $ac_compile_warnings_opt for C" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_compile_warnings_msg" >&5 $as_echo "$ac_compile_warnings_msg" >&6; } unset ac_compile_warnings_msg unset ac_compile_warnings_opt fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler implements namespaces" >&5 $as_echo_n "checking whether the compiler implements namespaces... " >&6; } if ${ac_cv_cxx_namespaces+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace Outer { namespace Inner { int i = 0; }} int main () { using namespace Outer::Inner; return i; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxx_namespaces=yes else ac_cv_cxx_namespaces=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_namespaces" >&5 $as_echo "$ac_cv_cxx_namespaces" >&6; } if test "$ac_cv_cxx_namespaces" = yes; then $as_echo "#define HAVE_NAMESPACES /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports Standard Template Library" >&5 $as_echo_n "checking whether the compiler supports Standard Template Library... " >&6; } if ${ac_cv_cxx_have_stl+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifdef HAVE_NAMESPACES using namespace std; #endif int main () { list x; x.push_back(5); list::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxx_have_stl=yes else ac_cv_cxx_have_stl=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_have_stl" >&5 $as_echo "$ac_cv_cxx_have_stl" >&6; } if test "$ac_cv_cxx_have_stl" = yes; then $as_echo "#define HAVE_STL /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler has stringstream" >&5 $as_echo_n "checking whether the compiler has stringstream... " >&6; } if ${ac_cv_cxx_have_sstream+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef HAVE_NAMESPACES using namespace std; #endif int main () { stringstream message; message << "Hello"; return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxx_have_sstream=yes else ac_cv_cxx_have_sstream=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_have_sstream" >&5 $as_echo "$ac_cv_cxx_have_sstream" >&6; } if test "$ac_cv_cxx_have_sstream" = yes; then $as_echo "#define HAVE_SSTREAM /**/" >>confdefs.h fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" YFLAGS="$YFLAGS -d -v" for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in malloc.h strings.h unistd.h libintl.h stddef.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi #AC_FUNC_MALLOC #AC_FUNC_REALLOC #AC_FUNC_STRTOD # For gnulib. LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ GNULIB_CHOWN=0; GNULIB_CLOSE=0; GNULIB_DUP2=0; GNULIB_DUP3=0; GNULIB_ENVIRON=0; GNULIB_EUIDACCESS=0; GNULIB_FACCESSAT=0; GNULIB_FCHDIR=0; GNULIB_FCHOWNAT=0; GNULIB_FSYNC=0; GNULIB_FTRUNCATE=0; GNULIB_GETCWD=0; GNULIB_GETDOMAINNAME=0; GNULIB_GETDTABLESIZE=0; GNULIB_GETGROUPS=0; GNULIB_GETHOSTNAME=0; GNULIB_GETLOGIN=0; GNULIB_GETLOGIN_R=0; GNULIB_GETPAGESIZE=0; GNULIB_GETUSERSHELL=0; GNULIB_LCHOWN=0; GNULIB_LINK=0; GNULIB_LINKAT=0; GNULIB_LSEEK=0; GNULIB_PIPE2=0; GNULIB_PREAD=0; GNULIB_PWRITE=0; GNULIB_READLINK=0; GNULIB_READLINKAT=0; GNULIB_RMDIR=0; GNULIB_SLEEP=0; GNULIB_SYMLINK=0; GNULIB_SYMLINKAT=0; GNULIB_TTYNAME_R=0; GNULIB_UNISTD_H_GETOPT=0; GNULIB_UNISTD_H_SIGPIPE=0; GNULIB_UNLINK=0; GNULIB_UNLINKAT=0; GNULIB_USLEEP=0; GNULIB_WRITE=0; HAVE_CHOWN=1; HAVE_DUP2=1; HAVE_DUP3=1; HAVE_EUIDACCESS=1; HAVE_FACCESSAT=1; HAVE_FCHDIR=1; HAVE_FCHOWNAT=1; HAVE_FSYNC=1; HAVE_FTRUNCATE=1; HAVE_GETDOMAINNAME=1; HAVE_GETDTABLESIZE=1; HAVE_GETGROUPS=1; HAVE_GETHOSTNAME=1; HAVE_GETLOGIN=1; HAVE_GETPAGESIZE=1; HAVE_LCHOWN=1; HAVE_LINK=1; HAVE_LINKAT=1; HAVE_PIPE2=1; HAVE_PREAD=1; HAVE_PWRITE=1; HAVE_READLINK=1; HAVE_READLINKAT=1; HAVE_SLEEP=1; HAVE_SYMLINK=1; HAVE_SYMLINKAT=1; HAVE_TTYNAME_R=1; HAVE_UNLINKAT=1; HAVE_USLEEP=1; HAVE_DECL_ENVIRON=1; HAVE_DECL_GETLOGIN_R=1; HAVE_DECL_GETPAGESIZE=1; HAVE_DECL_GETUSERSHELL=1; HAVE_OS_H=0; HAVE_SYS_PARAM_H=0; REPLACE_CHOWN=0; REPLACE_CLOSE=0; REPLACE_DUP=0; REPLACE_DUP2=0; REPLACE_FCHOWNAT=0; REPLACE_GETCWD=0; REPLACE_GETGROUPS=0; REPLACE_GETPAGESIZE=0; REPLACE_LCHOWN=0; REPLACE_LINK=0; REPLACE_LINKAT=0; REPLACE_LSEEK=0; REPLACE_PREAD=0; REPLACE_PWRITE=0; REPLACE_READLINK=0; REPLACE_RMDIR=0; REPLACE_SLEEP=0; REPLACE_SYMLINK=0; REPLACE_TTYNAME_R=0; REPLACE_UNLINK=0; REPLACE_UNLINKAT=0; REPLACE_USLEEP=0; REPLACE_WRITE=0; UNISTD_H_HAVE_WINSOCK2_H=0; UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 $as_echo_n "checking whether the preprocessor supports include_next... " >&6; } if ${gl_cv_have_include_next+:} false; then : $as_echo_n "(cached) " >&6 else rm -rf conftestd1a conftestd1b conftestd2 mkdir conftestd1a conftestd1b conftestd2 cat < conftestd1a/conftest.h #define DEFINED_IN_CONFTESTD1 #include_next #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat < conftestd1b/conftest.h #define DEFINED_IN_CONFTESTD1 #include #include_next #ifdef DEFINED_IN_CONFTESTD2 int foo; #else #error "include_next doesn't work" #endif EOF cat < conftestd2/conftest.h #ifndef DEFINED_IN_CONFTESTD1 #error "include_next test doesn't work" #endif #define DEFINED_IN_CONFTESTD2 EOF gl_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_have_include_next=yes else CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_have_include_next=buggy else gl_cv_have_include_next=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$gl_save_CPPFLAGS" rm -rf conftestd1a conftestd1b conftestd2 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5 $as_echo "$gl_cv_have_include_next" >&6; } PRAGMA_SYSTEM_HEADER= if test $gl_cv_have_include_next = yes; then INCLUDE_NEXT=include_next INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next if test -n "$GCC"; then PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' fi else if test $gl_cv_have_include_next = buggy; then INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next else INCLUDE_NEXT=include INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include fi fi for ac_header in $gl_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done : if test $gl_cv_have_include_next = yes; then gl_cv_next_getopt_h='<'getopt.h'>' else { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 $as_echo_n "checking absolute name of ... " >&6; } if ${gl_cv_next_getopt_h+:} false; then : $as_echo_n "(cached) " >&6 else if test $ac_cv_header_getopt_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac gl_cv_next_getopt_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n '\#/getopt.h#{ s#.*"\(.*/getopt.h\)".*#\1# s#^/[^/]#//&# p q }'`'"' else gl_cv_next_getopt_h='<'getopt.h'>' fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_getopt_h" >&5 $as_echo "$gl_cv_next_getopt_h" >&6; } fi NEXT_GETOPT_H=$gl_cv_next_getopt_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'getopt.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_getopt_h fi NEXT_AS_FIRST_DIRECTIVE_GETOPT_H=$gl_next_as_first_directive : if test $ac_cv_header_getopt_h = yes; then HAVE_GETOPT_H=1 else HAVE_GETOPT_H=0 fi gl_replace_getopt= if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then for ac_header in getopt.h do : ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_H 1 _ACEOF else gl_replace_getopt=yes fi done fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then for ac_func in getopt_long_only do : ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only" if test "x$ac_cv_func_getopt_long_only" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_LONG_ONLY 1 _ACEOF else gl_replace_getopt=yes fi done fi if test -z "$gl_replace_getopt"; then ac_fn_c_check_decl "$LINENO" "optreset" "ac_cv_have_decl_optreset" "#include " if test "x$ac_cv_have_decl_optreset" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_OPTRESET $ac_have_decl _ACEOF if test $ac_have_decl = 1; then : else ac_fn_c_check_decl "$LINENO" "getopt_clip" "ac_cv_have_decl_getopt_clip" "#include " if test "x$ac_cv_have_decl_getopt_clip" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETOPT_CLIP $ac_have_decl _ACEOF fi fi if test -z "$gl_replace_getopt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5 $as_echo_n "checking whether getopt is POSIX compatible... " >&6; } if ${gl_cv_func_getopt_posix+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : case "$host_os" in mingw*) gl_cv_func_getopt_posix="guessing no";; darwin* | aix*) gl_cv_func_getopt_posix="guessing no";; *) gl_cv_func_getopt_posix="guessing yes";; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP # define OPTIND_MIN 0 #else # define OPTIND_MIN 1 #endif int main () { { int argc = 0; char *argv[10]; int c; argv[argc++] = "program"; argv[argc++] = "-a"; argv[argc++] = "foo"; argv[argc++] = "bar"; argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; c = getopt (argc, argv, "ab"); if (!(c == 'a')) return 1; c = getopt (argc, argv, "ab"); if (!(c == -1)) return 2; if (!(optind == 2)) return 3; } /* Some internal state exists at this point. */ { int argc = 0; char *argv[10]; int c; argv[argc++] = "program"; argv[argc++] = "donald"; argv[argc++] = "-p"; argv[argc++] = "billy"; argv[argc++] = "duck"; argv[argc++] = "-a"; argv[argc++] = "bar"; argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; c = getopt (argc, argv, "+abp:q:"); if (!(c == -1)) return 4; if (!(strcmp (argv[0], "program") == 0)) return 5; if (!(strcmp (argv[1], "donald") == 0)) return 6; if (!(strcmp (argv[2], "-p") == 0)) return 7; if (!(strcmp (argv[3], "billy") == 0)) return 8; if (!(strcmp (argv[4], "duck") == 0)) return 9; if (!(strcmp (argv[5], "-a") == 0)) return 10; if (!(strcmp (argv[6], "bar") == 0)) return 11; if (!(optind == 1)) return 12; } /* Detect MacOS 10.5, AIX 7.1 bug. */ { char *argv[3] = { "program", "-ab", NULL }; optind = OPTIND_MIN; opterr = 0; if (getopt (2, argv, "ab:") != 'a') return 13; if (getopt (2, argv, "ab:") != '?') return 14; if (optopt != 'b') return 15; if (optind != 2) return 16; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_getopt_posix=yes else gl_cv_func_getopt_posix=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5 $as_echo "$gl_cv_func_getopt_posix" >&6; } case "$gl_cv_func_getopt_posix" in *no) gl_replace_getopt=yes ;; esac fi if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt function" >&5 $as_echo_n "checking for working GNU getopt function... " >&6; } if ${gl_cv_func_getopt_gnu+:} false; then : $as_echo_n "(cached) " >&6 else # Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the # optstring is necessary for programs like m4 that have POSIX-mandated # semantics for supporting options interspersed with files. # Also, since getopt_long is a GNU extension, we require optind=0. gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes} POSIXLY_CORRECT=1 export POSIXLY_CORRECT if test "$cross_compiling" = yes; then : case $host_os:$ac_cv_have_decl_optreset in *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; *:yes) gl_cv_func_getopt_gnu=no;; *) gl_cv_func_getopt_gnu=yes;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { char *myargv[3]; myargv[0] = "conftest"; myargv[1] = "-+"; myargv[2] = 0; opterr = 0; if (getopt (2, myargv, "+a") != '?') return 1; } /* This code succeeds on glibc 2.8, mingw, and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { char *argv[] = { "program", "-p", "foo", "bar", NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') return 2; if (optarg != NULL) return 3; if (getopt (4, argv, "p::") != -1) return 4; if (optind != 2) return 5; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { char *argv[] = { "program", "foo", "-p", NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) return 6; if (getopt (3, argv, "-p") != 'p') return 7; } /* This code fails on glibc 2.11. */ { char *argv[] = { "program", "-b", "-a", NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') return 8; if (getopt (3, argv, "+:a:b") != ':') return 9; } return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : gl_cv_func_getopt_gnu=yes else gl_cv_func_getopt_gnu=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test "$gl_had_POSIXLY_CORRECT" != yes; then { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5 $as_echo "$gl_cv_func_getopt_gnu" >&6; } if test "$gl_cv_func_getopt_gnu" = "no"; then gl_replace_getopt=yes fi fi ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default" if test "x$ac_cv_have_decl_getenv" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETENV $ac_have_decl _ACEOF if test -n "$gl_replace_getopt"; then : GETOPT_H=getopt.h $as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h GNULIB_UNISTD_H_GETOPT=1 gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" : fi REPLACE_NULL=0; HAVE_WCHAR_T=1; STDDEF_H=''; { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 $as_echo_n "checking for wchar_t... " >&6; } if ${gt_cv_c_wchar_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include wchar_t foo = (wchar_t)'\0'; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gt_cv_c_wchar_t=yes else gt_cv_c_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 $as_echo "$gt_cv_c_wchar_t" >&6; } if test $gt_cv_c_wchar_t = yes; then $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h fi GNULIB_MEMCHR=0; GNULIB_MEMMEM=0; GNULIB_MEMPCPY=0; GNULIB_MEMRCHR=0; GNULIB_RAWMEMCHR=0; GNULIB_STPCPY=0; GNULIB_STPNCPY=0; GNULIB_STRCHRNUL=0; GNULIB_STRDUP=0; GNULIB_STRNCAT=0; GNULIB_STRNDUP=0; GNULIB_STRNLEN=0; GNULIB_STRPBRK=0; GNULIB_STRSEP=0; GNULIB_STRSTR=0; GNULIB_STRCASESTR=0; GNULIB_STRTOK_R=0; GNULIB_MBSLEN=0; GNULIB_MBSNLEN=0; GNULIB_MBSCHR=0; GNULIB_MBSRCHR=0; GNULIB_MBSSTR=0; GNULIB_MBSCASECMP=0; GNULIB_MBSNCASECMP=0; GNULIB_MBSPCASECMP=0; GNULIB_MBSCASESTR=0; GNULIB_MBSCSPN=0; GNULIB_MBSPBRK=0; GNULIB_MBSSPN=0; GNULIB_MBSSEP=0; GNULIB_MBSTOK_R=0; GNULIB_STRERROR=0; GNULIB_STRSIGNAL=0; GNULIB_STRVERSCMP=0; HAVE_MBSLEN=0; HAVE_MEMCHR=1; HAVE_DECL_MEMMEM=1; HAVE_MEMPCPY=1; HAVE_DECL_MEMRCHR=1; HAVE_RAWMEMCHR=1; HAVE_STPCPY=1; HAVE_STPNCPY=1; HAVE_STRCHRNUL=1; HAVE_DECL_STRDUP=1; HAVE_DECL_STRNDUP=1; HAVE_DECL_STRNLEN=1; HAVE_STRPBRK=1; HAVE_STRSEP=1; HAVE_STRCASESTR=1; HAVE_DECL_STRTOK_R=1; HAVE_DECL_STRSIGNAL=1; HAVE_STRVERSCMP=1; REPLACE_MEMCHR=0; REPLACE_MEMMEM=0; REPLACE_STPNCPY=0; REPLACE_STRDUP=0; REPLACE_STRSTR=0; REPLACE_STRCASESTR=0; REPLACE_STRERROR=0; REPLACE_STRNCAT=0; REPLACE_STRNDUP=0; REPLACE_STRNLEN=0; REPLACE_STRSIGNAL=0; REPLACE_STRTOK_R=0; UNDEFINE_STRTOK_R=0; for ac_func in $gl_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default" if test "x$ac_cv_have_decl_strdup" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRDUP $ac_have_decl _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int main () { int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t) ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 $as_echo "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) $as_echo "#define restrict /**/" >>confdefs.h ;; *) cat >>confdefs.h <<_ACEOF #define restrict $ac_cv_c_restrict _ACEOF ;; esac : if test $gl_cv_have_include_next = yes; then gl_cv_next_string_h='<'string.h'>' else { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 $as_echo_n "checking absolute name of ... " >&6; } if ${gl_cv_next_string_h+:} false; then : $as_echo_n "(cached) " >&6 else if test $ac_cv_header_string_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac gl_cv_next_string_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n '\#/string.h#{ s#.*"\(.*/string.h\)".*#\1# s#^/[^/]#//&# p q }'`'"' else gl_cv_next_string_h='<'string.h'>' fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 $as_echo "$gl_cv_next_string_h" >&6; } fi NEXT_STRING_H=$gl_cv_next_string_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'string.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_string_h fi NEXT_AS_FIRST_DIRECTIVE_STRING_H=$gl_next_as_first_directive for gl_func in memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp; do as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 $as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } if eval \${$as_gl_Symbol+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #undef $gl_func (void) $gl_func; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_gl_Symbol=yes" else eval "$as_gl_Symbol=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_gl_Symbol { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 _ACEOF eval ac_cv_have_decl_$gl_func=yes fi done if true; then GL_COND_LIBTOOL_TRUE= GL_COND_LIBTOOL_FALSE='#' else GL_COND_LIBTOOL_TRUE='#' GL_COND_LIBTOOL_FALSE= fi gl_cond_libtool=true gl_m4_base='gl/m4' gl_source_base='gl' # Code from module arg-nonnull: # Code from module c++defs: # Code from module extensions: # Code from module getopt: # Code from module getopt-gnu: $as_echo "#define GNULIB_TEST_GETOPT_GNU 1" >>confdefs.h # Code from module getopt-posix: if test -n "$gl_replace_getopt"; then : GETOPT_H=getopt.h $as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h GNULIB_UNISTD_H_GETOPT=1 gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext" gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext" : fi # Code from module gettext-h: # Code from module include_next: # Code from module stddef: if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 $as_echo_n "checking whether NULL can be used in arbitrary expressions... " >&6; } if ${gl_cv_decl_null_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int test[2 * (sizeof NULL == sizeof (void *)) -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_decl_null_works=yes else gl_cv_decl_null_works=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 $as_echo "$gl_cv_decl_null_works" >&6; } if test $gl_cv_decl_null_works = no; then REPLACE_NULL=1 STDDEF_H=stddef.h fi if test -n "$STDDEF_H"; then : if test $gl_cv_have_include_next = yes; then gl_cv_next_stddef_h='<'stddef.h'>' else { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 $as_echo_n "checking absolute name of ... " >&6; } if ${gl_cv_next_stddef_h+:} false; then : $as_echo_n "(cached) " >&6 else if test $ac_cv_header_stddef_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac gl_cv_next_stddef_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n '\#/stddef.h#{ s#.*"\(.*/stddef.h\)".*#\1# s#^/[^/]#//&# p q }'`'"' else gl_cv_next_stddef_h='<'stddef.h'>' fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 $as_echo "$gl_cv_next_stddef_h" >&6; } fi NEXT_STDDEF_H=$gl_cv_next_stddef_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'stddef.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_stddef_h fi NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive fi # Code from module strdup: : if test $ac_cv_func_strdup != yes; then gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext" : fi : if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi GNULIB_STRDUP=1 $as_echo "#define GNULIB_TEST_STRDUP 1" >>confdefs.h # Code from module string: # Code from module unistd: : if test $gl_cv_have_include_next = yes; then gl_cv_next_unistd_h='<'unistd.h'>' else { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 $as_echo_n "checking absolute name of ... " >&6; } if ${gl_cv_next_unistd_h+:} false; then : $as_echo_n "(cached) " >&6 else if test $ac_cv_header_unistd_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac gl_cv_next_unistd_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n '\#/unistd.h#{ s#.*"\(.*/unistd.h\)".*#\1# s#^/[^/]#//&# p q }'`'"' else gl_cv_next_unistd_h='<'unistd.h'>' fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 $as_echo "$gl_cv_next_unistd_h" >&6; } fi NEXT_UNISTD_H=$gl_cv_next_unistd_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'unistd.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' gl_next_as_first_directive=$gl_cv_next_unistd_h fi NEXT_AS_FIRST_DIRECTIVE_UNISTD_H=$gl_next_as_first_directive : if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else HAVE_UNISTD_H=0 fi for gl_func in chown dup2 dup3 environ euidaccess faccessat fchdir fchownat fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell lchown link linkat lseek pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat usleep; do as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 $as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } if eval \${$as_gl_Symbol+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Some systems declare various items in the wrong headers. */ #ifndef __GLIBC__ # include # include # include # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # include # endif #endif int main () { #undef $gl_func (void) $gl_func; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_gl_Symbol=yes" else eval "$as_gl_Symbol=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_gl_Symbol { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 _ACEOF eval ac_cv_have_decl_$gl_func=yes fi done # Code from module warn-on-use: # Code from module dummy: # End of code from modules gltests_libdeps= gltests_ltlibdeps= gl_source_base='tests' gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS gl_module_indicator_condition=$gltests_WITNESS for ac_prog in tar gtar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_TAR+:} false; then : $as_echo_n "(cached) " >&6 else case $TAR in [\\/]* | ?:[\\/]*) ac_cv_path_TAR="$TAR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi TAR=$ac_cv_path_TAR if test -n "$TAR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 $as_echo "$TAR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$TAR" && break done for ac_prog in source-highlight do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SOURCEHIGHLIGHT+:} false; then : $as_echo_n "(cached) " >&6 else case $SOURCEHIGHLIGHT in [\\/]* | ?:[\\/]*) ac_cv_path_SOURCEHIGHLIGHT="$SOURCEHIGHLIGHT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SOURCEHIGHLIGHT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi SOURCEHIGHLIGHT=$ac_cv_path_SOURCEHIGHLIGHT if test -n "$SOURCEHIGHLIGHT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOURCEHIGHLIGHT" >&5 $as_echo "$SOURCEHIGHLIGHT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$SOURCEHIGHLIGHT" && break done for ac_prog in gengen do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GENGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $GENGEN in [\\/]* | ?:[\\/]*) ac_cv_path_GENGEN="$GENGEN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GENGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GENGEN=$ac_cv_path_GENGEN if test -n "$GENGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENGEN" >&5 $as_echo "$GENGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$GENGEN" && break done for ac_prog in valgrind do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_VALGRIND+:} false; then : $as_echo_n "(cached) " >&6 else case $VALGRIND in [\\/]* | ?:[\\/]*) ac_cv_path_VALGRIND="$VALGRIND" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_VALGRIND="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi VALGRIND=$ac_cv_path_VALGRIND if test -n "$VALGRIND"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 $as_echo "$VALGRIND" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$VALGRIND" && break done for ac_prog in help2man do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_HELP2MAN+:} false; then : $as_echo_n "(cached) " >&6 else case $HELP2MAN in [\\/]* | ?:[\\/]*) ac_cv_path_HELP2MAN="$HELP2MAN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_HELP2MAN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi HELP2MAN=$ac_cv_path_HELP2MAN if test -n "$HELP2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HELP2MAN" >&5 $as_echo "$HELP2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$HELP2MAN" && break done if test -z "$ac_cv_path_HELP2MAN" ; then NO_HELP2MAN_TRUE= NO_HELP2MAN_FALSE='#' else NO_HELP2MAN_TRUE='#' NO_HELP2MAN_FALSE= fi if test "$ac_cv_func_strdup" = no ; then NO_STRDUP_TRUE= NO_STRDUP_FALSE='#' else NO_STRDUP_TRUE='#' NO_STRDUP_FALSE= fi if test -z "$ac_cv_path_SOURCEHIGHLIGHT" ; then NO_SOURCEHIGHLIGHT_TRUE= NO_SOURCEHIGHLIGHT_FALSE='#' else NO_SOURCEHIGHLIGHT_TRUE='#' NO_SOURCEHIGHLIGHT_FALSE= fi if test -z "$ac_cv_path_GENGEN" ; then NO_GENGEN_TRUE= NO_GENGEN_FALSE='#' else NO_GENGEN_TRUE='#' NO_GENGEN_FALSE= fi if test "$cross_compiling" = no ; then NO_CROSSCOMPILING_TRUE= NO_CROSSCOMPILING_FALSE='#' else NO_CROSSCOMPILING_TRUE='#' NO_CROSSCOMPILING_FALSE= fi for ac_prog in bash sh do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_BASH_SHELL+:} false; then : $as_echo_n "(cached) " >&6 else case $BASH_SHELL in [\\/]* | ?:[\\/]*) ac_cv_path_BASH_SHELL="$BASH_SHELL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_BASH_SHELL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BASH_SHELL=$ac_cv_path_BASH_SHELL if test -n "$BASH_SHELL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH_SHELL" >&5 $as_echo "$BASH_SHELL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$BASH_SHELL" && break done if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_config_files="$ac_config_files Makefile src/Makefile src/skels/Makefile src/tests/Makefile doc/Makefile gl/Makefile tests/Makefile tests/output_dir/Makefile tests/output_header_dir/Makefile tests/test_conf.conf tests/test_conf_inc.conf tests/test_conf_parser_ov2.c tests/test_conf_parser_ov3.c tests/test_conf_parser_ov4.c" ac_config_files="$ac_config_files tests/no_optgiven.sh" ac_config_files="$ac_config_files tests/valgrind_tests.sh" ac_config_files="$ac_config_files tests/valgrind_suppressions.sh" ac_config_files="$ac_config_files tests/more_than_once.sh" ac_config_files="$ac_config_files tests/test_all_opts.sh" ac_config_files="$ac_config_files tests/test_all_opts_file_save.sh" ac_config_files="$ac_config_files tests/test_groups.sh" ac_config_files="$ac_config_files tests/test_modes.sh" ac_config_files="$ac_config_files tests/test_conf_parser.sh" ac_config_files="$ac_config_files tests/test_conf_parser_save.sh" ac_config_files="$ac_config_files tests/test_conf_parser_grp.sh" ac_config_files="$ac_config_files tests/test_conf_parser_ov.sh" ac_config_files="$ac_config_files tests/test_conf_parser_ov2.sh" ac_config_files="$ac_config_files tests/test_conf_parser_ov3.sh" ac_config_files="$ac_config_files tests/test_conf_parser_ov4.sh" ac_config_files="$ac_config_files tests/test_conf_parser_err.sh" ac_config_files="$ac_config_files tests/test_conf_parser_err_string.sh" ac_config_files="$ac_config_files tests/test_multiple.sh" ac_config_files="$ac_config_files tests/test_multiple_err.sh" ac_config_files="$ac_config_files tests/test_simple_multiple_default.sh" ac_config_files="$ac_config_files tests/test_simple_multiple.sh" ac_config_files="$ac_config_files tests/test_sections.sh" ac_config_files="$ac_config_files tests/test_default_values.sh" ac_config_files="$ac_config_files tests/test_values.sh" ac_config_files="$ac_config_files tests/test_values_err.sh" ac_config_files="$ac_config_files tests/test_show_help.sh" ac_config_files="$ac_config_files tests/test_err.sh" ac_config_files="$ac_config_files tests/test_dep.sh" ac_config_files="$ac_config_files tests/test_manual_help.sh" ac_config_files="$ac_config_files tests/test_multiple_parsers.sh" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then as_fn_error $? "conditional \"GL_COND_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done fi gl_LIBOBJS=$gl_libobjs gl_LTLIBOBJS=$gl_ltlibobjs gltests_libobjs= gltests_ltlibobjs= if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done fi gltests_LIBOBJS=$gltests_libobjs gltests_LTLIBOBJS=$gltests_ltlibobjs if test -z "${NO_HELP2MAN_TRUE}" && test -z "${NO_HELP2MAN_FALSE}"; then as_fn_error $? "conditional \"NO_HELP2MAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NO_STRDUP_TRUE}" && test -z "${NO_STRDUP_FALSE}"; then as_fn_error $? "conditional \"NO_STRDUP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NO_SOURCEHIGHLIGHT_TRUE}" && test -z "${NO_SOURCEHIGHLIGHT_FALSE}"; then as_fn_error $? "conditional \"NO_SOURCEHIGHLIGHT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NO_GENGEN_TRUE}" && test -z "${NO_GENGEN_FALSE}"; then as_fn_error $? "conditional \"NO_GENGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NO_CROSSCOMPILING_TRUE}" && test -z "${NO_CROSSCOMPILING_FALSE}"; then as_fn_error $? "conditional \"NO_CROSSCOMPILING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by GNU gengetopt $as_me 2.22.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider. GNU gengetopt home page: . General help using GNU software: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ GNU gengetopt config.status 2.22.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/skels/Makefile") CONFIG_FILES="$CONFIG_FILES src/skels/Makefile" ;; "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "gl/Makefile") CONFIG_FILES="$CONFIG_FILES gl/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/output_dir/Makefile") CONFIG_FILES="$CONFIG_FILES tests/output_dir/Makefile" ;; "tests/output_header_dir/Makefile") CONFIG_FILES="$CONFIG_FILES tests/output_header_dir/Makefile" ;; "tests/test_conf.conf") CONFIG_FILES="$CONFIG_FILES tests/test_conf.conf" ;; "tests/test_conf_inc.conf") CONFIG_FILES="$CONFIG_FILES tests/test_conf_inc.conf" ;; "tests/test_conf_parser_ov2.c") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov2.c" ;; "tests/test_conf_parser_ov3.c") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov3.c" ;; "tests/test_conf_parser_ov4.c") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov4.c" ;; "tests/no_optgiven.sh") CONFIG_FILES="$CONFIG_FILES tests/no_optgiven.sh" ;; "tests/valgrind_tests.sh") CONFIG_FILES="$CONFIG_FILES tests/valgrind_tests.sh" ;; "tests/valgrind_suppressions.sh") CONFIG_FILES="$CONFIG_FILES tests/valgrind_suppressions.sh" ;; "tests/more_than_once.sh") CONFIG_FILES="$CONFIG_FILES tests/more_than_once.sh" ;; "tests/test_all_opts.sh") CONFIG_FILES="$CONFIG_FILES tests/test_all_opts.sh" ;; "tests/test_all_opts_file_save.sh") CONFIG_FILES="$CONFIG_FILES tests/test_all_opts_file_save.sh" ;; "tests/test_groups.sh") CONFIG_FILES="$CONFIG_FILES tests/test_groups.sh" ;; "tests/test_modes.sh") CONFIG_FILES="$CONFIG_FILES tests/test_modes.sh" ;; "tests/test_conf_parser.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser.sh" ;; "tests/test_conf_parser_save.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_save.sh" ;; "tests/test_conf_parser_grp.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_grp.sh" ;; "tests/test_conf_parser_ov.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov.sh" ;; "tests/test_conf_parser_ov2.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov2.sh" ;; "tests/test_conf_parser_ov3.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov3.sh" ;; "tests/test_conf_parser_ov4.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_ov4.sh" ;; "tests/test_conf_parser_err.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_err.sh" ;; "tests/test_conf_parser_err_string.sh") CONFIG_FILES="$CONFIG_FILES tests/test_conf_parser_err_string.sh" ;; "tests/test_multiple.sh") CONFIG_FILES="$CONFIG_FILES tests/test_multiple.sh" ;; "tests/test_multiple_err.sh") CONFIG_FILES="$CONFIG_FILES tests/test_multiple_err.sh" ;; "tests/test_simple_multiple_default.sh") CONFIG_FILES="$CONFIG_FILES tests/test_simple_multiple_default.sh" ;; "tests/test_simple_multiple.sh") CONFIG_FILES="$CONFIG_FILES tests/test_simple_multiple.sh" ;; "tests/test_sections.sh") CONFIG_FILES="$CONFIG_FILES tests/test_sections.sh" ;; "tests/test_default_values.sh") CONFIG_FILES="$CONFIG_FILES tests/test_default_values.sh" ;; "tests/test_values.sh") CONFIG_FILES="$CONFIG_FILES tests/test_values.sh" ;; "tests/test_values_err.sh") CONFIG_FILES="$CONFIG_FILES tests/test_values_err.sh" ;; "tests/test_show_help.sh") CONFIG_FILES="$CONFIG_FILES tests/test_show_help.sh" ;; "tests/test_err.sh") CONFIG_FILES="$CONFIG_FILES tests/test_err.sh" ;; "tests/test_dep.sh") CONFIG_FILES="$CONFIG_FILES tests/test_dep.sh" ;; "tests/test_manual_help.sh") CONFIG_FILES="$CONFIG_FILES tests/test_manual_help.sh" ;; "tests/test_multiple_parsers.sh") CONFIG_FILES="$CONFIG_FILES tests/test_multiple_parsers.sh" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; "tests/no_optgiven.sh":F) chmod +x tests/no_optgiven.sh ;; "tests/valgrind_tests.sh":F) chmod +x tests/valgrind_tests.sh ;; "tests/valgrind_suppressions.sh":F) chmod +x tests/valgrind_suppressions.sh ;; "tests/more_than_once.sh":F) chmod +x tests/more_than_once.sh ;; "tests/test_all_opts.sh":F) chmod +x tests/test_all_opts.sh ;; "tests/test_all_opts_file_save.sh":F) chmod +x tests/test_all_opts_file_save.sh ;; "tests/test_groups.sh":F) chmod +x tests/test_groups.sh ;; "tests/test_modes.sh":F) chmod +x tests/test_modes.sh ;; "tests/test_conf_parser.sh":F) chmod +x tests/test_conf_parser.sh ;; "tests/test_conf_parser_save.sh":F) chmod +x tests/test_conf_parser_save.sh ;; "tests/test_conf_parser_grp.sh":F) chmod +x tests/test_conf_parser_grp.sh ;; "tests/test_conf_parser_ov.sh":F) chmod +x tests/test_conf_parser_ov.sh ;; "tests/test_conf_parser_ov2.sh":F) chmod +x tests/test_conf_parser_ov2.sh ;; "tests/test_conf_parser_ov3.sh":F) chmod +x tests/test_conf_parser_ov3.sh ;; "tests/test_conf_parser_ov4.sh":F) chmod +x tests/test_conf_parser_ov4.sh ;; "tests/test_conf_parser_err.sh":F) chmod +x tests/test_conf_parser_err.sh ;; "tests/test_conf_parser_err_string.sh":F) chmod +x tests/test_conf_parser_err_string.sh ;; "tests/test_multiple.sh":F) chmod +x tests/test_multiple.sh ;; "tests/test_multiple_err.sh":F) chmod +x tests/test_multiple_err.sh ;; "tests/test_simple_multiple_default.sh":F) chmod +x tests/test_simple_multiple_default.sh ;; "tests/test_simple_multiple.sh":F) chmod +x tests/test_simple_multiple.sh ;; "tests/test_sections.sh":F) chmod +x tests/test_sections.sh ;; "tests/test_default_values.sh":F) chmod +x tests/test_default_values.sh ;; "tests/test_values.sh":F) chmod +x tests/test_values.sh ;; "tests/test_values_err.sh":F) chmod +x tests/test_values_err.sh ;; "tests/test_show_help.sh":F) chmod +x tests/test_show_help.sh ;; "tests/test_err.sh":F) chmod +x tests/test_err.sh ;; "tests/test_dep.sh":F) chmod +x tests/test_dep.sh ;; "tests/test_manual_help.sh":F) chmod +x tests/test_manual_help.sh ;; "tests/test_multiple_parsers.sh":F) chmod +x tests/test_multiple_parsers.sh ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi gengetopt-2.22.6/LICENSE0000664000175000017500000000140712044745036011536 00000000000000gengetopt - generate a C function that uses getopt_long to parse command line arguments Copyright (C) 1999-2007, Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Use of gengetopt does not impose any particular license on the generated code. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The included file 'COPYING' is a copy of the GNU General Public License. gengetopt-2.22.6/aclocal.m40000664000175000017500000011167712046536523012405 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ(2.50)dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([gl/m4/00gnulib.m4]) m4_include([gl/m4/extensions.m4]) m4_include([gl/m4/getopt.m4]) m4_include([gl/m4/gnulib-common.m4]) m4_include([gl/m4/gnulib-comp.m4]) m4_include([gl/m4/include_next.m4]) m4_include([gl/m4/onceonly.m4]) m4_include([gl/m4/stddef_h.m4]) m4_include([gl/m4/strdup.m4]) m4_include([gl/m4/string_h.m4]) m4_include([gl/m4/unistd_h.m4]) m4_include([gl/m4/warn-on-use.m4]) m4_include([gl/m4/wchar_t.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([acinclude.m4]) gengetopt-2.22.6/ChangeLog0000664000175000017500000014344412045003074012301 000000000000002012-07-18 Tim Marston * src/cmdline.ggo: added --strict-hidden option * src/gengetopt.cc: check for --strict-hidden when automatically adding full and detailed help options, and pass presence of --strict-hidden to CmdlineParserCreeator * src/gm.cc, src/gm.h: when strictly hiding options, don't generate the full help string array and override generate_hidden in generate_help_option_list(); also, don't add details to the detailed help string array for options that are going to be hidden * src/gm_utils.cpp, src/gm_utils.h: has_options_with_details() now needs to know if strict option hiding is in effect so that it can ignore options that have details but will be hidden * doc/gengetopt.texinfo: updated for --strict-hidden feature 2012-07-17 Tim Marston * src/gm.cc: fixed NULL pointer defreference; fixed option list ordering inconsistency (which could lead to truncation of displayed options) 2012-07-11 Tim Marston * src/gm_utils.cpp: fixed line wrapping so that it handles (removes) extra spaces at the end of the line 2012-07-10 Tim Marston * src/cmdline.ggo: removed unnecessary additional new-line 2012-07-10 Tim Marston * src/skels/c_source.h_skel: added args_info_versiontext variable * src/scanner.ll, src/scanner.yy: added versiontext directive * src/gengetopt.cc: added gengetopt_versiontext variable and setter function * src/gm.cc: added versiontext string generator function 2011-09-05 bettini * src/my_map.h: removed * src/my_string.h: removed * src/my_sstream.h: removed * src/gm.cc (CmdlineParserCreator::generate_usage_string): wraps and preprocess the usage string if specified in the input file. 2010-09-06 Lorenzo Bettini * src/gm_utils.cpp: do not consider a flag option as a typed one 2010-08-31 Lorenzo Bettini * tests/test_err.sh.in: double quote the variable to test * src/skels/Makefile.am (.h_skel.cc): files generated by gengen are created in the srcdir 2010-08-24 Lorenzo Bettini * src/gm.cc: initialize enum variables with generated null enum value instead of -1 * src/skels/enum_decl.h_skel: added for generating enum declaration with default null enum value 2010-03-25 bettini * src/gm_utils.cpp (not_newlines): removed code that generated a bug for escaped newlines * src/scanner.ll: handle case for \n different from \\n 2009-12-23 Lorenzo Bettini * src/Makefile.am (gengetopt_SOURCES): put generated bison and flex files in sources 2009-12-18 Lorenzo Bettini * src/skels/c_source.h_skel: removed other gcc warnings * tests/test_simple_multiple_cmd.ggo: added a simpler test for multiple options 2009-09-30 bettini * src/skels/header.h_skel: use prototypes with char ** instead of char *const *. * src/skels/c_source.h_skel: use prototypes with char ** instead of char *const *. #include not "getopt.h" 2009-09-27 bettini * tests/output_dir/Makefile.am: New file. * tests/output_header_dir/Makefile.am: New file. * tests/Makefile.am: test for --output-dir, --src-output-dir, --header-output-dir 2009-09-27 Yegor Yefremov * src/cmdline.ggo: --header-output-dir and --src_output-dir to store cmdline.h separately from cmdline.c * src/gengetopt.cc (main): Ditto * src/gm.cc: Ditto * src/gm.h: Ditto 2009-09-27 Lorenzo Bettini * doc/gengetopt.texinfo: documented autoreconf * doc/index.html: Ditto 2009-08-09 bettini * src/skels/c_source.h_skel: put FIX_UNUSED in the right place * src/gm.cc (from_value_to_enum): translate '+' to "PLUS_" and '-' to "MINUS_" (canonize_enum): Ditto (CmdlineParserCreator::generate_enum_types): put FIX_UNUSED in the right place (CmdlineParserCreator::generate_option_values): Ditto (CmdlineParserCreator::generate_option_values_decl): Ditto * tests/test_values.c (main): use enum with + and - * tests/test_values.sh.in: Ditto * tests/test_values_cmd.ggo: Ditto * configure.ac: modified to build in a different directory * Makefile.am: modified to build in a different directory * tests/Makefile.am: modified to build in a different directory 2009-06-13 bettini * doc/gengetopt.texinfo: specified that package and version are required unless you use autoconf * configure.ac: some cleanup correctly use --docdir * gl/getopt_.h: Removed. * gl/m4/onceonly_2_57.m4: Removed. * gl/strdup.h: Removed. * gl/getopt.in.h: New file. * gl/m4/00gnulib.m4: New file. * gl/m4/extensions.m4: New file. * gl/m4/include_next.m4: New file. * gl/m4/onceonly.m4: New file. * gl/m4/string_h.m4: New file. * gl/string.h: New file. * gl/string.in.h: New file. * gl/unistd.h: New file. * gl/unistd.in.h: New file. * src/gengetopt.cc: include gnulib string.h * src/gm.cc: Ditto * src/gm_utils.cpp: Ditto * src/parser.yy: Ditto * src/scanner.ll: Ditto 2009-05-31 bettini * src/skels/c_source.h_skel: use PACKAGE_NAME if defined for printing help and version 2009-05-09 bettini * configure.ac: does not depend on flex library 2009-01-25 bettini * src\skels\custom_getopt_gen.h_skel: #undef of static variables to avoid compilation problems for some versions of stdlib.h 2008-01-18 Lorenzo Bettini * src/skels/c_source.h_skel: _min and _max fields of multiple options are unsigned int to avoid compilation warnings (free_multiple_field): avoid using void **, in order to avoid a warning when using -fstring-aliasing 2008-01-13 Lorenzo Bettini * src/skels/c_source.h_skel: boolean parameters are not int instead of short in order to avoid warnings size_t used in get_multiple_token also for indexes to avoid warnings 2008-01-10 Lorenzo Bettini * src/gm.cc (handle_options): correctly call set_has_short_option * tests/test_multiple.cc (main): renames test_multiple.c to employ the C++ stronger type checking * src/gm.cc (_generate_option_arg): fixed bug that did not generate a longlong pointer in case of multiple options, reported by Richard Eggert 2007-12-13 Lorenzo Bettini * src/skels/c_source.h_skel: also write the corresponding value (not only the orig filed) into file 2007-11-05 Lorenzo Bettini * src/skels/c_source.h_skel: update_arg is not generated if no option (besides the default ones) are specified in the .ggo file * src/parser.yy: added the details for options 2007-10-25 Lorenzo Bettini * src/scanner.ll: added the type enum that can be used for options with values 2007-10-24 Lorenzo Bettini * src/gm.cc (generate_help_option_print): in case of hidden options, the generated help string array reuses the strings of the full help array (generate_init_args_info): skip elements related to text before and after an option and also related to groups 2007-10-23 Lorenzo Bettini * src/skels/c_source.h_skel: the params_init function now initializes the structure fields to their default values. a params_create function was added to allocate such a structure and initialize it (to its default values) usage string is printed only if not empty (as suggested by Gyozo Papp) 2007-10-17 J. David Bryan * src/gengetopt.cc (main): generate --help handling if only -h is redefined (and so for --version) * src/skels/header.h_skel: added field print_errors to suppress getopt_long messages to stderr 2007-10-16 Papp Gyozo * src/skels/c_source.h_skel: added the generated function _dump to dump options into an already open stream 2007-10-07 Lorenzo Bettini * src/skels/c_source.h_skel: (update_multiple_arg) the static generated function that takes care of updating a multiple option 2007-10-02 Lorenzo Bettini * src/skels/c_source.h_skel: (update_arg) the static generated function that takes care of updating an option 2007-09-21 Lorenzo Bettini * doc/Makefile.am: avoid tests if crosscompiling * tests/Makefile.am: avoid tests if crosscompiling 2007-07-28 Lorenzo Bettini * COPYING: updated to version 3 * src/skels/c_source.h_skel: correctly handle multiple options with backslashes (thanks to Peter Kovacs) * doc/Makefile.am: removed non-standard %. rules * src/skels/Makefile.am: removed non-standard %. rules * src/Makefile.am: removed non-standard %. rules * tests/Makefile.am: added explicit deps for .h and .c generated files (to make parallel make work) 2007-07-09 Lorenzo Bettini * src/skels/header.h_skel: define a structure for passing parameters to the parsers; and define versiones of parsers taking the params through this structure. Added the check_ambiguity parameter to check whether an option that is parsed is already present in the args_info struct Contains doxygen documentation 2007-07-01 Lorenzo Bettini * src/gengetopt.cc (main): store args_info values after having examined also the (possible) args entry in the .ggo file (bug fixed) 2007-06-16 Lorenzo Bettini * doc/gengetopt.texinfo (Configuration files): fixed override semantics documentation 2007-06-08 Lorenzo Bettini * src/skels/custom_getopt_gen.h_skel: does not check d->custom_optind == 1 as an initialization condition since it is not correct 2007-05-04 Lorenzo Bettini * src/gm.cc (generate_handle_help): correctly generate the return inside the if in case of no_handle_help and full-help * configure.ac: removed AC_C_CONST since obsolescent * src/cxxconfig.h: removed 2007-04-15 Lorenzo Bettini * src/cmdline.ggo: --default-optional added * src/ggos.cpp: required default depends on --default-optional * src/global_options.h: (struct GlobalOptions) contains options concerning the program (typically passed on the command line) * src/gm.cc (generate_help_option_list): don't generate a section if all of its options are hidden 2007-04-12 Lorenzo Bettini * src/skels/custom_getopt_gen.h_skel: declare all the needed structures and variables * src/skels/c_source.h_skel: don't include getopt.h if --include-getopt is specified 2007-01-20 Lorenzo Bettini * autogen.sh: added (replaces reconf) for bootstrapping autotools * configure.ac: use libtool now 2007-01-12 Lorenzo Bettini * src/scanner.ll: # comments not in strings (thanks to Matthew K. Junker) 2007-01-09 Lorenzo Bettini * tests/test_err.sh.in: don't use -r GNU sed extension option, use -e instead 2007-01-06 Lorenzo Bettini * doc/Makefile.am (cmdline2.o): make sure to use the complete compile command (that ensures the priority of headers from gnulib) 2006-12-19 Lorenzo Bettini * src/gm.cc (generate_handle_help): also handle full-help 2006-12-11 Lorenzo Bettini * configure.ac: use of Gnulib 2006-11-17 Lorenzo Bettini * src/parser.yy: Added description string 2006-10-05 Lorenzo Bettini * src/skels/c_source.h_skel (_configfile): handle configuration file inclusione (thanks to David Bird) 2006-09-30 Lorenzo Bettini * src/scanner.ll: strings can spawn more lines 2006-09-23 Lorenzo Bettini * src/scanner.ll: correctly handle size specification of multiple options (bug fixed by Christian Ch'Gans) * src/gm.cc (generate_usage_string): handle no argument options and flag options in generation of long help 2006-09-03 Lorenzo Bettini * src/gm.cc (generate_help_option_list): first print the section 2006-09-02 Lorenzo Bettini * src/gengetopt.cc (output_formatted_string): remove the \ from a " (so that the " is actually printed on the screen instead of \") 2006-07-02 Lorenzo Bettini * src/skels/header.h_skel: use the passed header extension * src/skels/c_source.h_skel: use the passed header extension 2006-05-14 Lorenzo Bettini * src/skels/c_source.h_skel: for comma separated multi option arguments, recognize the escape character 2006-05-13 Lorenzo Bettini * src/skels/custom_getopt_gen.h_skel: Andre Noll provided a customized version of getopt that can be called many times without affecting previously parsed arguments. 2006-05-07 Lorenzo Bettini * src/cmdline.ggo: --output-dir command line option 2006-04-02 Lorenzo Bettini * src/gm.cc: generate only one list struct for each type (not one for each multiple option) 2006-03-26 Lorenzo Bettini * src/skels/header.h_skel: usage string 2006-03-25 Lorenzo Bettini * src/skels/check_multiple.h_skel: check for multiple option occurrence range 2006-03-23 Lorenzo Bettini * src/gm.cc (generate_free): generate the index i even if no multiple option is of type string 2006-03-10 Lorenzo Bettini * src/skels/header.h_skel: help strings and help fields 2006-02-25 Lorenzo Bettini * src/gm.cc (generate_help_option_list): make sure not to use a negative number as a size to create a string, bug fixed 2006-02-16 Lorenzo Bettini * src/skels/c_source.h_skel: set optind to 0 before invoking getopt_long, in order to discard any internal pointers and restart from scratch with the given argc, argv, rather than continue to parse the command line from the previous run. (as suggested by Andre Noll) 2006-02-12 Lorenzo Bettini * src/skels/c_source.h_skel: cmd_line_list is generated as static and this enables linking different parsers into the same executable (as suggested by Andre Noll) * src/gm.cc: deal with --full-help in the presence of hidden options 2005-12-22 Lorenzo Bettini * src/skels/update_arg.h_skel: added the check for the result of a numeric conversion 2005-09-07 Lorenzo Bettini * src/ggos.h (struct gengetopt_option): store input filename and line number information (struct gengetopt_option): added the dependson field 2005-09-06 Lorenzo Bettini * tests/test_all_opts_cmd.ggo: has a hidden option that can be specified but does not appear in the help output * src/ggos.h (struct gengetopt_option): added the hidden field 2005-09-05 Lorenzo Bettini * src/parser.yy: the parts of options can be given in any order 2005-09-03 Lorenzo Bettini * src/skels/generic_option.h_skel: name for enumerated values is prefixed with the parser name 2005-08-16 Lorenzo Bettini * src/ggo_options.h (foropt): use && to assign *it to opt instead of the , otherwise with gcc 4.0.1 it segfaults 2005-08-13 Lorenzo Bettini * src/gm.cc (generate_handle_group): when we check for a required option of a group we also check that "check_required" was specified. Otherwise the check is performed in the _required generated function. 2005-08-12 Lorenzo Bettini * src/skels/option_arg.h_skel: Added the _orig field that stores the original value passed at the command line. 2005-08-10 Lorenzo Bettini * src/skels/file_save.h_skel: saves args_info contents into a file. * src/skels/c_source.h_skel (configfile): use dynamic memory instead of a static vector. Use a constant that can be redefined upon compilation for the size of a line read from the configuration file. 2005-07-06 Lorenzo Bettini * src/gengetopt.cc (main): check whether an option for help and version is already present, thus allowing redefining the standard --help,-h and --version,-V options 2005-04-13 Lorenzo Bettini * src/gm_utils.cpp (char_is_newline): fixed a problem with a string containing only new line chars (wrap_cstr): keep the right number of new line chars 2004-12-30 Lorenzo Bettini * src/skels/handle_help.h_skel: free local_args_info before exiting or returning * src/skels/handle_version.h_skel: free local_args_info before exiting or returning 2004-11-25 Lorenzo Bettini * tests/valgrind_tests.sh.in: updated, for some time it hasn't checked correctly for leaks. Many leaks have been removed again now 2004-10-28 * src/parser.yy: group options can be multiple and have argoptional * src/skels/multiple_option.h_skel: the test for values is performed after tokenizing arguments possibly separated by commas * src/skels/multiple_option_new_list_node.h_skel: removed embedded in multiple_option.h_skel 2004-09-22 Lorenzo Bettini * src/gm.cc (_generate_option_arg): simplified using option_arg_gen_class * src/skels/option_arg.h_skel: to generate the _arg fields of args_struct * src/gm.cc (do_update_arg): simplified using update_arg_gen_class * src/skels/update_arg.h_skel: replace all the other generators for single data types 2004-09-17 Lorenzo Bettini * src/gm.cc (handle_options): only one function to deal both with option with short version and without * src/ggos.h (struct gengetopt_option): not an invasive list, only an option, and the list of option is implemented as a std::list 2004-09-16 Lorenzo Bettini * src/skels/c_source.h_skel: define also the function to expliticly check whether a required option has been provided * src/cmdline.ggo: option --show-help that only prints how the output of --help would be, without generating code --show-version that only prints how the output of --version would be, without generating code --set-package and --set-version to set these values 2004-09-14 Lorenzo Bettini * src/gm.cc: use argv[0] when printing errors * src/cmdline.ggo: each option has a short version 2004-09-13 Lorenzo Bettini * src/parser.yy: accept the list of values that can be passed to an option * src/acceptedvalues.h (class AcceptedValues): possible values for an option 2004-08-10 Lorenzo Bettini * src/gm.cc (generate_reset_groups): generate the reset function only if this group has options * src/skels/c_source.h_skel: many additional .h_skel files have been removed, and their contents are included here using the new conditional constructs of gengen 2004-08-03 Lorenzo Bettini * src/skels/config_parser_source.h_skel: better check for string well-formedness 2004-07-11 Lorenzo Bettini * src/gm_utils.cpp: contain utility functions used in gm * src/fileutils.cpp: file routines used in gm * src/gm.cc: (wrap_cstr) do not consider '=' a separating character (is_char_newline) recognize also actual \n (generate_help_option_print) deal better with very long descriptions 2004-06-16 Lorenzo Bettini * src/gm.cc (generate_help_option_print): set the maximum for the column where the description of an option starts to be displayed. In case it starts on a new line 2004-06-15 Lorenzo Bettini * src/gm.cc (wrap_cstr): wrapping is isolated in a function so that it can be used also for printing purposes and other descriptions 2004-06-13 Lorenzo Bettini * src/skels/config_parser_source.h_skel: deal with '=' in the config files 2004-05-16 Lorenzo Bettini * src/gm.cc (generate_option_given): _given field is generated unsigned for multiple options 2004-05-01 Lorenzo Bettini * src/gm.cc (do_update_arg): set the argument to NULL if it is a multiple string option 2004-04-08 Lorenzo Bettini * NEWS: Version 2.12 * src/cmdline.ggo: Added --c-extension and --header-extension as proposed by Brooks Davis 2004-04-01 Lorenzo Bettini * src/gm.cc (generate_help_option_print): generate the printf with "%s", so that default values can contain % 2004-02-21 Lorenzo Bettini * src/skels/config_parser_source.h_skel: idem * src/skels/c_source.h_skel: exit failure is only in one point so that the args_info struct can be cleared (removed memory leaks) 2004-02-03 Lorenzo Bettini * src/parser.yy: allow multiple options without argument * src/skels/multiple_option_new_list_node.h_skel: added to separate creation of a multiple option list node, so that also multiple options without argument can be handled 2004-01-18 Lorenzo Bettini * src/skels/config_parser_source.h_skel: check for len > and not ==. rewritten in order to exploit getopt_long 2004-01-13 Lorenzo Bettini * src/skels/generic_option_group.h_skel: before incrementing the counter, if override is specified, reset all the group options * src/skels/reset_group.h_skel: template function for resetting a group option 2004-01-11 Lorenzo Bettini * src/skels/multiple_fill_array.h_skel: leave the multiple options in the same order they are given * src/skels/generic_option.h_skel: check a local struct to understand whether the same option is given more than once * src/skels/config_parser_source.h_skel: the # can also be in non first position in a line. the generated config file parser relies on the standard command line parser * src/skels/c_source.h_skel: the main parsing function is a static internal function _internal that also takes the parameter check_required that decides whether required options are checked; and also an additional error string explaining where the error occurred default is "" 2004-01-06 Lorenzo Bettini * src/conf_parser_gen.cc (generate_multiple_fill_array): update multiple options * src/skels/multiple_fill_array_default.h_skel: check whether the default has not been previously set 2004-01-05 Lorenzo Bettini * src/skels/multiple_opt_struct.h_skel: the creation of structs for multiple option lists is separated from the actual declaration of lists * src/skels/string_opt_arg.h_skel: always free previous memory before * src/skels/string_opt_arg_no_free.h_skel: initialize a string withouth freeing memory before 2004-01-03 Lorenzo Bettini * src/cmdline.ggo: --unamed-opts can be given an optional argument describing the additional arguments without names, default is still FILES * src/gm.cc (do_update_arg): add the check for optarg that is important for options with optional arguments (generate_usage_string): use the specified name for unamed-options * src/cmdline.ggo: --arg-struct-name option for specifying the name of the generated struct for args info, default is still gengetopt_args_info * src/skels/config_parser_source.h_skel: added a parameter to the config file parser that specifies whether the args_info has to be initialized * src/skels/c_source.h_skel: an _init function is also generated instead of clear_args that allows to initialize an args_info struct 2004-01-02 Lorenzo Bettini * src/gm.cc (generate_free): added for freeing the memory used by gengetopt strduped strings and multiple options arrays (generate_clear_arg): clear_args is called only once, before starting the parsing 2003-11-26 Lorenzo Bettini * src/gengetopt.cc (gengetopt_add_option): deal with options with optional arguments * src/parser.yy: allow an option to have an optional argument * src/skels/gen_strdup.h_skel: check whether the string to copy is not null 2003-10-25 Lorenzo Bettini * src/cmdline.ggo: added the flag to turn off generation of gengetopt version number in the output file * src/skels/c_source.h_skel: config.h is included before any other header 2003-07-23 Lorenzo Bettini * src/Makefile.am (AM_LFLAGS): use case insensitive option for generating the scanner 2003-07-22 Lorenzo Bettini * src/gm.cc (generate_help_option_print): generate also group description * src/scanner.ll: recognize groupdesc * src/groups.h (struct Group): contain group information, added group description 2003-07-19 Lorenzo Bettini * src/gm.cc (generate_help_option_print): generate also section information * src/gengetopt.cc (gengetopt_set_section): set the current section during parsing * src/ggos.h (struct gengetopt_option): include section field 2003-07-18 Lorenzo Bettini * src/parser.yy: sectiondef for defining section of options * src/skels/string_opt_arg_free.h_skel: added to free memory allocated for default string value when an argument is given 2003-07-06 Michael Hagemann * src/scanner.ll: recognize typestr option * src/gm.cc (generate_help_option_print): generate a more compact --help output (generate_help_desc_print): added, perform word wrapping for long help lines * src/gengetopt.cc (gengetopt_add_option): also handle type_str * src/parser.yy: some clean up and parsing of typestr for the description of the type of the option, see below * src/ggos.h (struct gengetopt_option): added type_str: a more descriptive description of the type of an option, e.g., "filename" instead of simply STRING 2003-07-05 Lorenzo Bettini * src/gm.cc (generate_handle_no_short_option): deal also with multiple options * src/skels/multiple_option_no_short.h_skel: added to deal with multiple option with no short version * src/gm.cc (generate_multiple_fill_array): if a default value is provided for this multipl option, generate the else branch for setting the value of the option to the default value * src/skels/multiple_fill_array_default.h_skel: added to handle default values for multiple options * src/skels/multiple_fill_array.h_skel (if): allocate an array only if a value is given for this multiple option * src/gm.cc (generate_clear_arg): always initialize to NULL the _arg of a multiple option (it is always a pointer) 2003-06-15 Lorenzo Bettini * src/skels/config_parser_source.h_skel: fixed a problem in setting the terminating '\0' 2003-05-22 Lorenzo Bettini * NEWS: Version 2.10 2003-05-21 Lorenzo Bettini * src/skels/config_parser_source.h_skel: Also handle quoted strings 2003-05-12 Lorenzo Bettini * src/skels/gen_strdup.h_skel: added for generating strdup in the generated parser * src/gm.cc (CmdlineParserCreator): fixed some compilation errors due to the ? operator * src/conf_parser_gen.cc (generate_handle_single_option): use long_long_gen for dealing with long long * src/skels/copyright.h_skel: added for generating the copyright * src/gengetopt.cc (print_reportbugs): do not use reportbugs.text anymore (print_copyright): use copyright_gen_class 2003-05-01 Lorenzo Bettini * src/skels/header.h_skel: package and version are defined for a parser and values defined in the .ggo have the precedence over PACKAGE and VERSION * src/skels/long_long_opt_arg.h_skel: added for handling long long options 2003-04-29 Lorenzo Bettini * src/gm.cc (generate_handle_group): handle possible space in group names * src/yyerror.cc (yyerror): get a const char * * src/skels/c_source.h_skel: initialize stop_char to 0 and this should avoid compilation warning 2003-04-24 Lorenzo Bettini * src/gm.cc: always use gengetopt_strdup in generated files * src/skels/c_source.h_skel: gengetopt_strdup is generated even if strdup is in the standard library * configure.in: check for long long * src/gm.cc (do_update_arg): switch to long if long long is not supported 2003-04-19 Lorenzo Bettini * src/skels/multiple_fill_array.h_skel: explicitly cast the result of malloc * src/skels/multiple_option.h_skel: explicitly cast the result of malloc * tests/test_conf_parser.c (main): removed C++ style comment * src/gm.cc: correctly refer to strdup * src/gengetopt.cc: correctly refer to strdup * acinclude.m4 (AC_adl_FUNC_GETOPT_LONG): added for correctly checking for getopt.h and getopt_long 2003-04-13 Lorenzo Bettini * NEWS: Version 2.9 * src/gm.cc (generate_handle_no_short_option): handle group options without short options * tests/Makefile.am (check-diff): check with diff also the output of tests * src/parser.yy: (check_result) correctly print the line number containing the error * src/gm.cc: (strip_path) remove path information when generating some header file information (e.g., #ifndef) 2003-03-17 Lorenzo Bettini * src/Makefile.am: explicit rules do not use $< * tests/Makefile.am: explicit rules do not use $< * doc/Makefile.am: explicit rules do not use $< 2003-02-21 Lorenzo Bettini * src/scanner.ll: ignore \r characters 2002-12-30 Lorenzo Bettini * NEWS: Version 2.8 2002-11-28 Janico Greifenberg * src/skels/multiple_option.h_skel: skeleton for handling a multiple option * src/skels/multiple_opt_list.h_skel: skeleton for the list structure * src/skels/multiple_fill_array.h_skel: skeleton file for filling the array for multiple options * src/gm.cc (generate_option_arg): handle multiple options (generate_multiple_fill_array): fill the array of multiple otpions 2002-11-18 Janico Greifenberg * src/parser.yy (exp): Added multiple option 2002-09-04 Lorenzo Bettini * src/scanner.ll: turned in a C++ scanner * src/parser.yy: turned in a C++ parser 2002-08-25 Lorenzo Bettini * src/conf_parser_gen.h (class ConfigParserGenerator): take care of generating the config file parser * src/skels/config_parser_source.h_skel: added to generate the config file parser 2002-08-22 Lorenzo Bettini * src/gm.cc (generate_help_option_print): also print group for group options * src/yyerror.c (yyerror): also print position of error * src/parser.y (exp_yesno): removed a useless rule for standard options 2002-08-18 Ronnie Lazar * src/skels/int_opt_arg.h_skel: use strtol as well so to handle integer in hex format * src/parser.y: deal with group option * src/skels/group_option.h_skel: added to handle errors with group handling * src/gm.cc (generate_handle_option): generate group handling * src/ggos.h (struct gengetopt_option): added group_value field * src/gengetopt.cc (gengetopt_add_group): handle group options 2002-08-15 Pierre Bacquet * src/parser.y (check_result): use error code 5 for invalid default values * src/ggos.h (struct gengetopt_option): default values are always stored in a string * src/gengetopt.cc (gengetopt_add_option): use strtod and strtol to handle default values for long and double options 2002-08-15 Lorenzo Bettini * configure.in: move to automake 1.6.2 and autoconf 2.53 2002-07-21 Lorenzo Bettini * NEWS: Version 2.7.1 released 2002-07-13 Lorenzo Bettini * src/skels: generators are generated with version 0.4.1 that does not repeat default values in the .cc sources; this used to cause problems with some gcc 3.x versions. Indeed that was an error. 2002-07-10 Lorenzo Bettini * src/Makefile.am (INCLUDES): do not add includes directory, this way if sstream is provided by the compiler, that version is used. 2002-07-07 Lorenzo Bettini * configure.in: Added check for stl and namespaces 2002-06-30 Lorenzo Bettini * NEWS: Version 2.7 released 2002-05-31 Lorenzo Bettini * src/gm.cc (do_update_arg): manually generate break 2002-04-01 Lorenzo Bettini * src/gm.cc (generate_strdup): generate strdup function between #ifndef HAVE_STRDUP, in order to avoid the warning * tests/Makefile.am (check-diff): Added target to check whether the generated code is different from what it used to be 2002-03-11 Lorenzo Bettini * src/skels/header.h_skel: removed the misleading "WRITE THE NAME OF YOUR PROGRAM HERE" from the generated header 2002-03-09 Lorenzo Bettini * src/yyerror.c (yyerror): print the input file name * src/gm.cc (generate_header_file): simply rely on the code generated by gengen (generate_option_arg): implicitly called when option args struct members are to be created (generate_option_given): the same but for _given fields * src/gm.h (class CmdlineParserCreator): inherit from header_gen_class generated by gengen * src/skels/header.h_skel: the skeleton for generated header file * configure.in (GENGEN): use gengen for automatically generate a generator 2002-03-02 Lorenzo Bettini * src/gm.cc (generate): gm.c is removed, now we have a class and methods: I switched to C++ !!! :-) * src/gm.h (class CmdlineParserCreator): class for the command line parser generator * NEWS: Version 2.6 released * src/cmdline.ggo: use defaults for func-name and file-name 2002-03-01 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): possibly generate assignments for default values * src/ggos.h (struct gengetopt_option): added fields for default values * src/gengetopt.c (gengetopt_add_option): do not consider an error an empty desc (main): set comment[1][0] to 0 after malloc (gengetopt_add_option): also handle default values 2001-12-31 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): if HAVE_STRDUP is defined then use the standard strdup use EXIT_FAILURE and EXIT_SUCCESS for exit * src/parser.y: an empty line at the end of the .ggo file is no longer needed * src/scanner.l (update_count_line): update gengetopt_count_line also within a string TOK_MLSTRING; this way possible errors in the .ggo files are notified with the right line number for # comments '\n' are excluded * src/gm.c (canonize_names): Added to canonize a name (generate_cmdline_parser): function names and #define directives are canonized * tests/canonize-names-cmd.ggo: Added to test how function names and #define directives are canonized 2001-12-18 Lorenzo Bettini * NEWS: Version 2.5 released 2001-12-16 Lorenzo Bettini * configure.in: test for alloca is no more necessary with these new versions of getopt * src/getopt.c: much more modern version taken from GNU C library * src/getopt1.c: much more modern version taken from GNU C library * src/getopt.h: much more modern version taken from GNU C library 2001-11-12 Brian Minard * src/gm.c (gengetopt_strlen): removed, it is no use (generate_cmdline_parser) gengetopt_strdup is generated from gengetopt_strdup.text * src/gengetopt_strdup.text: automatically generated from strdup.c 2001-11-01 Brian Minard * src/gm.c (generate_cmdline_parser): use (size_t) for specifying malloc argument when generating gengetopt_strdup 2001-10-09 Herbert Thoma * src/gm.c (generate_cmdline_parser): generate a different printf in the generated print_help function for every option, thus avoiding to generate an help string that's too long 2001-09-03 Guillaume Chazarain * src/gm.c (do_check_option_given): Set args_info->option_given to 1 also when option is a flag (bug fixed). 2001-08-13 Lorenzo Bettini * NEWS: Version 2.4 released 2001-06-24 Lorenzo Bettini * doc/Makefile.am: testdata is not removed as a maintainer file * src/gm.c: included string.h * src/scanner.l: included string.h 2001-06-10 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): optind is generated = 1, otherwise it doesn't work with cygwin 2001-05-19 Lorenzo Bettini * src/strdup.c (strdup): Test for a bad allocation and return 0 in that case 2001-05-06 Lorenzo Bettini * tests/Makefile.am (no_optgiven_cmd.c): this file it is generated with --no-handle-error option * src/cmdline.ggo: Added no-handle-error * src/Makefile.am: the command line parser is generated with the option --no-handle-help * src/gm.c (generate_cmdline_parser): Added generation of instructions that let the command line parser to be called more than once, suggested by Eric H Kinzie . (generate_error_handle): Added to generate return 1 instead of exit 1 if --no-handle-error is given. Thus print_help is not autmoatically called when an option is given more than once, as it was before * tests/more_than_once.c (main): Call the command line parser twice and print the values of the parameters * tests/more_than_once.sh.in: Added to test when the command line parser is called more than once * doc/gengetopt.html.in: updated footer copyright * configure.in: moved to 2.4 2001-05-05 Lorenzo Bettini * tests/no_optgiven.sh.in: removed the negation !, not recognized on some systems. * tests/Makefile.am (LDFLAGS): Added to use INCLUDES also in the linking, because some files are compiled in that moment * doc/Makefile.am (INCLUDES): Added (EXTRA_DIST): removed getopt.h from this directory * tests/Makefile.am (INCLUDES): and (LDADD) to consider the case that there's no getopt_long in the C library * configure.in: moved to 2.3.1 2001-04-10 Lorenzo Bettini * Version 2.3 * tests/Makefile.am (TESTS): Added tests 2001-03-23 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): gengetopt_strdup is only generated if a string option is used or --unamed-opt was specified * tests/Makefile.am: Added * src/gm.c (generate_cmdline_parser): for inputs gengetopt_strdup, instead of standard strdup, is used. 2001-03-22 Lorenzo Bettini * doc/no_getopt_long.txt: Added alloca instructions 2001-03-20 Lorenzo Bettini * src/gengetopt.c (main): handle --help and --version * src/copyright.text: Added to be processed by txtc compiler * configure.in: use TXTC * src/gm.c (generate_cmdline_parser): if previous options are given do not print help and version automatically and exit. Provide the functions for print_help and print_version prefixing with function_name parameter * src/cmdline.ggo: Added --no-handle-help and --no-handle-version not to handle --help and --version automatically * doc/Makefile.am (check): diff with the previous output 2001-02-09 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): generate print also if no purpose is specified (bug fixed) 2001-02-06 Lorenzo Bettini * acinclude.m4 (AC_NONGNU_FLAGS): Added to check if it is a non-GNU compiler and if it handles -Aa option * src/cxxconfig.h: Added to make const work for C++ compilers even if it doesn't work for C compilers * configure.in: Added test for AC_C_CONST 2001-02-04 Lorenzo Bettini * src/alloca.c: Added taken from GNU hello * configure.in: Added AC_FUNC_ALLOCA * src/cmdline.ggo: Added purpose * src/gm.c (generate_cmdline_parser): print_version and print_help are public 2001-01-30 Berthold H�llmann * src/gm.c (generate_cmdline_parser): purpose is generated in print_help * src/parser.y: PURPOSE added to the syntax * src/scanner.l: TOK_MLSTRING for strings with newline * src/gengetopt.c (gengetopt_define_purpose): 2001-01-11 Lorenzo Bettini * NEWS: version 2.2 released * doc/no_getopt_long.txt: Added AC_SUBST when you use AC_CHECK_FUNCS * src/gm.c (generate_cmdline_parser): changed the style of all printf, when strings are in more than one line 2000-12-04 Robert Walsh * src/gm.c: changed the style of printf strings, removed C++ comment, now compile without warning under Sun compiler. 2000-11-01 Richard Heggs * src/gm.c: VERSION and PACKAGE are generated in cmdline.h instead of cmdline.c 2000-10-10 Person or Persons Unknown * src/gengetopt.c: handle long options with no short option. * src/gm.c: handle long options with no short option. 2000-10-09 Scott Haug * src/gm.c: change argv's type from 'char**' to 'char * const *'. This better matches the type signature of getopt_long, and it prevents compiler warnings. #undef's PACKAGE and VERSION before setting them, in case they are defined in the .ggo file. 2000-09-26 N. Becker * src/scanner.l: now accepts any string * src/parser.y: exp_str is only TOK_STRING 2000-09-20 Lorenzo Bettini (LAP) * NEWS: version 2.1 released * doc/Makefile.am: examples are installed in a subdirectory under doc * doc/gengetopt.html.in: the version number is substituted by configure * src/gm.c: (generate_cmdline_parser) fixed a bug for the generated code, a malloc was not casted * doc/gengetopt.1.in: modified by James R. Van Zandt * doc/gengetopt.html: we do not include sections from the GNU coding standards. * LICENSE: the generated code is not under any license 2000-08-01 Lorenzo Bettini * NEWS: version 2.0 released * doc/gengetopt.html: warning for win32 users, and md5sum and gpg signed * doc/Makefile.am (cmdline1.c.html): bug fixed for win * src/Makefile.am: check if gengetopt is already build before trying to build cmdline.c 2000-07-31 Lorenzo Bettini * doc/Makefile.am (cmdline1.c.html): no recompilation if cpp2html is not installed * configure.in (NO_CPP2HTML): if cpp2html is not installed 2000-07-30 Lorenzo Bettini (LAP) * doc/gengetopt.1.in: made it obsolete * doc/no_getopt_long.txt: how to check if getopt_long is in the standard library and what to do if it is not. * doc/gengetopt.html: mailing lists * LICENSE: Copyright is assigned in behalf of the Free Software Foundation. 2000-07-23 Lorenzo Bettini (LAP) * doc/man_getopt.html: added, it is the man page of getopt * doc/Makefile.am (gengetoptdoc_DATA): also examples are in doc dir * configure.in (CPP2HTML): use cpp2html to format sample files * src/cmdline.ggo: no option is required * src/gm.c: generate the test for required options * src/ggos.h (struct gengetopt_option): field for flagstat and for required * src/gm.c (generate_cmdline_parser): initialize flags and strings * Makefile.am (gengetoptdoc_DATA): install ChangeLog and other files in doc dir * src/gm.c (generate_cmdline_parser): fixed a bug about wrong indentation in .h generated file. 2000-07-09 Lorenzo Bettini * src/gm.c (indent): Added for indenting like GNU standards (check_option_given): function instead of macro (generate_cmdline_parser): now indent according to GNU standards 2000-07-01 Lorenzo Bettini * src/gm.c (generate_cmdline_parser): "redeclared" error message renamed in "given more than once" * configure.in (gengetoptdocdir): use $datadir instead of $prefix 2000-01-12 Lorenzo Bettini * doc/Makefile.am (man_MANS): man page installed, and html pages 2000-01-10 Lorenzo Bettini * doc/Makefile.am: check for NO_GETOPTLONG and NO_STRDUP, and in case link with .o in src dir * configure.in (TAR): check for tar program. (NO_GETOPTLONG): a conditional for check 2000-01-10 Lorenzo Bettini * doc/Makefile.am: added sample1 and sample2, two test programs sample1 is a C++ prog, and uses unamed options * configure.in: (AC_PROG_CXX) we use C++ in a test file 2000-01-09 Lorenzo Bettini * src/cmdline.ggo: it contains gengetopt command line * src/gengetopt.c (gengetopt_strdup) (gengetopt_strcmp): erased. (main): handles command line options * configure.in (strdup): if not found we use our strdup.c (const): check if const is supported * src/gm.c (generate_cmdline_parser): gets unamed_options param to generate unamed_options fields in the structure. char **inputs and inputs_num added to the structure to hold unamed options. string.h included. create an header file and an output file. the header file can used in C++ as well. for ARG_NO options a _given field is generated and handled. a comment can be passed, e.g. the command line used to generate file, to be printed in the comment at the top of generated file. 2000-01-09 Lorenzo Bettini (LAP) * src/gm.c: a struct is generated for args info, instead of using variables 2000-01-08 Lorenzo Bettini (LAP) * src/gm.h : Added * src/gm.c (generate_cmdline_parser): generate_main renamed config.h is included with " instead of <>. the name of the function to generate is passed. * src/ggos.h: config.h included: VERSION and PACKAGE are defined there * configure.in: (--enable-warnings) option added to configure this way -Wall is added to compiler options. * src/gengetopt.h: added with functions exported by gengetopt.c * src/parser.y: inclusion of stdlib for malloc and free, and string.h extern yyerror and yylex, include gengetopt.h. automake renames y.tab.c in parser.c * src/yyerror.c (yyerror): made it void * src/scanner.l: scanner.lex renamed scanner.l, and it includes parser.h, renamed by automake. automake renames the c file to scanner.c * started to use automake and autoconf; created src and doc dir gengetopt-2.22.6/Makefile.am0000664000175000017500000000164212044745036012566 00000000000000# Copyright (C) 1999-2007 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, see . ACLOCAL_AMFLAGS = -I m4 -I gl/m4 EXTRA_DIST = configure TODO LICENSE gl/m4/gnulib-cache.m4 SUBDIRS = gl src doc tests gengetoptdoc_DATA = ChangeLog COPYING NEWS THANKS INSTALL README LICENSEgengetopt-2.22.6/doc/0000775000175000017500000000000012046541044011347 500000000000000gengetopt-2.22.6/doc/help_modes.output.texinfo0000664000175000017500000000204612044745316016353 00000000000000test_modes 1.0 Usage: test_modes [-h|--help] [-V|--version] [-N|--no-mode] [--no-mode2=STRING] or : test_modes -d|--optd [--optc] or : test_modes -ASTRING|--optA=STRING [-a|--opta] [-MSTRING|--optAmul=STRING] [-b|--optb] or : test_modes [-mINT|--mopt=INT] -h, --help Print help and exit -V, --version Print version and exit some non mode options: -N, --no-mode a generic option not beloging to any mode --no-mode2=STRING another generic option not beloging to any mode some modes just for testing: Mode: mode1 any option of this mode is in contrast with any option of the other mode Notice that this description is quite long so it may spawn many lines... fortunately gengetopt will wrap it for you :-) -a, --opta string a -A, --optA[=STRING] string A -M, --optAmul[=STRING] string M -b, --optb string b Mode: mode 2 --optc string c -d, --optd string d Mode: my mode -m, --mopt=INT option of my mode gengetopt-2.22.6/doc/multiple_example.c.texinfo0000664000175000017500000000143412046536546016471 00000000000000@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite @example @r{@i{/* test options that can be given more than once */}} @b{#ifdef} HAVE_CONFIG_H @b{#include} @t{"config.h"} @b{#endif} @b{#include} @t{} @b{#include} @t{} @b{#include} @t{"test_multiple_cmd.h"} @b{static} @b{struct} gengetopt_args_info args_info; @b{int} main (@b{int} argc, @b{char} **argv) @{ @b{int} i = 0; @b{if} (test_multiple_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; @b{for} (i = 0; i < args_info.string_given; ++i) printf (@t{"passed string: %s}\n@t{"}, args_info.string_arg[i]); @b{for} (i = 0; i < args_info.int_given; ++i) printf (@t{"passed int: %d}\n@t{"}, args_info.int_arg[i]); @b{return} 0; @} @end examplegengetopt-2.22.6/doc/testdata0000664000175000017500000000567312045003074013031 00000000000000This one is from a C++ program Try to launch me with some options (type sample1 --help for the complete list) For example: ./sample1 *.* --funct-opt Here are the options you passed... file: cmdline1.c file: cmdline2.c This is the integer you input: 10. The flag option was given! The flag is on. Hello! Have a nice day! :-) This one is from a C++ program Try to launch me with some options (type sample1 --help for the complete list) For example: ./sample1 *.* --funct-opt sample1 2.0 Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT] [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING] [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --str-opt=filename A string option, for a filename A brief text description before the other options. -m, --my-opt=INT Another integer option, this time the description of the option should be "quite" long to require wrapping... possibly more than one wrapping :-) especially if I require a line break -i, --int-opt=INT A int option (mandatory) more involved options: the following options are more complex --flag-opt A flag option (default=off) -F, --funct-opt A function option last option section: --long-opt=LONG A long option --def-opt=STRING A string option with default (default=`Hello') --enum-opt=STRING A string option with list of values (possible values="foo", "bar", "hello", "bye" default=`hello') -D, --dependant=INT option that depends on str-opt An ending text. Here is the version GNU gengetopt 2.0 This is a simple test for gengetopt GNU gengetopt 2.0 this is just a test program for gengetopt Usage: sample2 [OPTIONS]... [FILES]... -h, --help Print help and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --str-opt=STRING A string option -i, --int-opt=INT A int option -S, --short-opt=SHORT A short option -l, --long-opt=LONG A long option -f, --float-opt=FLOAT A float option -d, --double-opt=DOUBLE A double option -L, --long-double-opt=LONGDOUBLE A long double option -y, --long-long-opt=LONGLONG A long long option -F, --func-opt A function option -x, --flag-opt A flag option (default=off) gengetopt-2.22.6/doc/test_conf_parser_ov2.c.texinfo0000664000175000017500000000367012046536546017255 00000000000000@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite @example @r{@i{/* test_conf_parser_ov2.c test */}} @r{@i{/* test all kinds of options and the conf file parser */}} @r{@i{/* differently from test_conf_parser_ov.c, first scan the conf file and}} @r{@i{ then the command line */}} @b{#ifdef} HAVE_CONFIG_H @b{#include} @t{"config.h"} @b{#endif} @b{#include} @t{} @b{#include} @t{} @b{#include} @t{"test_conf_parser_cmd.h"} @b{static} @b{struct} my_args_info args_info; @b{int} main (@b{int} argc, @b{char} **argv) @{ @b{struct} test_conf_parser_cmd_parser_params *params; @r{@i{/* initialize the parameters structure */}} params = test_conf_parser_cmd_parser_params_create(); @r{@i{/* }} @r{@i{ initialize args_info, but don't check for required options}} @r{@i{ NOTICE: the other fields are initialized to their default values}} @r{@i{ */}} params->check_required = 0; @r{@i{/* call the config file parser */}} @b{if} (test_conf_parser_cmd_parser_config_file (@t{"../../tests/test_conf2.conf"}, &args_info, params) != 0) exit(1); @r{@i{/* }} @r{@i{ override config file options,}} @r{@i{ do not initialize args_info, check for required options.}} @r{@i{ */}} params->initialize = 0; params->override = 1; params->check_required = 1; @r{@i{/* call the command line parser */}} @b{if} (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0) exit(1) ; printf (@t{"value of required: %s}\n@t{"}, args_info.required_arg); printf (@t{"value of string: %s}\n@t{"}, args_info.string_arg); printf (@t{"value of no-short_given: %d}\n@t{"}, args_info.no_short_given); printf (@t{"value of int: %d}\n@t{"}, args_info.int_arg); printf (@t{"value of float: %f}\n@t{"}, args_info.float_arg); @r{@i{/* release memory */}} test_conf_parser_cmd_parser_free (&args_info); free (params); @b{return} 0; @} @end examplegengetopt-2.22.6/doc/multiple_example.c0000664000175000017500000000107312045003074014775 00000000000000/* test options that can be given more than once */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "test_multiple_cmd.h" static struct gengetopt_args_info args_info; int main (int argc, char **argv) { int i = 0; if (test_multiple_cmd_parser (argc, argv, &args_info) != 0) exit(1) ; for (i = 0; i < args_info.string_given; ++i) printf ("passed string: %s\n", args_info.string_arg[i]); for (i = 0; i < args_info.int_given; ++i) printf ("passed int: %d\n", args_info.int_arg[i]); return 0; } gengetopt-2.22.6/doc/Makefile.in0000664000175000017500000014031512046536525013350 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 1999-2009 Free Software Foundation, Inc. # # This file is part of GNU gengetopt # # GNU gengetopt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU gengetopt is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with gengetopt; see the file COPYING. If not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ EXTRA_PROGRAMS = sample1$(EXEEXT) sample2$(EXEEXT) subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/stamp-vti $(srcdir)/version.texi ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gl/m4/00gnulib.m4 \ $(top_srcdir)/gl/m4/extensions.m4 \ $(top_srcdir)/gl/m4/getopt.m4 \ $(top_srcdir)/gl/m4/gnulib-common.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/onceonly.m4 \ $(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \ $(top_srcdir)/gl/m4/string_h.m4 \ $(top_srcdir)/gl/m4/unistd_h.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_sample1_OBJECTS = cmdline1.$(OBJEXT) main1.$(OBJEXT) sample1_OBJECTS = $(am_sample1_OBJECTS) sample1_LDADD = $(LDADD) sample1_DEPENDENCIES = $(top_builddir)/gl/libgnu.la am_sample2_OBJECTS = cmdline2.$(OBJEXT) main2.$(OBJEXT) sample2_OBJECTS = $(am_sample2_OBJECTS) sample2_LDADD = $(LDADD) sample2_DEPENDENCIES = $(top_builddir)/gl/libgnu.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(sample1_SOURCES) $(sample2_SOURCES) DIST_SOURCES = $(sample1_SOURCES) $(sample2_SOURCES) INFO_DEPS = $(srcdir)/gengetopt.info TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux DVIS = gengetopt.dvi PDFS = gengetopt.pdf PSS = gengetopt.ps HTMLS = gengetopt.html TEXINFOS = gengetopt.texinfo TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html DVIPS = dvips am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(gengetoptdocdir)" \ "$(DESTDIR)$(gengetoptexamplesdir)" am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(gengetoptdoc_DATA) $(gengetoptexamples_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_SHELL = @BASH_SHELL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GENGEN = @GENGEN@ GETOPT_H = @GETOPT_H@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_DUP3 = @GNULIB_DUP3@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@ GNULIB_MBSCHR = @GNULIB_MBSCHR@ GNULIB_MBSCSPN = @GNULIB_MBSCSPN@ GNULIB_MBSLEN = @GNULIB_MBSLEN@ GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@ GNULIB_MBSNLEN = @GNULIB_MBSNLEN@ GNULIB_MBSPBRK = @GNULIB_MBSPBRK@ GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@ GNULIB_MBSRCHR = @GNULIB_MBSRCHR@ GNULIB_MBSSEP = @GNULIB_MBSSEP@ GNULIB_MBSSPN = @GNULIB_MBSSPN@ GNULIB_MBSSTR = @GNULIB_MBSSTR@ GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@ GNULIB_MEMCHR = @GNULIB_MEMCHR@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_PIPE2 = @GNULIB_PIPE2@ GNULIB_PREAD = @GNULIB_PREAD@ GNULIB_PWRITE = @GNULIB_PWRITE@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_SLEEP = @GNULIB_SLEEP@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ GNULIB_STRSEP = @GNULIB_STRSEP@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ GNULIB_UNLINK = @GNULIB_UNLINK@ GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DUP2 = @HAVE_DUP2@ HAVE_DUP3 = @HAVE_DUP3@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PIPE2 = @HAVE_PIPE2@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HELP2MAN = @HELP2MAN@ INCLUDE_NEXT = @INCLUDE_NEXT@ INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ # we don't have to link to anything LIBS = LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STRING_H = @NEXT_STRING_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LINK = @REPLACE_LINK@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMCHR = @REPLACE_MEMCHR@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_NULL = @REPLACE_NULL@ REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PWRITE = @REPLACE_PWRITE@ REPLACE_READLINK = @REPLACE_READLINK@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ REPLACE_UNLINK = @REPLACE_UNLINK@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WRITE = @REPLACE_WRITE@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOURCEHIGHLIGHT = @SOURCEHIGHLIGHT@ STDDEF_H = @STDDEF_H@ STRIP = @STRIP@ TAR = @TAR@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gengetoptdocdir = @gengetoptdocdir@ gengetoptexamplesdir = @gengetoptexamplesdir@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT) MAKE_SAMPLES = $(MAKE) $(AM_MAKEFLAGS) $(EXTRA_PROGRAMS) SAMPLES_STAMP = samples.stamp GGO_FILES = $(srcdir)/sample1.ggo $(srcdir)/sample2.ggo # man page man_MANS = gengetopt.1 sample1_SOURCES = cmdline1.c main1.cc sample2_SOURCES = cmdline2.c main2.c # these are for gnulib AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl LDADD = $(top_builddir)/gl/libgnu.la gengetoptdoc_DATA = gengetopt.html index.html gengetoptexamples_DATA = sample1.ggo sample2.ggo main1.cc main2.c \ cmdline1.c cmdline1.h cmdline2.c cmdline2.h \ README.example AM_MAKEINFOHTMLFLAGS = --no-split # for including generated texinfo files AM_MAKEINFOFLAGS = -I$(srcdir) info_TEXINFOS = gengetopt.texinfo #gengetopt_TEXINFOS = $(GENERATEDINFOS) GENERATEDINFOS = cmdline1.h.texinfo main1.cc.texinfo \ test_conf_parser.c.texinfo \ test_conf_parser_ov2.c.texinfo help_output.texinfo \ multiple_example.c.texinfo \ test_multiple_parsers.c.texinfo \ sample1.ggo.texinfo sample1.output.texinfo sample1_2.output.texinfo \ test_modes_cmd.ggo.texinfo \ help_modes.output.texinfo BUILT_SOURCES = $(GENERATEDINFOS) RUNSOURCEHIGHLIGHT = $(SOURCEHIGHLIGHT) -f texinfo --style-file=texinfo.style --output-dir=$(top_builddir)/doc/ SUFFIXES = .h.texinfo .cc.texinfo .c.texinfo .ggo.texinfo .ggo EXTRA_DIST = sample1.ggo sample2.ggo samples.stamp \ cmdline1.c cmdline1.h cmdline2.c cmdline2.h \ $(man_MANS) $(gengetoptdoc_DATA) \ testdata \ $(GENERATEDINFOS) \ input.sed \ multiple_example.c \ README.example # session for tests RUN_SAMPLE1 = ./sample1$(EXEEXT) -i 10 --flag-opt cmdline?.c RUN_SAMPLE1_1 = ./sample1$(EXEEXT) --help --int-opt -34 # the next one generates an error 'cause -i option is not given RUN_SAMPLE1_2 = ./sample1$(EXEEXT) -F RUN_SAMPLE2 = ./sample2$(EXEEXT) -i 10 -l 20 RUN_SAMPLE2_1 = ./sample2$(EXEEXT) --version RUN_SAMPLE2_2 = ./sample2$(EXEEXT) --help CLEANFILES = $(EXTRA_PROGRAMS) DISTCLEANFILES = cmdline1.h cmdline1.c cmdline2.h \ cmdline2.c test.out samples.stamp $(BUILT_SOURCES) MAINTAINERCLEANFILES = cmdline1.c cmdline2.c cmdline1.h cmdline2.h \ $(SAMPLES_STAMP) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .h.texinfo .cc.texinfo .c.texinfo .ggo.texinfo .ggo .c .cc .dvi .h .html .info .lo .o .obj .pdf .ps .texinfo $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): sample1$(EXEEXT): $(sample1_OBJECTS) $(sample1_DEPENDENCIES) $(EXTRA_sample1_DEPENDENCIES) @rm -f sample1$(EXEEXT) $(CXXLINK) $(sample1_OBJECTS) $(sample1_LDADD) $(LIBS) sample2$(EXEEXT): $(sample2_OBJECTS) $(sample2_DEPENDENCIES) $(EXTRA_sample2_DEPENDENCIES) @rm -f sample2$(EXEEXT) $(LINK) $(sample2_OBJECTS) $(sample2_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdline1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdline2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main2.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs .texinfo.info: restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ then \ rc=0; \ $(am__cd) $(srcdir); \ else \ rc=$$?; \ $(am__cd) $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc .texinfo.dvi: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2DVI) $< .texinfo.pdf: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2PDF) $< .texinfo.html: rm -rf $(@:.html=.htp) if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ rm -rf $@; \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ else \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi $(srcdir)/gengetopt.info: gengetopt.texinfo $(srcdir)/version.texi gengetopt.dvi: gengetopt.texinfo $(srcdir)/version.texi gengetopt.pdf: gengetopt.texinfo $(srcdir)/version.texi gengetopt.html: gengetopt.texinfo $(srcdir)/version.texi $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: gengetopt.texinfo $(top_srcdir)/configure @(dir=.; test -f ./gengetopt.texinfo || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/build-aux/mdate-sh $$dir/gengetopt.texinfo`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp @cmp -s vti.tmp $(srcdir)/version.texi \ || (echo "Updating $(srcdir)/version.texi"; \ cp vti.tmp $(srcdir)/version.texi) -@rm -f vti.tmp @cp $(srcdir)/version.texi $@ mostlyclean-vti: -rm -f vti.tmp maintainer-clean-vti: -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi .dvi.ps: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf gengetopt.aux gengetopt.cp gengetopt.cps gengetopt.fn gengetopt.fns \ gengetopt.ky gengetopt.kys gengetopt.log gengetopt.pg \ gengetopt.pgs gengetopt.tmp gengetopt.toc gengetopt.tp \ gengetopt.tps gengetopt.vr gengetopt.vrs clean-aminfo: -test -z "gengetopt.dvi gengetopt.pdf gengetopt.ps gengetopt.html" \ || rm -rf gengetopt.dvi gengetopt.pdf gengetopt.ps gengetopt.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-gengetoptdocDATA: $(gengetoptdoc_DATA) @$(NORMAL_INSTALL) @list='$(gengetoptdoc_DATA)'; test -n "$(gengetoptdocdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gengetoptdocdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gengetoptdocdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gengetoptdocdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gengetoptdocdir)" || exit $$?; \ done uninstall-gengetoptdocDATA: @$(NORMAL_UNINSTALL) @list='$(gengetoptdoc_DATA)'; test -n "$(gengetoptdocdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(gengetoptdocdir)'; $(am__uninstall_files_from_dir) install-gengetoptexamplesDATA: $(gengetoptexamples_DATA) @$(NORMAL_INSTALL) @list='$(gengetoptexamples_DATA)'; test -n "$(gengetoptexamplesdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gengetoptexamplesdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gengetoptexamplesdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gengetoptexamplesdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gengetoptexamplesdir)" || exit $$?; \ done uninstall-gengetoptexamplesDATA: @$(NORMAL_UNINSTALL) @list='$(gengetoptexamples_DATA)'; test -n "$(gengetoptexamplesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(gengetoptexamplesdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(INFO_DEPS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(gengetoptdocdir)" "$(DESTDIR)$(gengetoptexamplesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: $(DVIS) html: html-am html-am: $(HTMLS) info: info-am info-am: $(INFO_DEPS) install-data-am: install-gengetoptdocDATA \ install-gengetoptexamplesDATA install-info-am install-man install-dvi: install-dvi-am install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-html: install-html-am install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-am install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf: pdf-am pdf-am: $(PDFS) ps: ps-am ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-gengetoptdocDATA \ uninstall-gengetoptexamplesDATA uninstall-html-am \ uninstall-info-am uninstall-man uninstall-pdf-am \ uninstall-ps-am uninstall-man: uninstall-man1 .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-aminfo \ clean-generic clean-libtool ctags dist-info distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am \ install-gengetoptdocDATA install-gengetoptexamplesDATA \ install-html install-html-am install-info install-info-am \ install-man install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean \ mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-vti pdf pdf-am ps ps-am tags \ uninstall uninstall-am uninstall-dvi-am \ uninstall-gengetoptdocDATA uninstall-gengetoptexamplesDATA \ uninstall-html-am uninstall-info-am uninstall-man \ uninstall-man1 uninstall-pdf-am uninstall-ps-am @NO_HELP2MAN_TRUE@gengetopt.1: $(top_srcdir)/src/cmdline.ggo @NO_HELP2MAN_TRUE@ touch $@ @NO_HELP2MAN_FALSE@gengetopt.1: $(top_srcdir)/src/cmdline.ggo @NO_HELP2MAN_FALSE@ $(HELP2MAN) $(PROGNAME) --help-option="--detailed-help" > $@ $(srcdir)/gengetopt.texinfo: $(GENERATEDINFOS) @NO_SOURCEHIGHLIGHT_TRUE@.h.h.texinfo: @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@.cc.cc.texinfo: @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@test_conf_parser.c.texinfo: $(top_srcdir)/tests/test_conf_parser.c @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@test_conf_parser_ov2.c.texinfo: $(top_builddir)/tests/test_conf_parser_ov2.c @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@test_multiple_parsers.c.texinfo: $(top_srcdir)/tests/test_multiple_parsers.c @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@test_modes_cmd.ggo.texinfo: $(top_srcdir)/tests/test_modes_cmd.ggo @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@.c.c.texinfo: @NO_SOURCEHIGHLIGHT_TRUE@ touch $@ @NO_SOURCEHIGHLIGHT_TRUE@.ggo.ggo.texinfo: @NO_SOURCEHIGHLIGHT_TRUE@ cat $< | sed -f $(srcdir)/input.sed > $@ @NO_SOURCEHIGHLIGHT_FALSE@.h.h.texinfo: @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $< @NO_SOURCEHIGHLIGHT_FALSE@.cc.cc.texinfo: @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $< @NO_SOURCEHIGHLIGHT_FALSE@test_conf_parser.c.texinfo: $(top_srcdir)/tests/test_conf_parser.c @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $(top_srcdir)/tests/test_conf_parser.c @NO_SOURCEHIGHLIGHT_FALSE@test_conf_parser_ov2.c.texinfo: $(top_builddir)/tests/test_conf_parser_ov2.c @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $(top_builddir)/tests/test_conf_parser_ov2.c @NO_SOURCEHIGHLIGHT_FALSE@test_multiple_parsers.c.texinfo: $(top_srcdir)/tests/test_multiple_parsers.c @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $(top_srcdir)/tests/test_multiple_parsers.c @NO_SOURCEHIGHLIGHT_FALSE@.c.c.texinfo: @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $< @NO_SOURCEHIGHLIGHT_FALSE@test_modes_cmd.ggo.texinfo: $(top_srcdir)/tests/test_modes_cmd.ggo @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $(top_srcdir)/tests/test_modes_cmd.ggo --failsafe @NO_SOURCEHIGHLIGHT_FALSE@.ggo.ggo.texinfo: @NO_SOURCEHIGHLIGHT_FALSE@ $(RUNSOURCEHIGHLIGHT) $< --failsafe help_output.texinfo: $(top_srcdir)/src/cmdline.ggo $(PROGNAME) --show-help -i $(top_srcdir)/src/cmdline.ggo --set-package="gengetopt" --set-version="" > $@ help_modes.output.texinfo: $(top_srcdir)/tests/test_modes_cmd.ggo $(PROGNAME) --show-help --long-help -i $(top_srcdir)/tests/test_modes_cmd.ggo > $@ sample1.output.texinfo: sample1.ggo $(MAKE) $(AM_MAKEFLAGS) sample1$(EXEEXT) ./sample1$(EXEEXT) --help | sed -f $(srcdir)/input.sed > $@ sample1_2.output.texinfo: sample1.ggo $(MAKE) $(AM_MAKEFLAGS) sample1$(EXEEXT) ./sample1$(EXEEXT) --detailed-help | sed -f $(srcdir)/input.sed > $@ cmdline1.h: cmdline1.c cmdline1.c: sample1.ggo $(PROGNAME) -i $(srcdir)/sample1.ggo -Fcmdline1 --long-help -u --show-required cmdline2.h: cmdline2.c cmdline2.c: sample2.ggo $(PROGNAME) --input=$(srcdir)/sample2.ggo --func-name=my_cmdline_parser --file-name=cmdline2 --unamed-opts --no-handle-help --no-handle-version #cmdline1.o: cmdline1.c # $(CC) $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) -c cmdline1.c cmdline2.o: cmdline2.c $(COMPILE) -DMY_CMDLINE_PARSER_PACKAGE=\"sample2\" -DMY_CMDLINE_PARSER_VERSION=\"2.0\" -c cmdline2.c @NO_CROSSCOMPILING_TRUE@check-am: testdata @NO_CROSSCOMPILING_TRUE@ rm -f test.out @NO_CROSSCOMPILING_TRUE@ touch $(GGO_FILES) @NO_CROSSCOMPILING_TRUE@ $(MAKE) $(AM_MAKEFLAGS) sample1$(EXEEXT) sample2$(EXEEXT) @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1) >> test.out && \ @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1_1) >> test.out && \ @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2) >> test.out || \ @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1_2) 2>> test.out @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2_1) >> test.out @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2_2) >> test.out @NO_CROSSCOMPILING_TRUE@ @echo expect no output from diff @NO_CROSSCOMPILING_TRUE@ diff $(srcdir)/testdata test.out @NO_CROSSCOMPILING_TRUE@testdata: @NO_CROSSCOMPILING_TRUE@ rm -f testdata @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1) >> testdata @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1_1) >> testdata @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2) >> testdata || \ @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE1_2) 2>> testdata @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2_1) >> testdata @NO_CROSSCOMPILING_TRUE@ $(RUN_SAMPLE2_2) >> testdata # this is to build samples once gengetopt has changed # this is for development only. samples: $(SAMPLES_STAMP) $(MAKE) $(AM_MAKEFLAGS) $(EXTRA_PROGRAMS) # echo timestamp > $(SAMPLES_STAMP) $(SAMPLES_STAMP): $(PROGNAME) touch $(GGO_FILES) echo timestamp > $(SAMPLES_STAMP) clean_gen: rm -f $(GENERATEDINFOS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gengetopt-2.22.6/doc/stamp-vti0000664000175000017500000000014612046536546013152 00000000000000@set UPDATED 2 November 2012 @set UPDATED-MONTH November 2012 @set EDITION 2.22.6 @set VERSION 2.22.6 gengetopt-2.22.6/doc/sample2.ggo0000664000175000017500000000221612046536672013344 00000000000000# Name of your program #package "gengetopt-sample" # don't use package if you're using automake # Version of your program #version "1.0.1" # don't use version if you're using automake purpose "this is just a test program for gengetopt" # Options option "str-opt" s "A string option" string optional option "int-opt" i "A int option" int required option "short-opt" S "A short option" short optional option "long-opt" l "A long option" long required option "float-opt" f "A float option" float optional option "double-opt" d "A double option" double optional option "long-double-opt" L "A long double option" longdouble optional option "long-long-opt" y "A long long option" longlong optional option "func-opt" F "A function option" optional option "hidden-opt" N "A hidden option" optional hidden option "flag-opt" x "A flag option" flag off # This option turn on or off a flag, last column is the state of the flag when # program start. If user specify it, flag toggles. gengetopt-2.22.6/doc/gengetopt.html0000664000175000017500000053673112046536666014206 00000000000000 GNU Gengetopt 2.22.6

GNU Gengetopt 2.22.6


Next: , Previous: (dir), Up: (dir)

Gengetopt

Gengetopt is a tool to write command line option parsing code for C programs.

This is Edition 2.22.6 of the Gengetopt manual.

This file documents GNU Gengetopt version 2.22.6.

This manual is for GNU Gengetopt (version 2.22.6, 2 November 2012), a tool to write command line option parsers for C programs.

Copyright © 2001 - 2011 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”

(a) The FSF's Back-Cover Text is: “You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.”


Next: , Previous: Top, Up: Top

Audience

Gengetopt is a tool to generate C code to parse the command line arguments argc and argv that are part of every C or C++ program. The generated code uses the C library function getopt_long to perform the actual command line parsing.

This manual is written for C and C++ programmers, specifically the lazy ones. If you've written any non-trivial C program, you've had to deal with argument parsing. It isn't particularly difficult, nor is it particularly exciting. It is one of the classic programming nuisances, which is why most books on programming leave it as an exercise for the reader. Gengetopt can save you from this work, leaving you free to focus on the interesting parts of your program.

Thus your program will be able to handle command line options such as:

     myprog --input foo.c -o foo.o --no-tabs -i 100 *.class

And both long options (those that start with --) and short options (start with - and consist of only one character) can be handled (see Terminology for further details). For standards about short and long options you may want to take a look at the GNU Coding Standards (http://www.gnu.org/prep/standards_toc.html).

Gengetopt can also generate a function to save the command line options into a file (see Basic Usage), and a function to read the command line options from a file (see Configuration files). Of course, these two kinds of files are compliant.

Generated code works also if you use GNU Autoconf and GNU Automake and it is documented with Doxygen comments. In particular, PACKAGE, PACKAGE_NAME and VERSION are used in the generated code to print information.


Next: , Previous: Audience, Up: Top

Gengetopt Copying Conditions

Gengetopt is free software; you are free to use, share and modify it under the terms of the GNU General Public License that accompanies this manual.

The code that Gengetopt generates is also free software; however it is licensed with a simple all-permissive license instead of the GPL or LGPL. You are free to do anything you like with the generated code, including incorporating it into or linking it with proprietary software.

Gengetopt was originally written by Roberto Arturo Tena Sanchez. It is currently maintained by Lorenzo Bettini http://www.lorenzobettini.it.

A primordial version of Terminology was written by Adam Greenblatt.


Next: , Previous: Copying, Up: Top

1 Installation

See the file INSTALL for detailed building and installation instructions; anyway if you're used to compiling Linux software that comes with sources you may simply follow the usual procedure, i.e. untar the file you downloaded in a directory and then:

     cd <source code main directory>
     ./configure
     make
     make install

Note: unless you specify a different install directory by --prefix option of configure (e.g. ./configure --prefix=<your home>), you must be root to run make install.

Files will be installed in the following directories:

executables
/prefix/bin
docs
/prefix/share/doc/gengetopt
examples
/prefix/share/doc/gengetopt/examples
additional files
/prefix/share/gengetopt

Default value for prefix is /usr/local but you may change it with --prefix option to configure.

1.1 Download

You can download it from GNU's ftp site: ftp://ftp.gnu.org/gnu/gengetopt or from one of its mirrors (see http://www.gnu.org/prep/ftp.html).

I do not distribute Windows binaries anymore; since, they can be easily built by using Cygnus C/C++ compiler, available at http://www.cygwin.com. However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail (find my e-mail at my home page) and I can send them to you.

Archives are digitally signed by me (Lorenzo Bettini) with GNU gpg (http://www.gnupg.org). My GPG public key can be found at my home page (http://www.lorenzobettini.it).

You can also get the patches, if they are available for a particular release (see below for patching from a previous version).

1.2 Anonymous Git Checkout

This project's git repository can be checked out through the following clone instruction1:

     git clone git://git.savannah.gnu.org/gengetopt.git

Further instructions can be found at the address:

http://savannah.gnu.org/projects/gengetopt.

And the git repository can also browsed on-line at

http://git.savannah.gnu.org/cgit/gengetopt.git.

Please note that this way you will get the latest development sources of Gengetopt, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources.

If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the tag rel_X_Y_Z.

When you compile the sources that you get from the git repository, before running the configure and make commands, for the first time, you must run the command:

     autoreconf -i

This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake, autoconf and libtool in order for this to succeed.

1.3 What you need to build gengetopt

Gengetopt has been developed under GNU/Linux, using gcc (C++), and bison (yacc) and flex (lex), and ported under Win32 with Cygnus C/C++compiler, available at http://www.cygwin.com.

For developing gengetopt, I use the excellent GNU Autoconf2, GNU Automake3 and GNU Libtool4. Since version 2.19 I also started to use Gnulib - The GNU Portability Library5, “a central location for common GNU code, intended to be shared among GNU packages” (for instance, I rely on Gnulib for checking for the presence and correctness of getopt_long function, Use Gnulib).

Moreover GNU Gengen (http://www.gnu.org/software/gengen) is used for automatically generating the code that generates the command line parser.

Actually, you don't need all these tools above to build gengetopt because I provide generated sources, unless you want to develop gengetopt.

The code generated by gengetopt relies on the getopt_long function that is usually in the standard C library; however, there may be some implementations of the C library that don't include it; we refer to No getopt_long, for instructions on how to check whether getopt_long is part of the library and how to deal with their lacking (using autoconf and automake).

1.4 Patching from a previous version

If you downloaded a patch, say gengetopt-1.3-1.3.1-patch.gz (i.e., the patch to go from version 1.3 to version 1.3.1), cd to the directory with sources from the previous version (gengetopt-1.3) and type:

     gunzip -cd ../gengetopt-1.3-1.3.1.patch.gz | patch -p1

and restart the compilation process (if you had already run configure a simple make should do).


Next: , Previous: Installation, Up: Top

2 Basic Usage

The command line options, which have to be handled by gengetopt generated function, are specified in a file (typically with .ggo extension). This file consists of sentences with the formats shown below (these sentences are allowed to span more than one line). Statements in {} are optional (the option sentences need not to be given in separate lines):

     package "<packname>"
     version "<version>"
     purpose "<purpose>"
     usage "<usage>"
     description "<description>"
     versiontext "<versiontext>"
     
     args "<command line options>"
     
     option <long> <short> "<desc>"
         {details="<detailed description>"}
         {argtype} {typestr="<type descr>"}
         {values="<value1>","<value2>",...}
         {default="<default value>"}
         {dependon="<other option>"}
         {required} {argoptional} {multiple}
         {hidden}
     
     option <long> <short> "<desc>" flag <on/off>
     
     section "section name" {sectiondesc="optional section description"}
     
     text "a textual sentence"

Where:

package
This has the precedence over PACKAGE and PACKAGE_NAME generated by autoconf. This is required, unless you use autoconf.

If package is specified, then it will be used to print the program name in the output of --help and --version, and also when printing errors (from within the generated parser). If it is not specified, then PACKAGE will be used when printing errors, and PACKAGE_NAME in the output of --help and --version. Note that if PACKAGE_NAME is empty, then PACKAGE will be used also in this case.

version
This has the precedence over VERSION generated by autoconf. This is required, unless you use autoconf.
purpose
What the program does (even on more than one line), it will be printed with the help, before the usage string. Optional.
usage
The “Usage” string that will be printed with the help6. If not specified, it will be generated automatically. Optional.
description
The “Description” string that will be printed with the help7, after the usage string. Optional.
versiontext
Additional information that will be printed after the program name and version in the output of --version. This would be used, for example, to display copyright and licensing information.
args
With args8 you can specify options that will be added to the command line options of gengetopt itself. For instance, if you always run gengetopt on your input file with the options --no-handle-error --string-parser -u, you can add these options in the input file like this:
          args "--no-handle-error --string-parser -u"

and remove those recurrent options from the command line. Optional.

long
The long option, a double quoted string with upper and lower case characters, digits, a dash (-) and a dot (.). No spaces allowed. The name of the variables generated to store arguments (see later in this section) are long options converted to be legal C variable names. This means that . and - are both replaced by _.


short
The short option, a single upper or lower case char, or a digit. If a - is specified, then no short option is considered for the long option (thus long options with no associated short options are allowed). Since version 2.22 you can also specify ? as the short option.


desc
This description will be printed during the output of --help. Wrapping will be automatically performed.
details
This is an extended description string for the option that will be printed (after the option) during the output of --detailed-help9, which will be automatically generated. Thus, these further details will NOT be printed with --help. Wrapping will be automatically performed. Optional.

Note that if --strict-hidden is used, options that are hidden (See Hidden options.) will not appear in the output of --detailed-help, even if those options have details.


argtype
string, int, short, long, float, double, longdouble or longlong. If the option is an enumerated one (see Options with enumerated values) the type can also be enum. If no type is specified the option does not accept an argument.


typestr
a description for the type of the values for the option. This will be used during the output of --help (e.g., "filename" instead of simply STRING, or "portnumber" instead of simply INT).


values
a list of strings containing all the possible values that can be passed to the option. If not specified, the type is considered string10. For this kind of options, the type can also be enum. More on this feature can be found in Options with enumerated values.


default
an optional default value for the option. The value must always be specified as a double quoted string. It is possible to combine this with the multiple flag (Multiple Options) but only by giving a single default value. It is not possible to specify a list of default values.


dependon
this option depends on another option (whose long name description is specified). If this option is given at command line but not the option it depends on, an error will be generated.


required
required or optional. This specifies whether such option must be given at each program invocation. These keywords were introduced in release 2.17. Before, you had to use the keywords yes or no. You can still use these keywords but their use is not advised since they are not much explicative.

If not specified, an option is considered mandatory; if you do not want this behavior, you can require that by default options are considered optional, by using the command line option --default-optional11.


argoptional
If this flag is specified then this option has an argument that is optional. In this case, when you specify the argument at command line, please use = in case you use a long option, and avoid spaces if you use short option. For instance, if the option with optional argument is -B|--bar, use the following command line syntax: -B15 or --bar=15, and NOT the following one -B 15 nor --bar 15.

By using this specification together with default you can obtain an option that even if not explicitly specified will have the default value, and if it is specified without an argument it will have, again, the default value.


multiple
If this flag is specified then this option can be specified more than once at command line; all the values for this option are stored in an array. You can also specify the number of occurrences that a multiple option must be specified. Notice that this is independent from the required flag. See Multiple Options.


hidden
If an option is “hidden” it will not appear in the output of --help but it can still be specified at command line12. When hidden options are used, the command line option --full-help will also be generated. This will also print hidden options13. Hidden options are also displayed in the output of --detailed-help, if it is present, along with any details that those options have.

Note that when --strict-hidden is used, hidden options do not appear as described above, although they can still be given on the comand line. That is to say, the --full-help option is not generated, and hidden options do not appear in the output of --detailed-help, even if they have details.


on/off
on or off. This is the state of the flag when the program starts. If user specifies the option, the flag toggles.

For strings (delimited by ") the following convention is adopted14: a string spanning more than one line will be interpreted with the corresponding line breaks; if the line break is not desired one can use the backslash \ to break the line without inserting a line break. A line break in a string can also be inserted with the string \n. Here are some examples:

     "This string will be interpreted
     into two lines exactly as it is"
     
     "This string is specified with two lines \
     but interpreted as specified in only one line \
     i.e., without explicit line break"
     
     "This string\nwill have a line break"

Moreover, if the character " must be specified in the string, it will have to be escaped with the backslash15:

     "This string contains \"a quoted string\" inside"

The part that must be provided in the correct order is

     option <long> <short> "<desc>"

while the other specifications can be given in any order16. Thus, for instance

     option <long> <short> "<desc>" {argtype} {typestr="<type descr>"}

is the same as

     option <long> <short> "<desc>" {typestr="<type descr>"} {argtype}

Comments begin with # in any place (but in strings) of the line and ends in the end of line.

Notice that the options -h,--help and -V,--version are added automatically; however, if you specify an option yourself that has h as short form, then only --help is added17. The same holds for -V,--version.

In case hidden options are used, See Hidden options, the command line option --full-help will also be generated. This will print also the hidden options18.

Note, though, that when --strict-hidden is used, this is not the case and --full-help is not generated.

If there's at least one option with details, the command line option --detailed-help will also be generated. This will print also the details for options and hidden options19 (except when --strict-hidden is used).

Options can be part of sections, that provide a more meaningful descriptions of the options. A section can be defined with the following syntax (the sectiondesc is optional) and all the options following a section declaration are considered part of that sections:

     section "section name" {sectiondesc="optional section description"}

Notice that the separation in sections is stronger than separation in groups of mutually exclusive options (see Group options). Furthermore, sections should not be inserted among group options (but only externally). A section makes sense only if it is followed by some options. If you don't specify any option after a section, that section will not be printed at all. If you need to simply insert some text in the output of --help, then you must use text, explained in the next paragraph.

You can insert, among options, a textual string that will be printed in the output of --help20:

     text "\nA text description with possible line\nbreaks"

Of course, you can use this mechanism even to manually insert blank lines among options with an empty text string:

     text ""

You can also specify the list of values that can be passed to an option (if the type is not specified, the option has type string). More on this feature can be found in Options with enumerated values. If a value that is not in the list is passed, an error is raised. You can think of such options as enumerated options. It is not necessary to pass the complete value at the command line option: a non ambiguous prefix will do. For instance, if the accepted values are "foo","bar","foobar", then you can pass at the command line the value "b" and the value "bar" will be selected, or the value "foob" and the value "foobar" will be selected; instead, passing the value "fo" will raise an ambiguity error.

Here's an example of such a file (the file is called sample1.ggo)

     # Name of your program
     package "sample1" # don't use package if you're using automake
     # Version of your program
     version "2.0"   # don't use version if you're using automake
     
     # Options
     option  "str-opt"         s "A string option, for a filename"
             string typestr="filename"     optional
     text "\nA brief text description"
     text " before the other options.\n"
     option  "my-opt"          m "Another integer option, \
     this time the description of the option should be \"quite\" long to \
     require wrapping... possibly more than one wrapping :-) \
     especially if I\nrequire a line break"      int     optional
     option  "int-opt"         i "A int option"         int        yes
     section "more involved options"
             sectiondesc="the following options\nare more complex"
     text ""
     option  "flag-opt"        - "A flag option"        flag       off
     option  "funct-opt"       F "A function option"    optional
         details="\nA function option is basically an option with no argument.\
       It can be used, e.g., to specify a specific behavior for a program.
     
     Well, this further explanation is quite useless, but it's only to \
     show an example of an option with details, \
     which will be printed only when --detailed-help is given \
     at the command line."
     section "last option section"
     option  "long-opt"        - "A long option"        long       optional
     option  "def-opt"         - "A string option with default"
             string default="Hello" optional
     option  "enum-opt"         - "A string option with list of values"
             values="foo","bar","hello","bye" default="hello" optional
     option  "secret"         S "hidden option will not appear in --help"
             int optional hidden
     option  "dependant"         D
             "option that depends on str-opt" int optional dependon="str-opt"
     text "\nAn ending text."
     

The simplest way to use gengetopt is to pass this file as the standard input, i.e.:

     gengetopt < sample1.ggo

By default gengetopt generates cmdline.h and cmdline.c. Otherwise we can specify these names with a command line option:

     gengetopt < sample1.ggo --file-name=cmdline1 --unamed-opts

The option --unamed-opts allows the generated command line parser to accept also names, without an option (for instance you can pass a file name without an option in front of it, and also use wildcards, such as *.c, foo*.? and so on). These are also called parameters (see Terminology). You can specify an optional description for these additional names (default is FILES).

In cmdline1.h you'll find the generated C struct:

     /** @file cmdline1.h
      *  @brief The header file for the command line option parser
      *  generated by GNU Gengetopt version 2.22.6
      *  http://www.gnu.org/software/gengetopt.
      *  DO NOT modify this file, since it can be overwritten
      *  @author GNU Gengetopt by Lorenzo Bettini */
     
     #ifndef CMDLINE1_H
     #define CMDLINE1_H
     
     /* If we use autoconf.  */
     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <stdio.h> /* for FILE */
     
     #ifdef __cplusplus
     extern "C" {
     #endif /* __cplusplus */
     
     #ifndef CMDLINE_PARSER_PACKAGE
     /** @brief the program name (used for printing errors) */
     #define CMDLINE_PARSER_PACKAGE "sample1"
     #endif
     
     #ifndef CMDLINE_PARSER_PACKAGE_NAME
     /** @brief the complete program name (used for help and version) */
     #define CMDLINE_PARSER_PACKAGE_NAME "sample1"
     #endif
     
     #ifndef CMDLINE_PARSER_VERSION
     /** @brief the program version */
     #define CMDLINE_PARSER_VERSION "2.0"
     #endif
     
     /** @brief Where the command line options are stored */
     struct gengetopt_args_info
     {
       const char *help_help; /**< @brief Print help and exit help description.  */
       const char *detailed_help_help; /**< @brief Print help, including all details and hidden options, and exit help description.  */
       const char *full_help_help; /**< @brief Print help, including hidden options, and exit help description.  */
       const char *version_help; /**< @brief Print version and exit help description.  */
       char * str_opt_arg;       /**< @brief A string option, for a filename.  */
       char * str_opt_orig;       /**< @brief A string option, for a filename original value given at command line.  */
       const char *str_opt_help; /**< @brief A string option, for a filename help description.  */
       int my_opt_arg;       /**< @brief Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I
       require a line break.  */
       char * my_opt_orig;       /**< @brief Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I
       require a line break original value given at command line.  */
       const char *my_opt_help; /**< @brief Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I
       require a line break help description.  */
       int int_opt_arg;       /**< @brief A int option.  */
       char * int_opt_orig;       /**< @brief A int option original value given at command line.  */
       const char *int_opt_help; /**< @brief A int option help description.  */
       int flag_opt_flag;       /**< @brief A flag option (default=off).  */
       const char *flag_opt_help; /**< @brief A flag option help description.  */
       const char *funct_opt_help; /**< @brief A function option help description.  */
       long long_opt_arg;       /**< @brief A long option.  */
       char * long_opt_orig;       /**< @brief A long option original value given at command line.  */
       const char *long_opt_help; /**< @brief A long option help description.  */
       char * def_opt_arg;       /**< @brief A string option with default (default='Hello').  */
       char * def_opt_orig;       /**< @brief A string option with default original value given at command line.  */
       const char *def_opt_help; /**< @brief A string option with default help description.  */
       char * enum_opt_arg;       /**< @brief A string option with list of values (default='hello').  */
       char * enum_opt_orig;       /**< @brief A string option with list of values original value given at command line.  */
       const char *enum_opt_help; /**< @brief A string option with list of values help description.  */
       int secret_arg;       /**< @brief hidden option will not appear in --help.  */
       char * secret_orig;       /**< @brief hidden option will not appear in --help original value given at command line.  */
       const char *secret_help; /**< @brief hidden option will not appear in --help help description.  */
       int dependant_arg;       /**< @brief option that depends on str-opt.  */
       char * dependant_orig;       /**< @brief option that depends on str-opt original value given at command line.  */
       const char *dependant_help; /**< @brief option that depends on str-opt help description.  */
     
       unsigned int help_given ;       /**< @brief Whether help was given.  */
       unsigned int detailed_help_given ;       /**< @brief Whether detailed-help was given.  */
       unsigned int full_help_given ;       /**< @brief Whether full-help was given.  */
       unsigned int version_given ;       /**< @brief Whether version was given.  */
       unsigned int str_opt_given ;       /**< @brief Whether str-opt was given.  */
       unsigned int my_opt_given ;       /**< @brief Whether my-opt was given.  */
       unsigned int int_opt_given ;       /**< @brief Whether int-opt was given.  */
       unsigned int flag_opt_given ;       /**< @brief Whether flag-opt was given.  */
       unsigned int funct_opt_given ;       /**< @brief Whether funct-opt was given.  */
       unsigned int long_opt_given ;       /**< @brief Whether long-opt was given.  */
       unsigned int def_opt_given ;       /**< @brief Whether def-opt was given.  */
       unsigned int enum_opt_given ;       /**< @brief Whether enum-opt was given.  */
       unsigned int secret_given ;       /**< @brief Whether secret was given.  */
       unsigned int dependant_given ;       /**< @brief Whether dependant was given.  */
     
       char **inputs ; /**< @brief unamed options (options without names) */
       unsigned inputs_num ; /**< @brief unamed options number */
     } ;
     
     /** @brief The additional parameters to pass to parser functions */
     struct cmdline_parser_params
     {
       int override; /**< @brief whether to override possibly already present options (default 0) */
       int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
       int check_required; /**< @brief whether to check that all required options were provided (default 1) */
       int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
       int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
     } ;
     
     /** @brief the purpose string of the program */
     extern const char *gengetopt_args_info_purpose;
     /** @brief the usage string of the program */
     extern const char *gengetopt_args_info_usage;
     /** @brief the description string of the program */
     extern const char *gengetopt_args_info_description;
     /** @brief all the lines making the help output */
     extern const char *gengetopt_args_info_help[];
     /** @brief all the lines making the full help output (including hidden options) */
     extern const char *gengetopt_args_info_full_help[];
     /** @brief all the lines making the detailed help output (including hidden options and details) */
     extern const char *gengetopt_args_info_detailed_help[];
     
     /**
      * The command line parser
      * @param argc the number of command line options
      * @param argv the command line options
      * @param args_info the structure where option information will be stored
      * @return 0 if everything went fine, NON 0 if an error took place
      */
     int cmdline_parser (int argc, char **argv,
       struct gengetopt_args_info *args_info);
     
     /**
      * The command line parser (version with additional parameters - deprecated)
      * @param argc the number of command line options
      * @param argv the command line options
      * @param args_info the structure where option information will be stored
      * @param override whether to override possibly already present options
      * @param initialize whether to initialize the option structure my_args_info
      * @param check_required whether to check that all required options were provided
      * @return 0 if everything went fine, NON 0 if an error took place
      * @deprecated use cmdline_parser_ext() instead
      */
     int cmdline_parser2 (int argc, char **argv,
       struct gengetopt_args_info *args_info,
       int override, int initialize, int check_required);
     
     /**
      * The command line parser (version with additional parameters)
      * @param argc the number of command line options
      * @param argv the command line options
      * @param args_info the structure where option information will be stored
      * @param params additional parameters for the parser
      * @return 0 if everything went fine, NON 0 if an error took place
      */
     int cmdline_parser_ext (int argc, char **argv,
       struct gengetopt_args_info *args_info,
       struct cmdline_parser_params *params);
     
     /**
      * Save the contents of the option struct into an already open FILE stream.
      * @param outfile the stream where to dump options
      * @param args_info the option struct to dump
      * @return 0 if everything went fine, NON 0 if an error took place
      */
     int cmdline_parser_dump(FILE *outfile,
       struct gengetopt_args_info *args_info);
     
     /**
      * Save the contents of the option struct into a (text) file.
      * This file can be read by the config file parser (if generated by gengetopt)
      * @param filename the file where to save
      * @param args_info the option struct to save
      * @return 0 if everything went fine, NON 0 if an error took place
      */
     int cmdline_parser_file_save(const char *filename,
       struct gengetopt_args_info *args_info);
     
     /**
      * Print the help
      */
     void cmdline_parser_print_help(void);
     /**
      * Print the full help (including hidden options)
      */
     void cmdline_parser_print_full_help(void);
     /**
      * Print the detailed help (including hidden options and details)
      */
     void cmdline_parser_print_detailed_help(void);
     /**
      * Print the version
      */
     void cmdline_parser_print_version(void);
     
     /**
      * Initializes all the fields a cmdline_parser_params structure 
      * to their default values
      * @param params the structure to initialize
      */
     void cmdline_parser_params_init(struct cmdline_parser_params *params);
     
     /**
      * Allocates dynamically a cmdline_parser_params structure and initializes
      * all its fields to their default values
      * @return the created and initialized cmdline_parser_params structure
      */
     struct cmdline_parser_params *cmdline_parser_params_create(void);
     
     /**
      * Initializes the passed gengetopt_args_info structure's fields
      * (also set default values for options that have a default)
      * @param args_info the structure to initialize
      */
     void cmdline_parser_init (struct gengetopt_args_info *args_info);
     /**
      * Deallocates the string fields of the gengetopt_args_info structure
      * (but does not deallocate the structure itself)
      * @param args_info the structure to deallocate
      */
     void cmdline_parser_free (struct gengetopt_args_info *args_info);
     
     /**
      * Checks that all the required options were specified
      * @param args_info the structure to check
      * @param prog_name the name of the program that will be used to print
      *   possible errors
      * @return
      */
     int cmdline_parser_required (struct gengetopt_args_info *args_info,
       const char *prog_name);
     
     extern const char *cmdline_parser_enum_opt_values[];  /**< @brief Possible values for enum-opt. */
     
     
     #ifdef __cplusplus
     }
     #endif /* __cplusplus */
     #endif /* CMDLINE1_H */
     

First of all, notice that the argv parameter (typically corresponding to the homonimous argument of your program's main function) is declared as char ** and not as char *const *21. Actually, the version of getopt_long in libc uses prototypes with char *const *argv that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1)22. So, it is better to declare argv as char ** in the generated parser functions.

The <option>_given field is set to 1 when an argument for <option> has been specified (otherwise it is 0)23. This fields also counts the times a multiple option is specified (see Multiple Options). If the option accepts an argument and it is not of flag type The <option>_arg field is set to the value passed at the command line. The <option>_arg field has the corresponding C type specified in the file passed to gengetopt.

Notice that if an option has a default value, then the corresponding <option>_arg will be initialized with that value but the corresponding <option>_given will NOT be initialized to 1. Thus, <option>_given will effectively inform you if the user has specified that command line option.

The additional field <option>_orig is always a string containing the original value passed at the command line. This may be different, for instance, in case of numerical arguments: gengetopt converts the passed value (a string) into the corresponding numerical type; due to conversions, float representations, etc., this may not correspond exactly to the original value passed at command line. It can also be different when enumerated options are used (see above): in particular the <option>_arg field will contain a value taken from the specified list, while <option>_orig contains the (non-ambiguous) prefix specified at the command line.

The user can always access this original value by using <option>_orig instead of <option>_arg, as he sees fit24. For instance, gengetopt itself uses the original value when it saves the command line options into a file (see the _file_save function in the following). However, apart from very specific command line processing, the user might hardly need the <option>_orig field, and can be always safely use <option>_arg.

The <option>_help contains the string (concerning this very option) that is printed when --help command line is given.

If it is of flag type, only the field <option>_flag is generated.

The strings cmdline_parser_purpose and cmdline_parser_usage contain the purpose as specified in the input file and the generated “usage” string as printed when --help command line is given. Finally, the string array cmdline_parser_help contains the strings (one for each option) printed when --help command line is given (this array is terminated by a null string element). If hidden options are used also the cmdline_parser_full_help array is available (containing also help strings concerning hidden options). If at least one option has details, then the cmdline_parser_detailed_help array is available (containing also help strings concerning hidden options and details for options). All these strings can be used by the programmer to build a customized help output25.

Even if <option>_given is 0, the corresponding <option>_arg is set to default value (if one has been specified for <option>). However, in this case, the <option>_orig is set to NULL.

Notice that by default the generated function is called cmdline_parser (see the command line options below, to override this name), and it takes the arguments that main receives and a pointer to such a struct, that it will be filled. Another version, cmdline_parser2, can be specified more arguments. Since you typically need this second version only in conjunction with other “kinds” of parsers such as configuration files and multiple parsers, you can find more details about it in Configuration files.

IMPORTANT: The array passed to the parser function (that in turn is passed to getopt_long is expected to have in the first element (of index 0) the name of the program that was invoked. This will be used, for instance, for printing possible errors.

cmdline_parser_free can be called to deallocate memory allocated by the parser for string and multiple options.

cmdline_parser_init can be called to initialize the struct (it is not mandatory, since it is done automatically by the command line parser).

cmdline_parser_file_save26 can be used to save the command line options into a file. The contents of this file are consistent with the configuration files (Configuration files). Notice that if an option has a default value, this option will be saved into the file only if it was passed explicitly at command line (or read from a configuration file), i.e., default values will not be saved into the file. Alternatively, you can use cmdline_parser_dump27 that takes as the first parameter an already open stream (FILE *) instead of a file name.

And here's how these functions can be used inside the main program:

     /* main1.cc */
     /* we try to use gengetopt generated file in a C++ program */
     /* we don't use autoconf and automake vars */
     
     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <iostream>
     #include "stdlib.h"
     
     #include "cmdline1.h"
     
     using std::cout;
     using std::endl;
     
     int
     main (int argc, char **argv)
     {
       gengetopt_args_info args_info;
     
       cout << "This one is from a C++ program" << endl ;
       cout << "Try to launch me with some options" << endl ;
       cout << "(type sample1 --help for the complete list)" << endl ;
       cout << "For example: ./sample1 *.* --funct-opt" << endl ;
     
       /* let's call our cmdline parser */
       if (cmdline_parser (argc, argv, &args_info) != 0)
         exit(1) ;
     
       cout << "Here are the options you passed..." << endl;
     
       for ( unsigned i = 0 ; i < args_info.inputs_num ; ++i )
         cout << "file: " << args_info.inputs[i] << endl ;
     
       if ( args_info.funct_opt_given )
         cout << "You chose --funct-opt or -F." << endl ;
     
       if ( args_info.str_opt_given )
         cout << "You inserted " << args_info.str_opt_arg << " for " <<
           "--str-opt option." << endl ;
     
       if ( args_info.int_opt_given )
         cout << "This is the integer you input: " <<
           args_info.int_opt_arg << "." << endl;
     
       if (args_info.flag_opt_given)
         cout << "The flag option was given!" << endl;
     
       cout << "The flag is " << ( args_info.flag_opt_flag ? "on" : "off" ) <<
         "." << endl ;
     
       if (args_info.enum_opt_given) {
         cout << "enum-opt value: " << args_info.enum_opt_arg << endl;
         cout << "enum-opt (original specified) value: "
             << args_info.enum_opt_orig << endl;
       }
     
       if (args_info.secret_given)
         cout << "Secret option was specified: " << args_info.secret_arg
             << endl;
     
       cout << args_info.def_opt_arg << "! ";
     
       cout << "Have a nice day! :-)" << endl ;
     
       cmdline_parser_free (&args_info); /* release allocated memory */
     
       return 0;
     }
     

Now you can compile main1.cc and the cmdline1.c generated by gengetopt and link all together to obtain sample1 executable:

     gcc -c cmdline1.c
     g++ -c main1.cc
     g++ -o sample1 cmdline1.o main1.o

(Here we assume that getopt_long is included in the standard C library; see Installation and No getopt_long).

Now let's try some tests with this program:

     $ ./sample1 -s "hello" --int-opt 1234
     This one is from a C++ program
     Try to launch me with some options
     (type sample1 --help for the complete list)
     For example: ./sample1 *.* --funct-opt
     Here are the options you passed...
     You inserted hello for --str-opt option.
     This is the integer you input: 1234.
     The flag is off.
     Have a nice day! :-)

You can also pass many file names to the command line (this also shows how flags work):

     $ ./sample1 *.h -i -100 -x
     This one is from a C++ program
     Try to launch me with some options
     (type sample1 --help for the complete list)
     For example: ./sample1 *.* --funct-opt
     Here are the options you passed...
     file: cmdline1.h
     file: cmdline2.h
     file: cmdline.h
     file: getopt.h
     This is the integer you input: -100.
     The flag is on.
     Have a nice day! :-)

And if we try to omit the --int-opt (or -i), which is required, we get an error:

     $ ./sample1
     This one is from a C++ program
     Try to launch me with some options
     (type sample1 --help for the complete list)
     For example: ./sample1 *.* --funct-opt
     sample1: `--int-opt' (`-i') option required!

Now, let's test the enumerated options, notice the use of a prefix for specifying an acceptable value, and the difference between the actual passed value and the one recorded in <option>_arg:

     $ ./sample1 -i 10 --enum-opt h
     ...
     enum-opt value: hello
     enum-opt (original specified) value: h
     ...

While the next one raises an ambiguity error (between "bar" and "bye"):

     $ ./sample1 -i 10 --enum-opt b
     ...
     ./sample1: ambiguous argument, "b", for option `--enum-opt'

Here is the output of --help of the parser generated from sample1.ggo by specifying the following options to gengetopt: --long-help -u --show-required (see Invoking gengetopt for further explanation for these command line options).

     This one is from a C++ program
     Try to launch me with some options
     (type sample1 --help for the complete list)
     For example: ./sample1 *.* --funct-opt
     sample1 2.0
     
     Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help]
              [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT]
              [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING]
              [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]...
     
       -h, --help              Print help and exit
           --detailed-help     Print help, including all details and hidden options,
                                 and exit
           --full-help         Print help, including hidden options, and exit
       -V, --version           Print version and exit
       -s, --str-opt=filename  A string option, for a filename
     
     A brief text description before the other options.
     
       -m, --my-opt=INT        Another integer option, this time the description of
                                 the option should be "quite" long to require
                                 wrapping... possibly more than one wrapping :-)
                                 especially if I
                                 require a line break
       -i, --int-opt=INT       A int option (mandatory)
     
     
     more involved options:
       the following options
       are more complex
           --flag-opt          A flag option  (default=off)
       -F, --funct-opt         A function option
     
     last option section:
           --long-opt=LONG     A long option
           --def-opt=STRING    A string option with default  (default=`Hello')
           --enum-opt=STRING   A string option with list of values  (possible
                                 values="foo", "bar", "hello", "bye"
                                 default=`hello')
       -D, --dependant=INT     option that depends on str-opt
     
     An ending text.

Notice how filename is printed instead of STRING for the option --str-opt (since typestr was used in the sample1.ggo file) and how the description of --my-opt is wrapped to 80 columns, and how the \n is actually interpreted as a newline request. Also the usage string is wrapped. Moreover, since -S,--secret is an hidden option (See Hidden options.) it is not printed; if you wanted that to be printed, you should use --full-help. The option --func-opt has also the details, but they are not printed with --help.

Finally, notice how the text strings are printed in the help output (and the empty line after the “more involved options” section achieved with an empty text string).

Instead, here is the output of --detailed-help of the parser generated from sample1.ggo. You may want to compare this output with the one produced by --help (See Output of --help.); in particular, you may notice that the hidden option --secret is actually printed and the details of --func-opt are printed too:

     This one is from a C++ program
     Try to launch me with some options
     (type sample1 --help for the complete list)
     For example: ./sample1 *.* --funct-opt
     sample1 2.0
     
     Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help]
              [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT]
              [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING]
              [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]...
     
       -h, --help              Print help and exit
           --detailed-help     Print help, including all details and hidden options,
                                 and exit
           --full-help         Print help, including hidden options, and exit
       -V, --version           Print version and exit
       -s, --str-opt=filename  A string option, for a filename
     
     A brief text description before the other options.
     
       -m, --my-opt=INT        Another integer option, this time the description of
                                 the option should be "quite" long to require
                                 wrapping... possibly more than one wrapping :-)
                                 especially if I
                                 require a line break
       -i, --int-opt=INT       A int option (mandatory)
     
     
     more involved options:
       the following options
       are more complex
           --flag-opt          A flag option  (default=off)
       -F, --funct-opt         A function option
     
       A function option is basically an option with no argument.  It can be used,
       e.g., to specify a specific behavior for a program.
     
       Well, this further explanation is quite useless, but it's only to show an
       example of an option with details, which will be printed only when
       --detailed-help is given at the command line.
     
     last option section:
           --long-opt=LONG     A long option
           --def-opt=STRING    A string option with default  (default=`Hello')
           --enum-opt=STRING   A string option with list of values  (possible
                                 values="foo", "bar", "hello", "bye"
                                 default=`hello')
       -S, --secret=INT        hidden option will not appear in --help
       -D, --dependant=INT     option that depends on str-opt
     
     An ending text.

If you're curious you may want to take a look at the generated C file cmdline1.c.

You may find other examples in /prefix/share/doc/gengetopt/examples or in the tests of the source tarbal.


Next: , Previous: Basic Usage, Up: Top

3 Invoking gengetopt

This is the output of gengetopt --help:

     gengetopt
     
     This program generates a C function that uses getopt_long function
     to parse the command line options, validate them and fill a struct.
     
     Usage: gengetopt [OPTIONS]...
     
       -h, --help                    Print help and exit
           --detailed-help           Print help, including all details and hidden
                                       options, and exit
       -V, --version                 Print version and exit
     
     Main options:
     
       -i, --input=filename          input file (default std input)
       -f, --func-name=name          name of generated function
                                       (default=`cmdline_parser')
       -a, --arg-struct-name=name    name of generated args info struct
                                       (default=`gengetopt_args_info')
       -F, --file-name=name          name of generated file  (default=`cmdline')
           --output-dir=path         output directory
           --header-output-dir=path  header output directory
           --src-output-dir=path     source output directory
       -c, --c-extension=ext         extension of c file  (default=`c')
       -H, --header-extension=ext    extension of header file  (default=`h')
       -l, --long-help               long usage line in help
           --default-optional        by default, an option is considered optional if
                                       not specified otherwise
       -u, --unamed-opts[=STRING]    accept options without names (e.g., file names)
                                       (default=`FILES')
     
     The parser generated is thought to be used to parse the command line arguments.
     However, you can also generate parsers for configuration files, or strings that
     contain the arguments to parse, by using the following two options.
     
       -C, --conf-parser             generate a config file parser
       -S, --string-parser           generate a string parser (the string contains
                                       the command line)
     
     Additional options:
       -G, --include-getopt          adds the code for getopt_long in the generated
                                       C file
       -n, --no-handle-help          do not handle --help|-h automatically
           --no-help                 do not add --help|-h automatically
       -N, --no-handle-version       do not handle --version|-V automatically
           --no-version              do not add --version|-V automatically
       -e, --no-handle-error         do not exit on errors
           --show-required[=STRING]  in the output of help will specify which
                                       options are mandatory, by using the optional
                                       passed string  (default=`(mandatory)')
           --strict-hidden           completely hide hidden options
       -g, --gen-version             put gengetopt version in the generated file
                                       (default=on)
           --set-package=STRING      set the package name (override package defined
                                       in the .ggo file)
           --set-version=STRING      set the version number (override version
                                       defined in the .ggo file)
           --show-help               show the output of --help instead of generating
                                       code
           --show-full-help          show the output of --full-help (i.e., including
                                       hidden options) instead of generating code
           --show-detailed-help      show the output of --detailed-help (i.e.,
                                       including details and hidden options) instead
                                       of generating code
           --show-version            show the output of --version instead of
                                       generating code
     
     Please refer to the info manual for further explanations.

The options should be clear; in particular:

--func-name
if no --func-name is given, cmdline_parser is taken by default;
--output-dir
if no --output-dir28 is given, the files are generated in the current directory;
--src-output-dir
--header-output-dir
With these options29 the generated C file and the corresponding generated header files can be generated in different directories;
--arg-struct-name
allows to specify the name of the generated struct for command line arguments (default is gengetopt_args_info)
--long-help
the “Usage” line reports all the options; this may be unpleasant if options are many;
--default-optional
If this command line option is given, by default, options are considered optional (if not explicitly specified otherwise). Otherwise, options are considered mandatory (if not explicitly specified otherwise).
--unamed-opts
the program will accept also options without a name, which, in most case, means that we can pass many file names to the program (see the example in Basic Usage, where we call sample1 *.h). You can specify an optional description for these additional names (default is FILES).
--no-handle-help
--no-handle-version
if --no-handle-help (--no-handle-version) is given the command line option --help|-h (--version|-V) is not handled automatically, so the programmer will be able to print some other information; then the function for printing the standard help (version) response can be used; this function is called <parser-name>_print_help (<parser-name>_print_version), where <parser-name> is the name specified with --func-name or the default, cmdline_parser. In case hidden options are used, See Hidden options, also the function <parser-name>_print_full_help will be generated; if details are used for at least one option, then also the function <parser-name>_print_detailed_help will be generated. Notice that, although the programmer can handle these options manually, the parser will return after finding one of these options: the other command line options, if any, will be ignored. In case you want to have full control on --help|-h, --version|-V, you should use the following options:
--no-help
--no-version
With these options30 you can disable the automatic addition of options --help|-h and --version|-V, respectively. The programmer will then be able to add these options in the input file and handle them as he sees fit. Notice that --no-help will also disable the automatic options --detailed-help and --full-help. The programmer can still define options with short character h and V as he wants, but he cannot define options help and version, unless he specifies --no-help and --no-version, respectively (otherwise an error will be printed). An example using these options and manually handles --help and --version can be found in test_manual_help_cmd.ggo and test_manual_help.c in the examples directory.
--no-handle-error
if --no-handle-error is given, an error in the parsing does not provoke the exit of the program; instead, since the parser function, in case of an error, returns a value different 0, the program can print a help message, as gengetopt itself does in case of an error (try it!).
--show-required
if --show-required is given, possibly with a string, in the output of --help will be made explicit which options are actually required, See Basic Usage.
--strict-hidden
when given, this causes hidden options to become really hidden. That is to say, the --full-help option will not be added, and hidden options will not show-up in the output of --detailed-help, even if they have details. See Hidden options.
--gen-version
is a flag (default on) that when disabled does not put in the output file the gengetopt version (it is useful for testing purposes).
--conf-parser
Detailed in Configuration files.
--string-parser
Detailed in String Parsers and Multiple Parsers.
--include-getopt
Adds the code for getopt_long into the generated parser C file. This will make your generated parser much bigger, but it will be compiled in any system, even if getopt_long is not part of the C library where your program is being compiled. See also No getopt_long.
--show-help
--show-full-help
--show-version
only make gengetopt show the output of --help, --full-help and --version command lines without generating any code, See Automatically added options. For instance, I use the --show-help option to generate a texinfo file with the output of help (this also shows an example of use of --set-package and --set-version):
          ../src/gengetopt --show-help -i ../src/cmdline.ggo \
             --set-package="gengetopt" \
             --set-version="" > help_output.texinfo

You may have already guessed it: gengetopt uses gengetopt itself for command line options, and its specification file is cmdline.ggo in the source directory. In particular the command line for gengetopt itself is generated with the following command:

     gengetopt --input=cmdline.ggo --no-handle-version \
               --no-handle-help --no-handle-error

Indeed when --help|-h is passed on the command line, gengetopt will call cmdline_parser_print_help() and then the lines for reporting bugs. When --version|-V is passed, it will call cmdline_parser_print_version() and then prints a copyright. If an error occurs it prints a message on the screen:

     $ ./gengetopt --zzzz
     ./gengetopt: unrecognized option `--zzzz'
     Run gengetopt --help to see the list of options.

4 Terminology

An argument is an element of the argv array passed into your C or C++ program by your operating system.

An option is an argument that begins with -, or --.

A value is an argument, or part of an argument, that is associated with a particular option (an option may also not accept any value). For example, in

     > ls --width=80

ls is called with one argument, --width=80, which is an option that has a value, 80, while in

     > ls --width 80

ls is called with two arguments, --width, which is an option, and 80 which might or might not be a value. In this case, whether the 80 is treated as a value associated with the preceding --width option, or as the name of a file to list depends on how ls parses the --width option.

The order in which options are specified is usually unimportant:

     > ls -a -l
     > ls -l -a

both do exactly the same thing.

An parameter is an argument that is not an option. For example, in

     > cp --archive source dest

cp is called with three arguments, the option --archive, the parameter source, and the parameter dest. Unlike options, the order in which parameters are specified usually is important:

     > cp --archive --verbose source dest
     > cp --verbose --archive source dest
     > cp --archive source --verbose dest
     > cp --archive --verbose dest source

The first three cp commands do the same thing, but the fourth one is completely different.

If you're new to Gengetopt, you may wish to skip the rest of this section. It goes into more detail about different sorts of options, and how they are parsed.

Note that some parameters may begin with - or --. Equivalently, not all arguments that begin with - or -- are options. Consider

     > ls -- -file
     > tar -c -f - . > ../foo.tar

The ls command has two arguments; the first argument, -- is ignored by ls, but causes the -file argument to be interpreted as a parameter. The tar command has four arguments. The -c argument tells tar to create an archive; the -f argument, which takes a value, -, tells tar that the archive should be written onto the standard output, and the fourth argument, ., tells tar what directories to include in the archive. (The remaining two items, > and ../foo.tar, tell the shell to redirect the tar command's output to the file ../foo.tar. The tar command doesn't even see them.)

The GNU convention is that - by itself is always interpreted as a value or parameter, while the first -- by itself is always ignored, but causes all subsequent arguments to be interpreted as parameters. Gengetopt always behaves this way.

A short option is an option that begins with -. Not including the leading dash, short options must be one character long:

     > ls -a -l -t --width=80

The -a, -l, and -t options are all short options. Multiple short options may be combined into a single argument:

     > ls -alt --width=80

is equivalent to the above example.

A long option is an option that begins with - or --. Ignoring the leading punctuation, long options may be one or more characters long:

     > ls --all -fs

The ls command has two arguments; the long option --all, and the pair of short options -fs.

Long options need not have synonymous short options; after all, complex programs like cc have more long options than there are valid short option characters; it wouldn't be possible to assign a short option to each of them. Short options are encouraged, but not required, to have a synonymous long option.

Long options may be abbreviated, as long as the abbreviation is not ambiguous. Gengetopt automatically treats unambiguous abbreviations as synonyms.

Short options may have values just like long options, but if several short options are grouped together into one argument, only the last one may have a value. Values in the same argument as a long option are delimited by an equals sign, values in the same argument as a short option are not:

     > ls --width 60  # ok, value is "60"
     > ls --width=60  # ok, value is "60"
     > ls -w60        # ok, value is "60"
     > ls -w 60       # ok, value is "60"
     > ls -w=60       # unexpected, value is "=60"
     > ls -T7 -w60    # ok, value for -T is 7, value for -w is 60
     > ls -T7w60      # unexpected, value for -T is "7w60", no -w at all

A required option must be present, otherwise an error will be raised.

A multiple option is an option that may appear more than once on the command line. Gengetopt would create a tidy array for multiple options (see Multiple Options, for further details about dealing with multiple options).


Next: , Previous: Terminology, Up: Top

5 Options with enumerated values

You can also specify the list of values that can be passed to an option (if the type is not specified, the option has type string). If a value that is not in the list is passed, an error is raised. You can think of such options as enumerated options. It is not necessary to pass the complete value at the command line option: a non ambiguous prefix will do. For instance, if the accepted values are "foo","bar","foobar", then you can pass at the command line the value "b" and the value "bar" will be selected, or the value "foob" and the value "foobar" will be selected; instead, passing the value "fo" will raise an ambiguity error.

Since version 2.22 options with values can be given a specific type (the default is string). If you give a numeric type to such options, gengetopt will check that the enumerated values are actually valid values for that numeric type.

As for other options, the <option>_arg field will have the specified type, while the <option>_orig field will always be a string (char *) storing the (non-ambiguous) prefix specified at the command line.

For such an option, no matter what its type is, an array of strings, <parser-name>_<option>_values, will be generated that contains all the strings representing the possible accepted values.

An option with enumerated values can also be given the type enum; in that case, a C enum type is also generated with name enum_<option>; the values of such C enum will be generated according this pattern: <option>_arg_<value>, where value is the value specified in the input file, and the starting value is always 0. An additional value is generated to represent the null/empty value, with the pattern <option>__NULL (note the double underscore) with integer value -1. For instance, if we specify in the input file the following option

     option "myopt" ... ... values="FOO","180","BAR" enum ...

then the following C enum will be generated:

     enum enum_myopt {
     myopt__NULL = -1, myopt_arg_FOO = 0, myopt_arg_180, myopt_arg_BAR };

If you use the symbols + and -, these will be translated into PLUS_ and MINUS_, respectively, in the the C enum. Thus, if we specify in the input file the following option

     option "myopt" ... ... values="+foo","-all","-foo" enum ...

then the following C enum will be generated:

     enum enum_myopt { myopt__NULL = -1,
                       myopt_arg_PLUS_foo = 0,
                       myopt_arg_MINUS_all, myopt_arg_MINUS_foo };

An example using options with values (and enum options) is tests/test_values_cmd.ggo and tests/test_values.c.

6 Group options

It is also possible to group options; options belonging to a group are considered in mutual exclusion. In order to use this feature, first the group has to be defined, and then a groupoption can be defined. A groupoption has basically the same syntax of a standard option, apart that the required flag must not be specified (it would not make sense, since the options of the same group are mutually exclusive) and the group to which the option belongs has to be specified.

     defgroup "<group name>" {groupdesc="<group description>"} {required}
     groupoption <long> <short> "<desc>" <argtype> group="<group name>" \
          {argoptional} {multiple}

If a group is defined as required, then one (but only one) option belonging to the group has to be specified.

Here's an example (taken from the test test_group_cmd.ggo):

     defgroup "my grp2"
     defgroup "grp1" groupdesc="an option of this group is required" required
     groupoption "opta" a "string a" group="grp1" multiple
     groupoption "optA" A "string A" string group="grp1" argoptional
     groupoption "optAmul" M "string M" string group="grp1" argoptional multiple
     groupoption "optb" b "string b" group="grp1"
     groupoption "optc" - "string c" group="my grp2"
     groupoption "optd" d "string d" group="my grp2"

The group grp1 is required, so either --opta or --optb has to be specified (but only one of them). Here's the output of some executions:

     $ ./test_groups
     test_groups: 0 options of group grp1 were given. One is required
     $ ./test_groups -a          OK
     $ ./test_groups -a -a       OK (the same option given twice)
     $ ./test_groups -a -b
     test_groups: 2 options of group grp1 were given. One is required
     $ ./test_groups -a -c       OK
     $ ./test_groups -a --optc -d
     test_groups: 2 options of group my grp2 were given. At most one is required

7 Mode options

It is also possible to specify “mode options”; options belonging to a mode are considered in mutual exclusion with options of a different mode. Thus, you can specify more options belonging to the same mode, but you cannot specify, on the same command line, two options belonging to two different modes (thus, modes are different from groups, Group options).

These sets of options are called modes, since they represent the different modes (modalities), in which a program can be run.

In order to use this feature, first the mode has to be defined, and then a modeoption can be defined. A modeoption has basically the same syntax of a standard option, and it can be given the required flag must not be specified (with a slightly different semantics, see below) and the group to which the option belongs has to be specified.

     defmode "<mode name>" {modedesc="<mode description>"}
     modeoption <long> <short> "<desc>" <argtype> mode="<mode name>" \
          {argoptional} {multiple} {required}

If a mode option is specified as required, then it will be required only if other options of the same mode are specified; this makes it possible to specify options of different modes as required.

Options not belonging to any mode are not in conflict with mode options.

For instance, let us consider the file test_modes_cmd.ggo:

     package "test_modes"
     version "1.0"
     
     section "some non mode options"
     
     option "no-mode" N "a generic option not beloging to any mode" optional
     option "no-mode2" - "another generic option not beloging to any mode" string optional
     
     section "some modes just for testing"
     
     defmode "mode 2"
     defmode "my mode"
     defmode "mode1" modedesc="any option of this mode is in contrast with any \
     option of the other mode\nNotice that this description is quite long so \
     it may spawn many lines...              \
     fortunately gengetopt will wrap it for you :-)"
     
     modeoption "opta" a "string a" multiple mode="mode1" optional
     modeoption "optA" A "string A" string argoptional mode="mode1" required
     modeoption "optAmul" M "string M"
             argoptional string mode="mode1" multiple optional
     modeoption "optb" b "string b" mode="mode1" optional
     
     modeoption "optc" - "string c" mode="mode 2" optional
     modeoption "optd" d "string d" mode="mode 2" required
     
     modeoption "mopt" m "option of my mode" int optional mode="my mode" optional
     

Now, we use the program test_modes (that uses the generated parser for the input file above) to demonstrate how the parser generated by gengetopt perform checks on mode options.

     test_modes -N

This execution generates no errors (although there are required options which are not specified, these required options are part of modes and they are required only if that mode is used).

     test_modes -a
     ./test_modes: '--optA' ('-A') option required

Since an option of a mode is specified, then required options of that mode must be provided, but, in this execution, we forgot to specify a required option of the mode that is being used.

     test_modes -a -A -N

This execution is correct: we specified two options of the same mode, in particular we also specified the required option of that mode. Notice that we use also an option not belonging to any mode, which does not interfere with mode options.

     test_modes -a -A -N --optc
     test_modes: option --optc conflicts with option --opta
     test_modes: option --optc conflicts with option --optA
     test_modes: '--optd' ('-d') option required

Here we see a conflict, (actually two), since the last option we specified belongs to a mode that is different from the one of the first two options.

If you require gengetopt to generate --full-help (See --full-help.), the usage string will be generated so that it will show the modes of the program; for instance, this is the output of --help of the generated parser for the input file above:

     test_modes 1.0
     
     Usage: test_modes [-h|--help] [-V|--version] [-N|--no-mode] [--no-mode2=STRING]
       or : test_modes -d|--optd [--optc]
       or : test_modes -ASTRING|--optA=STRING [-a|--opta]
              [-MSTRING|--optAmul=STRING] [-b|--optb]
       or : test_modes [-mINT|--mopt=INT]
     
       -h, --help              Print help and exit
       -V, --version           Print version and exit
     
     some non mode options:
       -N, --no-mode           a generic option not beloging to any mode
           --no-mode2=STRING   another generic option not beloging to any mode
     
     some modes just for testing:
     
      Mode: mode1
       any option of this mode is in contrast with any option of the other mode
       Notice that this description is quite long so it may spawn many lines...
       fortunately gengetopt will wrap it for you :-)
       -a, --opta              string a
       -A, --optA[=STRING]     string A
       -M, --optAmul[=STRING]  string M
       -b, --optb              string b
     
      Mode: mode 2
           --optc              string c
       -d, --optd              string d
     
      Mode: my mode
       -m, --mopt=INT          option of my mode


Next: , Previous: Mode options, Up: Top

8 Parser function additional parameters

Besides the parser functions, in the generated header file, gengetopt also generates31 an additional structure <cmd_parser_name>_params that can be used to customize the invocation of the generated parsers (it is especially useful when using configuration file parsers, Configuration files, string parsers, String Parsers and Multiple Parsers, and, in general, multiple parsers).

These are the fields of this structure (as usual, boolean options are represented as int and they are true if they are set to 1 and false if they are set to 0):

int initialize (default = 1)
tells whether the args_info struct has to be initialized.
int override (default = 0)
tells whether the values for the options that are parsed should override those that are already present in the passed args_info struct (e.g., this is the case when you call a parser multiple times using the same args_info struct, see, e.g., Configuration files andString Parsers and Multiple Parsers).
int check_required (default = 1)
tells whether the check for required options must be performed or not.
int check_ambiguity (default = 0)
tells whether the check whether options that are parsed are not already present in the passed args_info struct; this is performed only for NON multiple options (see also Multiple Options).
int print_errors (default = 1)
tells32 whether getopt_long must print error messages to the standard error stream if it encounters an unknown option character or an option with a missing required argument. This is the default behavior. If you set this variable to zero, getopt_long does not print any messages, but the generated parser will still return with error.

Gengetopt also generates an initialization function for such structures33, called <cmd_parser_name>_params_init, which takes as argument a pointer to such structure and initialize all its fields to their default values; it also generates a function called <cmd_parser_name>_params_create that returns a dynamically allocated structure with all fields initialized to their default values.

We strongly advise to use such functions for creating and initializing such a structure, since this will make your code scalable to future releases of gengetopt where such structure might contain additional fields. Otherwise, you might risk to use a structure where some fields are not initialized, with unpredictable results. Furthermore, since the <cmd_parser_name>_params_create function returns a pointer to a dynamically allocated structure (with malloc), it is up to you to deallocate that structure when you no longer need it (with free).

Some examples of usage of this parameters struct are shown in Configuration files.

9 Configuration files

It is often useful to specify command line options directly in a configuration file, so that the value of some options are read from this file if they are not given as command line options. When the command line option -C|--conf-parser is given to gengetopt, apart from the standard command line option parser, also this additional parser is generated (its name is <cmd_parser_name>_config_file34):

     int
     <cmd_parser_name>_config_file(char * const filename,
                                  struct gengetopt_args_info *args_info,
                                  struct <cmd_parser_name>_params *params);

The parameter structure <cmd_parser_name>_params is described in Parser function additional parameters. For instance, params->override tells whether the values read in the configuration file have to override those specified at the command line.

IMPORTANT: you have to explicitly set params->initialize to 1 if you call the config file parser before the standard command line option parser, otherwise unpredictable results may show.

If you call the config file parser before the standard command line option parser and then you want to call the standard command line parser you MUST use this second version of the parser function, with params->initialize set to 0, so that collected values from the config file are not lost35:

     int
     <cmd_parser_name>_ext (int argc,
                            char **argv,
                            struct gengetopt_args_info *args_info,
                            struct <cmd_parser_name>_params *params);

Notice, that with this version you can also specify whether the options passed at the command line must override the ones read from the config file. Moreover, you have to specify whether the check for missing required options must be performed or not. This concerns also options of a required group (Group options).

If you decide not to request the check for required option, you can test it manually, after the command line parsing returns by using the following generated function:

     int
     <cmd_parser_name>_required (struct gengetopt_args_info *args_info,
                                 const char *program_name);

where program_name is the name of your executable (usually you should pass argv[0] as argument). If the function returns a value different from 0, then some required options are missing. An error has already been printed by this function. This concerns also options of a required group (Group options).

The config file has the following simple syntax: lines starting with # are considered comments and:

     <option_name> = {<option_val>}

or simply (if the option does not take an argument):

     <option_name>

which means that option_name is given, and if it accepts an argument, then its value is option_val. The = is not mandatory.

Since version 2.19, it is possible to include other files (i.e., other configuration files) in a configuration file, by using the include syntax:

     include "filename"

For instance here's a program that uses this feature (this is the test test_conf_parser):

     /* test_conf_parser.c test */
     
     /* test all kinds of options and the conf file parser */
     
     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <stdlib.h>
     #include <stdio.h>
     
     #include "test_conf_parser_cmd.h"
     
     static struct my_args_info args_info;
     
     int
     main (int argc, char **argv)
     {
       unsigned int i;
       int result = 0;
     
       struct test_conf_parser_cmd_parser_params *params;
     
       /* initialize the parameters structure */
       params = test_conf_parser_cmd_parser_params_create();
     
       /* call the command line parser */
       if (test_conf_parser_cmd_parser (argc, argv, &args_info) != 0) {
         result = 1;
         goto stop;
       }
     
       /* 
          override command line options,
          but do not initialize args_info, check for required options.
          NOTICE: we must NOT skip the 0 assignment to initialize,
          since its default value is 1 and override defaults to 0
          while check_required is already set to its default value, 1
       */
       params->initialize = 0;
       params->override = 1;
     
       /* call the config file parser */
       if (test_conf_parser_cmd_parser_config_file
           (args_info.conf_file_arg, &args_info, params) != 0)
         {
           result = 1;
           goto stop;
         }
     
       printf ("value of required: %s\n", args_info.required_arg);
       printf ("value of string: %s\n", args_info.string_arg);
       printf ("value of no-short_given: %d\n", args_info.no_short_given);
       printf ("value of int: %d\n", args_info.int_arg);
       printf ("value of float: %f\n", args_info.float_arg);
     
       printf ("value of multi-string_given: %d\n", args_info.multi_string_given);
       for (i = 0; i < args_info.multi_string_given; i++)
         printf ("  value of multi-string: %s\n", args_info.multi_string_arg [i]);
     
       printf ("value of multi-string-def_given: %d\n",
               args_info.multi_string_def_given);
       for (i = 0; i < args_info.multi_string_def_given; ++i)
         printf ("  value of multi-string-def: %s\n",
                 args_info.multi_string_def_arg [i]);
       if (!args_info.multi_string_def_given && args_info.multi_string_def_arg [0])
         printf ("default value of multi-string-def: %s\n",
                 args_info.multi_string_def_arg [0]);
     
       printf ("value of opta: %s\n", args_info.opta_arg);
     
       printf ("noarg given %d times\n", args_info.noarg_given);
       printf ("noarg_noshort given %d times\n", args_info.noarg_noshort_given);
     
       printf ("opt-arg given: %d\n", args_info.opt_arg_given);
       printf ("opt-arg value: %s\n", (args_info.opt_arg_arg ? args_info.opt_arg_arg : "not given"));
     
       if (args_info.file_save_given) {
         if (test_conf_parser_cmd_parser_file_save (args_info.file_save_arg, &args_info) == EXIT_FAILURE)
           result = 1;
         else
           printf ("saved configuration file %s\n", args_info.file_save_arg);
       }
     
      stop:
       /* deallocate structures */
       test_conf_parser_cmd_parser_free (&args_info);
       free (params);
     
       return result;
     }
     

So if we use the following config file

     # required option
     required "this is a test"
     float 3.14
     no-short
     string another

and we run test_conf_parser like that, we will have

     ./test_conf_parser -r bar -i 100 --float 2.14 --conf-file test_conf.conf
     value of required: this is a test
     value of string: another
     value of no-short: 1
     value of int: 100
     value of float: 3.140000

If, instead we call the test_conf_parser_cmd_parser_configfile with 0 for override argument, we get the following result

     value of required: bar
     value of string: another
     value of no-short: 1
     value of int: 100
     value of float: 2.140000

This second example use the second version of the command line parser: first call the configuration file parser and then the command line parser (the command line options will override the configuration file options):

     /* test_conf_parser_ov2.c test */
     
     /* test all kinds of options and the conf file parser */
     /* differently from test_conf_parser_ov.c, first scan the conf file and
        then the command line */
     
     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <stdlib.h>
     #include <stdio.h>
     
     #include "test_conf_parser_cmd.h"
     
     static struct my_args_info args_info;
     
     int
     main (int argc, char **argv)
     {
       struct test_conf_parser_cmd_parser_params *params;
     
       /* initialize the parameters structure */
       params = test_conf_parser_cmd_parser_params_create();
     
       /* 
          initialize args_info, but don't check for required options
          NOTICE: the other fields are initialized to their default values
       */
       params->check_required = 0;
     
       /* call the config file parser */
       if (test_conf_parser_cmd_parser_config_file
           ("../../tests/test_conf2.conf", &args_info, params) != 0)
         exit(1);
     
       /* 
          override config file options,
          do not initialize args_info, check for required options.
       */
       params->initialize = 0;
       params->override = 1;
       params->check_required = 1;
     
       /* call the command line parser */
       if (test_conf_parser_cmd_parser_ext (argc, argv, &args_info, params) != 0)
         exit(1) ;
     
       printf ("value of required: %s\n", args_info.required_arg);
       printf ("value of string: %s\n", args_info.string_arg);
       printf ("value of no-short_given: %d\n", args_info.no_short_given);
       printf ("value of int: %d\n", args_info.int_arg);
       printf ("value of float: %f\n", args_info.float_arg);
     
       /* release memory */
       test_conf_parser_cmd_parser_free (&args_info);
       free (params);
     
       return 0;
     }
     

This is an invocation and its results:

     ./test_conf_parser_ov2 -r "bar" --float 2.14 -i 100
     value of required: bar
     value of string: another
     value of no-short: 1
     value of int: 100
     value of float: 2.140000

If on the above code you substitute params->override = 1 with params->check_ambiguity = 1 (see the test file test_conf_parser_ov4.c), then the following invocation will generate an error:

     ./test_conf_parser_ov4 -r "bar" -i 100
     ./test_conf_parser_ov4: `--required' (`-r') option given more than once

since the -r option is specified both in the configuration file and at the command line.

9.1 Further details on the configuration file parser

The generated config file parser function uses the constant CONFIG_FILE_LINE_SIZE to read each line of the configuration file. By default this constant is set to 2048 that should be enough for most applications. If your application uses configuration files with lines that are longer, you can compile the generated C file by specifying an explicit value for this constant with the -D command line option of gcc.

10 Multiple Options

If an option is specified as multiple, then it can be specified multiple times at command line. In this case, say the option is called foo, the generated foo_given field in the args structure contains the number of times it was specified and the generated field foo_arg is an array containing all the values that were specified for this option.

Notice that if a default value is specified for a multiple option, that value is assigned to the option only if no other value is specified on the command line, i.e., a default value IS NOT always part of the values of a multiple option.

As in the case for standard options, if a multiple option has a default value, and this is set because no value was specified on the command line, then the corresponding <option>_given will still be initialized to 0. Thus, <option>_given will effectively inform you if the user has specified that command line option.

If it is known that a multiple option has a default value, then it can be safely assumed that the first element of generated array <option>_arg is always set.

For instance, if the gengetopt file is as follows

     # test options that can be given more than once
     option "string"      s "string option" string optional multiple
     option "int"         i "int option" int optional multiple

Then the command line options can be collected like that

     

Then if this program is called with the following command line options

     /* test options that can be given more than once */
     
     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <stdlib.h>
     #include <stdio.h>
     
     #include "test_multiple_cmd.h"
     
     static struct gengetopt_args_info args_info;
     
     int
     main (int argc, char **argv)
     {
       int i = 0;
     
       if (test_multiple_cmd_parser (argc, argv, &args_info) != 0)
         exit(1) ;
     
       for (i = 0; i < args_info.string_given; ++i)
         printf ("passed string: %s\n", args_info.string_arg[i]);
     
       for (i = 0; i < args_info.int_given; ++i)
         printf ("passed int: %d\n", args_info.int_arg[i]);
     
       return 0;
     }
     

The output of the program will be

     passed string: world
     passed string: hello
     passed string: bar
     passed string: foo
     passed int: 200
     passed int: 100

You can also pass arguments to a multiple option separated by commas (if you need to actually specify the comma operator as part of the argument you can escape it with \), as in the following:

     ./test_multiple -s"foo","bar","hello" -i100,200 -s "world"

You can specify the number of occurrences of multiple options by using the following syntax (that must be given after the multiple keyword):

(number)
requires that the multiple option, if given, must be given exactly number times
(number1-number2)
requires that the multiple option, if given, must be given not less than number1 times and no more than number2 times
(number-)
requires that the multiple option, if given, must be given at least number times
(-number)
requires that the multiple option, if given, must be given at most number times

Here are some examples:

     option "string"      s "string option" string optional multiple(4)
     option "string"      s "string option" string optional multiple(1-4)
     option "string"      s "string option" string optional multiple(-5)

Notice that this is independent from the required flag.


Next: , Previous: Multiple Options, Up: Top

11 String Parsers and Multiple Parsers

The parsers generated by gengetopt (indeed the C and header files) are self-contained and different parsers can be linked in the same program, without interferences. This is useful, e.g., in cases where a specific command line option argument has a complex syntax that accepts options itself according to terminology already defined, i.e., the one handled by getopt_long, see Terminology. Another case when multiple parsers can be useful is when your command behaves differently according to a specific command line option.

Obviously there exists only one instance of command line arguments passed to the main function (namely the variables argc and argv) so passing the same arguments to different command line parsers is likely to generate errors: the different command line parsers are likely to have different syntaxes for accepted options.

For this reason gengetopt can generate parser functions that take a string containing the further options to parse, instead of taking an array. This additional parser will have the parser name and the suffix _string. If you want these additional parsers to be generated you have to pass the command line option -S|--string-parser to gengetopt (see Invoking gengetopt). The two functions will be:

     int <parser_name>_string (const char *cmdline,
         struct test_first_cmdline_cmd_struct *args_info,
         const char *prog_name);
     int <parser_name>_string_ext (const char *cmdline,
         struct test_first_cmdline_cmd_struct *args_info,
         const char *prog_name,
         struct <cmd_parser_name>_params *params);

The second version36 allows you to specify more details about the parsing, using the <cmd_parser_name>_params structure, shown in Parser function additional parameters (this is the same as for configuration files, thus we refer to that section for the details of the two functions and default values, see Configuration files).

Of course, these functions can be used in general to simulate the invocation of a program with specific command line options (stored in the first string argument), or in general to parse options that are all stored in a string (instead of a vector).

The first argument of these parsers is a string containing the options to parse (remember that this must respect the option format handled by getopt_long, see Terminology). The second one is the pointer to the struct that will be filled with passed options and arguments, as usual. The third option is the program name: this will be used when errors have to be printed. This last argument can be null: in this case, the first element of the first string argument is considered the program name.

Let's show these functionalities with an example. Consider a program that accepts two command line options (required in this case):

     # test for multiple parsers, this is the main file
     # test_main_cmdline_cmd.ggo
     
     option "first-cmd" F "the first command line to parse" required \
            typestr="first command" string multiple
     option "second-cmd" S "the second command line to parse" required \
            typestr="second command" string multiple

These two options accept strings as argument that in turn are considered command line arguments, according to specific syntaxes. The first one is:

     # test for multiple parsers, this is the first command line file
     # test_first_cmdline_cmd.ggostr
     
     option "option-a" a "option a of the first command line to parse"
     optional int option "multi" M \
              "multiple option of the first command line to parse" \
              optional string multiple

and the second one is:

     # test for multiple parsers, this is the second command line file
     # test_second_cmdline_cmd.ggostr
     
     option "option-a" a "option a of the second command line to parse" \
            optional string
     option "option-b" b "option a of the second command line to parse" \
            optional string
     option "my-multi" M \
            "multiple option of the second command line to parse" \
            optional string multiple

These last two files are processed with gengetopt using the --string-parser. Let's put everything together in this main file:

     #ifdef HAVE_CONFIG_H
     #include "config.h"
     #endif
     
     #include <stdio.h>
     #include <stdlib.h>
     
     #include "test_main_cmdline_cmd.h"
     #include "test_first_cmdline_cmd.h"
     #include "test_second_cmdline_cmd.h"
     
     int
     main(int argc, char **argv)
     {
       struct gengetopt_args_info main_args_info;
       struct test_first_cmdline_cmd_struct first_args_info;
       struct test_second_cmdline_cmd_struct second_args_info;
       int exit_code = 0;
       unsigned int i, j;
     
       if (test_main_cmdline_cmd_parser (argc, argv, &main_args_info) != 0) {
         exit_code = 1;
         return exit_code;
       }
     
       for (j = 0; j < main_args_info.second_cmd_given; ++j) {
         printf("second cmdline: %s\n", main_args_info.second_cmd_arg[j]);
         if (test_second_cmdline_cmd_parser_string
            (main_args_info.second_cmd_arg[j], &second_args_info, argv[0]) == 0) {
           if (second_args_info.option_a_given)
            printf("  --option-a: %s\n", second_args_info.option_a_arg);
           if (second_args_info.option_b_given)
            printf("  --option-b: %s\n", second_args_info.option_b_arg);
           for (i = 0; i < second_args_info.my_multi_given; ++i)
            printf("  --my-multi: %s\n", second_args_info.my_multi_arg[i]);
     
           test_second_cmdline_cmd_parser_free (&second_args_info);
         }
       }
     
       for (j = 0; j < main_args_info.first_cmd_given; ++j) {
         printf("first cmdline: %s\n", main_args_info.first_cmd_arg[j]);
         if (test_first_cmdline_cmd_parser_string
            (main_args_info.first_cmd_arg[j], &first_args_info, argv[0]) == 0) {
           if (first_args_info.option_a_given)
            printf("  --option-a: %d\n", first_args_info.option_a_arg);
           for (i = 0; i < first_args_info.multi_given; ++i)
            printf("  --multi: %s\n", first_args_info.multi_arg[i]);
     
           test_first_cmdline_cmd_parser_free (&first_args_info);
         }
       }
     
       test_main_cmdline_cmd_parser_free (&main_args_info);
     
       return exit_code;
     }
     

Notice that in the for loops we always free the elements of the argument structures in order to avoid memory leaks.

Now if you can run this program as follows (notice that we use the comma separated arguments for multiple option arguments but we escape it with \ because otherwise, e.g., 200 and 300 would be intended as further arguments of --first-cmd instead of --multi, see Multiple Options):

     ./test_multiple_parsers \
             --first-cmd="-M400 -a10 --multi 100\,200\,300" \
             --second-cmd="-a20 -b10 --my-multi=a\,b\,c\,d\,e\,f" \
             -F"-M500 -M600" -S"--my-multi g"
     second cmdline: -a20 -b10 --my-multi=a,b,c,d,e,f
       --option-a: 20
       --option-b: 10
       --my-multi: a
       --my-multi: b
       --my-multi: c
       --my-multi: d
       --my-multi: e
       --my-multi: f
     second cmdline: --my-multi g
       --my-multi: g
     first cmdline: -M400 -a10 --multi 100,200,300
       --option-a: 10
       --multi: 400
       --multi: 100
       --multi: 200
       --multi: 300
     first cmdline: -M500 -M600
       --multi: 500
       --multi: 600


Next: , Previous: String Parsers and Multiple Parsers, Up: Top

12 What if getopt_long is not available?

If you use gengetopt to generate C functions for parsing command line arguments you have to know that these generated functions use getopt_long to actually read the command line and parsing it. This function is typically part of the standard C library, but some implementations may not include it. If you want your program to be portable on several systems, and be compilable with many C compilers, you can rely on one of the following solutions.

12.1 Include the getopt_long code into the generated parser

Since version 2.17, gengetopt can include into the generated C parser file the code of getopt_long, so that the include code will be used to actually parse the command line arguments, instead of that taken from the C library.

This solution is actually quite easy, since you only need to specify the command line option --include-getopt (see Invoking gengetopt), but it has two main drawbacks:

  • The generate C file of the parser will be much bigger;
  • You won't be able to use the latest version of getopt_long of the C library

It is up to you to choose between this and the automake/autoconf based solution.

Actually, this solution has the advantage that your program won't behave strangely when used with another implementation of getopt_long.

I prefer the automake/autoconf based solution, as described in Use automake/autoconf, in particular the one described in Use Gnulib, which is also the one I adopt for gengetopt itself.

12.2 Use automake/autoconf to check for the existence of getopt_long

Autoconf and Automake are great tools to generate a configure script that automatically checks for the configuration of your system and for possible missing functions required to compile your program. However, in case of detected missing functions, your program must be able to provide a replacement for such functions. In the next sections we describe two mechanisms for including the (possible) missing code for getopt_long and for checking its presence with automake/autoconf. Since version 2.19, gengetopt itself uses the first mechanism.

12.2.1 Use Gnulib

Since version 2.19 I also started to use Gnulib - The GNU Portability Library37, “a central location for common GNU code, intended to be shared among GNU packages”. Gnulib provides an easy and smooth way to add to your package sources the sources of functions that you want to check during configure. It will also handle the checks for these functions in the configure script, and in case they're not in your system (or they're present but with some missing features) it compiles their sources into a library (that you will need to link your program to, as illustrated in the following).

Once you retrieved gnulib (for the moment it is available only through git, see the home page), you can invoke ‘gnulib-tool --import’ that will copy source files, create a Makefile.am to build them, generate a file gnulib-comp.m4 with Autoconf M4 macro declarations used by configure.ac, and generate a file gnulib-cache.m4 containing the cached specification of how Gnulib is used. In particular, you must specify the modules you want to import, and in our case, it is getopt:

     gnulib-tool --import getopt

By default, the source code is copied into lib/ and the M4 macros in m4/. You can override these paths by using --source-base=DIRECTORY and --m4-base=DIRECTORY. For instance, gengetopt uses gl and gl/m4, respectively. We will use these directories in the rest of this section.

You must ensure Autoconf can find the macro definitions in gnulib-comp.m4. Use the ACLOCAL_AMFLAGS specifier in your top-level Makefile.am file (and the first time you run aclocal you have to use the -I as well); for instance, in the case of gengetopt we have:

     ACLOCAL_AMFLAGS = -I gl/m4

You are now ready to call the M4 macros in gnulib-comp.m4 from configure.ac. The macro gl_EARLY must be called as soon as possible after verifying that the C compiler is working. Typically, this is immediately after AC_PROG_CC, as in:

     ...
     AC_PROG_CC
     gl_EARLY
     ...

The core part of the gnulib checks are done by the macro gl_INIT. Place it further down in the file, typically where you normally check for header files or functions. For example:

     ...
     # For gnulib.
     gl_INIT
     ...

gl_INIT will in turn call the macros related with the gnulib functions, be it specific gnulib macros. So there is no need to call those macros yourself when you use the corresponding gnulib modules.

You must also make sure that the gnulib library is built. Add the Makefile in the gnulib source base directory to AC_CONFIG_FILES, as in:

     AC_CONFIG_FILES(... gl/Makefile ...)

You must also make sure that make will recurse into the gnulib directory. To achieve this, add the gnulib source base directory to a SUBDIRS Makefile.am statement, as in:

     SUBDIRS = gl

Finally, you have to add compiler and linker flags in the appropriate source directories, so that you can make use of the gnulib library. Since the ‘getopt’ module copies files into the build directory, top_builddir/gl is needed as well as top_srcdir/gl. For example:

     ...
     AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl
     ...
     LDADD = gl/libgnu.a
     ...

Don't forget to #include the various header files. In this example, you would need to make sure that ‘#include "getopt.h"’ is evaluated when compiling all source code files, that want to make use of getopt or getopt_long. If you simply use the files generated by gengetopt, you won't need include this header though, since it is already handled by the generated files.

Every now and then, check whether there are updates in the Gnulib modules, and if the modules you use (e.g., getopt) are upgraded, please remember to also update your files, simply by running:

     gnulib-tool --update

We refer to Gnulib documentation for further explanations and features.

12.2.2 Use getopt_long sources

NOTICE: this was the procedure used by gengetopt itself up to version 2.18. We suggest now to use the procedure described in Use Gnulib, since the files described in the following might not be kept up-to-date.

We provide C files that actually implement getopt_long function: getopt.c getopt1.c and gnugetopt.h. You'll find these files in the <install prefix>/share/gengetopt directory where <install prefix> is the one you specified during compilation. If no prefix had been specified, /usr/local is the default. If you downloaded gengetopt in binary form prefix will probably be /usr/local or /usr.

You can rename gnugetopt.h to getopt.h and then simply compile these files and link them to the executable of you program. However, if you use automake and autoconf here's a more elegant solution: you should download the file adl_func_getopt_long.m4 you find at this site:

http://autoconf-archive.cryp.to

and add its contents to your acinclude.m4. You can find this macro also in the acinclude.m4 in the sources of gengetopt.

This macro checks if getopt_long function is in C library; if it is not then it adds getopt.o and getopt1.o to the objects files that will be linked to your executable (LIBOBJS).

Then in Makefile.am of your source directory you have to add the contents of LIBOBJS to the LDADD of the program that has to use getopt_long; e.g., if the program foo has to use getopt_long, you have to add the following line

     foo_LDADD = @LIBOBJS@

Now these files will be compiled and linked to your program only if necessary.

Moreover you have to add getopt.c getopt1.c and gnugetopt.h to your distribution. Note that it is not necessary to put these file names among the foo_SOURCES contents), but you have to add gnugetopt.h to EXTRA_DIST:

     EXTRA_DIST = gnugetopt.h

You may want to take a look at gengetopt's configure.in and src/Makefile.am: they both use the techniques described here.


Next: , Previous: No getopt_long, Up: Top

13 Known Bugs and Limitations

If you find a bug in gengetopt, please use the Savannah web interface

http://savannah.gnu.org/bugs/?group=gengetopt

Include the version number, which you can find by running ‘gengetopt --version. Also include in your message the output that the program produced and the output you expected.

If you have other questions, comments or suggestions about gengetopt, contact the author via electronic mail (find the address at http://www.lorenzobettini.it). The author will try to help you out, although he may not have time to fix your problems.

The list of to-dos in the TODO.


Previous: Bugs, Up: Bugs

13.1 Getopt and subsequent calls

It seems that getopt_long, at least the version in the GNU library, if invoked with different argv arrays, might access memory in a bad way leading to crashes or unexpected behaviors. This happens because it keeps pointers to locations of the previous arrays if not initialized each time by setting optind = 038. Unfortunately this initialization behavior seems to be part only of the implementation of GNU library and actually it is not documented (you can see it by taking a look into the source of getopt.c); other implementations of getopt_long might not be affected by this problem; alternatively, as reported by a user, optind = 0 leads some getopt_long implementations to consider the program name as a command line option (since it is in position 0), which is bad anyway!

Probably this is usually not a problem since you usually parse only the command line, thus you only invoke the command line parser only once, and only with one instance of array (i.e., the argv passed to main). However, it can lead to problems when you use advanced features, as in the case of configuration file parsing (see Configuration files) and multiple parsers (see String Parsers and Multiple Parsers).

The parser generated by gengetopt checks whether the program name was actually considered a command line option, and in that case it removes it from the collected command line options; thus, this optind issue should not come up anyway. In case you still don't feel comfortable, you can include a correct getopt_long implementation in the generated parser, so that you can be sure you will always use the same implementation of getopt_long (Include the getopt_long code into the parser).


Next: , Previous: Bugs, Up: Top

14 Mailing Lists

The following mailing lists are available:

help-gengetopt at gnu dot org

for generic discussions about the program and for asking for help about it (open mailing list), http://mail.gnu.org/mailman/listinfo/help-gengetopt

info-gengetopt at gnu dot org

for receiving information about new releases and features (read-only mailing list), http://mail.gnu.org/mailman/listinfo/info-gengetopt.

If you want to subscribe to a mailing list just go to the URL and follow the instructions, or send me an e-mail and I'll subscribe you.

I'll describe new features in new releases also on my blog, at this URL:

http://tronprog.blogspot.com/search/label/gengetopt


Previous: Mailing Lists, Up: Top

Index


Footnotes

[1] Since version 2.22.4 of Gengetopt the CVS repository was dismissed in favor of Git (http://git-scm.com/).

[2] http://www.gnu.org/software/autoconf

[3] http://www.gnu.org/software/automake

[4] http://www.gnu.org/software/libtool

[5] http://www.gnu.org/software/gnulib

[6] Since version 2.19.

[7] Since version 2.19.

[8] Since version 2.18

[9] Since version 2.22.

[10] Since version 2.22 the type can be specified

[11] Since version 2.20.

[12] Since version 2.15.

[13] Since version 2.16.

[14] This is true since version 2.19. Before this version, strings were not allowed to spawn more than one line.

[15] Since version 2.19.

[16] This holds since version 2.15: in previous versions the option specifications had to be given in a fixed order.

[17] Before version 2.22 neither --help was added and you had to handle the help option manually

[18] Since version 2.16.

[19] Since version 2.22.

[20] Since version 2.18.

[21] as it was up to version 2.22.2 of gengetopt.

[22] This is taken from the comments in getopt.in.h of gnulib.

[23] Since version 2.22 this field is of type unsigned int instead of int for uniformity with multiple options.

[24] The <option>_orig was introduced in the release 2.14.

[25] These strings and the <option>_help were introduced in the release 2.17.

[26] This function was introduced in the release 2.14.

[27] Introduced in version 2.22, thanks to Papp Gyozo.

[28] Since version 2.17.

[29] Since version 2.22.3.

[30] Since version 2.22.

[31] Since version 2.21.

[32] Introduced in version 2.22

[33] The <cmd_parser_name>_params_init was introduced in version 2.21, but it used to initialize all its fields to 0, which does not make much sense, since it's more helpful to have the fields initialized to their default values; in order not to silently break the semantics of previous code, the (void argument) creation function is now called <cmd_parser_name>_params_create and <cmd_parser_name>_params_init is now a procedure that initializes a passed pointer to the structure. This will make previous code not compilable, since the signature of <cmd_parser_name>_params_init has changed; hopefully, this will force the programmer to realize that something has changed. I'm sorry for the (hopefully little) problems this change might imply.

[34] The previous function <cmd_parser_name>_configfile — notice the absence of the _ — is deprecated and should be no longer used, since it might be removed in the future releases.

[35] The previous function <cmd_parser_name>2 — notice the 2 — is deprecated and should be no longer used, since it might be removed in the future releases.

[36] The previous function <cmd_parser_name>_string2 — notice the 2 — is deprecated and should be no longer used, since it might be removed in the future releases.

[37] http://www.gnu.org/software/gnulib

[38] optind is the global variable in getopt implementation that is the index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to getopt_long.


gengetopt-2.22.6/doc/main1.cc0000664000175000017500000000350212045003074012576 00000000000000/* main1.cc */ /* we try to use gengetopt generated file in a C++ program */ /* we don't use autoconf and automake vars */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "stdlib.h" #include "cmdline1.h" using std::cout; using std::endl; int main (int argc, char **argv) { gengetopt_args_info args_info; cout << "This one is from a C++ program" << endl ; cout << "Try to launch me with some options" << endl ; cout << "(type sample1 --help for the complete list)" << endl ; cout << "For example: ./sample1 *.* --funct-opt" << endl ; /* let's call our cmdline parser */ if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; cout << "Here are the options you passed..." << endl; for ( unsigned i = 0 ; i < args_info.inputs_num ; ++i ) cout << "file: " << args_info.inputs[i] << endl ; if ( args_info.funct_opt_given ) cout << "You chose --funct-opt or -F." << endl ; if ( args_info.str_opt_given ) cout << "You inserted " << args_info.str_opt_arg << " for " << "--str-opt option." << endl ; if ( args_info.int_opt_given ) cout << "This is the integer you input: " << args_info.int_opt_arg << "." << endl; if (args_info.flag_opt_given) cout << "The flag option was given!" << endl; cout << "The flag is " << ( args_info.flag_opt_flag ? "on" : "off" ) << "." << endl ; if (args_info.enum_opt_given) { cout << "enum-opt value: " << args_info.enum_opt_arg << endl; cout << "enum-opt (original specified) value: " << args_info.enum_opt_orig << endl; } if (args_info.secret_given) cout << "Secret option was specified: " << args_info.secret_arg << endl; cout << args_info.def_opt_arg << "! "; cout << "Have a nice day! :-)" << endl ; cmdline_parser_free (&args_info); /* release allocated memory */ return 0; } gengetopt-2.22.6/doc/sample1_2.output.texinfo0000664000175000017500000000420512046536672016023 00000000000000This one is from a C++ program Try to launch me with some options (type sample1 --help for the complete list) For example: ./sample1 *.* --funct-opt sample1 2.0 Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT] [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING] [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --str-opt=filename A string option, for a filename A brief text description before the other options. -m, --my-opt=INT Another integer option, this time the description of the option should be "quite" long to require wrapping... possibly more than one wrapping :-) especially if I require a line break -i, --int-opt=INT A int option (mandatory) more involved options: the following options are more complex --flag-opt A flag option (default=off) -F, --funct-opt A function option A function option is basically an option with no argument. It can be used, e.g., to specify a specific behavior for a program. Well, this further explanation is quite useless, but it's only to show an example of an option with details, which will be printed only when --detailed-help is given at the command line. last option section: --long-opt=LONG A long option --def-opt=STRING A string option with default (default=`Hello') --enum-opt=STRING A string option with list of values (possible values="foo", "bar", "hello", "bye" default=`hello') -S, --secret=INT hidden option will not appear in --help -D, --dependant=INT option that depends on str-opt An ending text. gengetopt-2.22.6/doc/sample1.ggo0000664000175000017500000000341512046536672013345 00000000000000# Name of your program package "sample1" # don't use package if you're using automake # Version of your program version "2.0" # don't use version if you're using automake # Options option "str-opt" s "A string option, for a filename" string typestr="filename" optional text "\nA brief text description" text " before the other options.\n" option "my-opt" m "Another integer option, \ this time the description of the option should be \"quite\" long to \ require wrapping... possibly more than one wrapping :-) \ especially if I\nrequire a line break" int optional option "int-opt" i "A int option" int yes section "more involved options" sectiondesc="the following options\nare more complex" text "" option "flag-opt" - "A flag option" flag off option "funct-opt" F "A function option" optional details="\nA function option is basically an option with no argument.\ It can be used, e.g., to specify a specific behavior for a program. Well, this further explanation is quite useless, but it's only to \ show an example of an option with details, \ which will be printed only when --detailed-help is given \ at the command line." section "last option section" option "long-opt" - "A long option" long optional option "def-opt" - "A string option with default" string default="Hello" optional option "enum-opt" - "A string option with list of values" values="foo","bar","hello","bye" default="hello" optional option "secret" S "hidden option will not appear in --help" int optional hidden option "dependant" D "option that depends on str-opt" int optional dependon="str-opt" text "\nAn ending text." gengetopt-2.22.6/doc/index.html0000664000175000017500000001357112046541022013267 00000000000000 GNU Gengetopt - GNU Project - Free Software Foundation (FSF)

GNU Gengetopt 2.22.6

This program generates a C function that uses getopt_long function to parse the command line options, to validate them and fills a struct .

Thus your program can now handle options such as:

myprog --input foo.c -o foo.o --no-tabs -i 100 *.class
And both long options (those that start with --) and short options (start with - and consist of only one character) can be handled. For standards about short and long options you may want to take a look at the GNU Coding Standards .

Gengetopt can also generate a function to save the command line options into a file, and a function to read the command line options from a file. Of course, these two kinds of files are compliant.

Generated code is commented with Doxygen comments.

gengetopt is free software. Please see the file LICENSE and COPYING for details.
Notice that: Use of gengetopt does not impose any particular license on the generated code: the code generated is not under any license.

For documentation, please read this file.

gengetopt is perfect if you don't want to write all stuff required to call getopt_long, and when you have a program and wish it took options.

Generated code works if you use GNU Autoconf or GNU Automake.

Gengetopt has originally been written by Roberto Arturo Tena Sanchez  and currently maintained by Lorenzo Bettini http://www.lorenzobettini.it.

Gengetopt is a GNU program and its main home page is at GNU site:
http://www.gnu.org/software/gengetopt

Download

You can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/gengetopt/ or from one of its mirrors (see http://www.gnu.org/prep/ftp.html ).

I do not distribute Windows binaries anymore; since, they can be easily built by using Cygwin C/C++ compiler, available at http://www.cygwin.com/. However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail (please find my e-mail address at my home page) and I can send them to you.

1.2 Anonymous Git Checkout

This project's git repository can be checked out through the following clone instruction:

     git clone git://git.savannah.gnu.org/gengetopt.git

Further instructions can be found at the address:

http://savannah.gnu.org/projects/gengetopt.

And the git repository can also browsed on-line at

http://git.savannah.gnu.org/cgit/gengetopt.git.

Since version 2.22.4 of Gengetopt the CVS repository was dismissed in favor of Git (http://git-scm.com/).

Please note that this way you will get the latest development sources of Gengetopt, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources.

If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the tag rel_X_Y_Z.

When you compile the sources that you get from the git repository, before running the configure and make commands, for the first time, you must run the command:

     autoreconf -i

This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake, autoconf and libtool in order for this to succeed.

Bugs

If you find a bug in gengetopt, please use the Savannah web interface

http://savannah.gnu.org/bugs/?group=gengetopt

Changes in this release

  • see NEWS file for a summary of new features in this release and
  • see ChangeLog for the complete list of changes sources
You can also find details about new features on my blog, in this area: http://tronprog.blogspot.com/search/label/gengetopt.

On-line Manual


Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org . There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@gnu.org , send other questions to gnu@gnu.org .

Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

Updated:9 Jan 2001 mhw



gengetopt-2.22.6/doc/gengetopt.10000664000175000017500000001352312046536666013367 00000000000000.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.11. .TH GENGETOPT "1" "November 2012" "gengetopt 2.22.6" "User Commands" .SH NAME gengetopt \- manual page for gengetopt 2.22.6 .SH SYNOPSIS .B gengetopt [\fIOPTIONS\fR]... .SH DESCRIPTION GNU gengetopt 2.22.6 .PP This program generates a C function that uses getopt_long function to parse the command line options, validate them and fill a struct. .TP \fB\-h\fR, \fB\-\-help\fR Print help and exit .TP \fB\-\-detailed\-help\fR Print help, including all details and hidden options, and exit .TP \fB\-V\fR, \fB\-\-version\fR Print version and exit .PP Main options: .TP \fB\-i\fR, \fB\-\-input\fR=\fIfilename\fR input file (default std input) .TP \fB\-f\fR, \fB\-\-func\-name\fR=\fIname\fR name of generated function (default=`cmdline_parser') .TP \fB\-a\fR, \fB\-\-arg\-struct\-name\fR=\fIname\fR name of generated args info struct (default=`gengetopt_args_info') .TP \fB\-F\fR, \fB\-\-file\-name\fR=\fIname\fR name of generated file (default=`cmdline') .TP \fB\-\-output\-dir\fR=\fIpath\fR output directory .IP if this option is not specified, the files are generated in the current directory. .TP \fB\-\-header\-output\-dir\fR=\fIpath\fR header output directory .TP \fB\-\-src\-output\-dir\fR=\fIpath\fR source output directory .TP \fB\-c\fR, \fB\-\-c\-extension\fR=\fIext\fR extension of c file (default=`c') .TP \fB\-H\fR, \fB\-\-header\-extension\fR=\fIext\fR extension of header file (default=`h') .TP \fB\-l\fR, \fB\-\-long\-help\fR long usage line in help .IP The usage line will print all the options, e.g., .IP sample1 \fB\-iINT\fR|\-\-int\-opt=INT [\-h|\-\-help] .TP \fB\-\-default\-optional\fR by default, an option is considered optional if not specified otherwise .TP \fB\-u\fR, \fB\-\-unamed\-opts\fR[=\fISTRING\fR] accept options without names (e.g., file names) (default=`FILES') .PP The parser generated is thought to be used to parse the command line arguments. However, you can also generate parsers for configuration files, or strings that contain the arguments to parse, by using the following two options. .TP \fB\-C\fR, \fB\-\-conf\-parser\fR generate a config file parser .TP \fB\-S\fR, \fB\-\-string\-parser\fR generate a string parser (the string contains the command line) .SS "Additional options:" .TP \fB\-G\fR, \fB\-\-include\-getopt\fR adds the code for getopt_long in the generated C file .TP \fB\-n\fR, \fB\-\-no\-handle\-help\fR do not handle \fB\-\-help\fR|\-h automatically .IP If \fB\-\-no\-handle\-help\fR is specified, the command line option \fB\-\-help\fR|\-h will not be handled automatically, so the programmer will be able to print some other information; then the function for printing the standard help output can be used; this function is called _print_help. .IP Notice that, although the programmer can handle \fB\-\-help\fR|\-h manually, the parser will return after finding such option: the other command line options, if any, will be ignored. In case you want to have full control on \fB\-\-help\fR|\-h, you should use \fB\-\-ho\-help\fR. .TP \fB\-\-no\-help\fR do not add \fB\-\-help\fR|\-h automatically .IP With this option you can disable the automatic addition of options \fB\-\-help\fR|\-h. The programmer will then be able to add this option in the input file and handle it as he sees fit. Notice that \fB\-\-no\-help\fR will also disable the automatic options \fB\-\-detailed\-help\fR and \fB\-\-full\-help\fR. .IP The programmer can still define options with short character h as he wants, but he cannot define options help, unless he specifies \fB\-\-no\-help\fR (otherwise an error will be printed). .TP \fB\-N\fR, \fB\-\-no\-handle\-version\fR do not handle \fB\-\-version\fR|\-V automatically .TP \fB\-\-no\-version\fR do not add \fB\-\-version\fR|\-V automatically .IP See above the details about \fB\-\-no\-handle\-help\fR and \fB\-\-no\-help\fR, respectively. .TP \fB\-e\fR, \fB\-\-no\-handle\-error\fR do not exit on errors .IP With this option, if the generated parser encounters an error (e.g., an unknown option) it does not make the main program exit; instead, the parser function returns a value different 0, and the main program can print a help message. .TP \fB\-\-show\-required\fR[=\fISTRING\fR] in the output of help will specify which options are mandatory, by using the optional passed string (default=`(mandatory)') .TP \fB\-\-strict\-hidden\fR completely hide hidden options .TP \fB\-g\fR, \fB\-\-gen\-version\fR put gengetopt version in the generated file (default=on) .TP \fB\-\-set\-package\fR=\fISTRING\fR set the package name (override package defined in the .ggo file) .TP \fB\-\-set\-version\fR=\fISTRING\fR set the version number (override version defined in the .ggo file) .TP \fB\-\-show\-help\fR show the output of \fB\-\-help\fR instead of generating code .TP \fB\-\-show\-full\-help\fR show the output of \fB\-\-full\-help\fR (i.e., including hidden options) instead of generating code .TP \fB\-\-show\-detailed\-help\fR show the output of \fB\-\-detailed\-help\fR (i.e., including details and hidden options) instead of generating code .TP \fB\-\-show\-version\fR show the output of \fB\-\-version\fR instead of generating code .PP Please refer to the info manual for further explanations. .PP Maintained by Lorenzo Bettini .SH COPYRIGHT Copyright \(co 1999\-2011 Free Software Foundation Inc. This program comes with ABSOLUTELY NO WARRANTY; for details please see the file 'COPYING' supplied with the source code. .br This is free software, and you are welcome to redistribute it under certain conditions; again, see 'COPYING' for details. This program is released under the GNU General Public License. .SH "SEE ALSO" The full documentation for .B gengetopt is maintained as a Texinfo manual. If the .B info and .B gengetopt programs are properly installed at your site, the command .IP .B info gengetopt .PP should give you access to the complete manual. gengetopt-2.22.6/doc/help_output.texinfo0000664000175000017500000000714512046536546015257 00000000000000gengetopt This program generates a C function that uses getopt_long function to parse the command line options, validate them and fill a struct. Usage: gengetopt [OPTIONS]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit -V, --version Print version and exit Main options: -i, --input=filename input file (default std input) -f, --func-name=name name of generated function (default=`cmdline_parser') -a, --arg-struct-name=name name of generated args info struct (default=`gengetopt_args_info') -F, --file-name=name name of generated file (default=`cmdline') --output-dir=path output directory --header-output-dir=path header output directory --src-output-dir=path source output directory -c, --c-extension=ext extension of c file (default=`c') -H, --header-extension=ext extension of header file (default=`h') -l, --long-help long usage line in help --default-optional by default, an option is considered optional if not specified otherwise -u, --unamed-opts[=STRING] accept options without names (e.g., file names) (default=`FILES') The parser generated is thought to be used to parse the command line arguments. However, you can also generate parsers for configuration files, or strings that contain the arguments to parse, by using the following two options. -C, --conf-parser generate a config file parser -S, --string-parser generate a string parser (the string contains the command line) Additional options: -G, --include-getopt adds the code for getopt_long in the generated C file -n, --no-handle-help do not handle --help|-h automatically --no-help do not add --help|-h automatically -N, --no-handle-version do not handle --version|-V automatically --no-version do not add --version|-V automatically -e, --no-handle-error do not exit on errors --show-required[=STRING] in the output of help will specify which options are mandatory, by using the optional passed string (default=`(mandatory)') --strict-hidden completely hide hidden options -g, --gen-version put gengetopt version in the generated file (default=on) --set-package=STRING set the package name (override package defined in the .ggo file) --set-version=STRING set the version number (override version defined in the .ggo file) --show-help show the output of --help instead of generating code --show-full-help show the output of --full-help (i.e., including hidden options) instead of generating code --show-detailed-help show the output of --detailed-help (i.e., including details and hidden options) instead of generating code --show-version show the output of --version instead of generating code Please refer to the info manual for further explanations. gengetopt-2.22.6/doc/cmdline1.c0000664000175000017500000007375012046536672013156 00000000000000/* File autogenerated by gengetopt version 2.22.6 generated with the following command: ../src/gengetopt -i ../../doc/sample1.ggo -Fcmdline1 --long-help -u --show-required The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it. */ /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef FIX_UNUSED #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include #include "cmdline1.h" const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_usage = "Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help]\n [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT]\n [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING]\n [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_detailed_help[] = { " -h, --help Print help and exit", " --detailed-help Print help, including all details and hidden options,\n and exit", " --full-help Print help, including hidden options, and exit", " -V, --version Print version and exit", " -s, --str-opt=filename A string option, for a filename", "\nA brief text description before the other options.\n", " -m, --my-opt=INT Another integer option, this time the description of\n the option should be \"quite\" long to require\n wrapping... possibly more than one wrapping :-)\n especially if I\n require a line break", " -i, --int-opt=INT A int option (mandatory)", "", "\nmore involved options:", " the following options\n are more complex", " --flag-opt A flag option (default=off)", " -F, --funct-opt A function option", " \n A function option is basically an option with no argument. It can be used,\n e.g., to specify a specific behavior for a program.\n\n Well, this further explanation is quite useless, but it's only to show an\n example of an option with details, which will be printed only when\n --detailed-help is given at the command line.", "\nlast option section:", " --long-opt=LONG A long option", " --def-opt=STRING A string option with default (default=`Hello')", " --enum-opt=STRING A string option with list of values (possible\n values=\"foo\", \"bar\", \"hello\", \"bye\"\n default=`hello')", " -S, --secret=INT hidden option will not appear in --help", " -D, --dependant=INT option that depends on str-opt", "\nAn ending text.", 0 }; static void init_full_help_array(void) { gengetopt_args_info_full_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_full_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_full_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_full_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_full_help[4] = gengetopt_args_info_detailed_help[4]; gengetopt_args_info_full_help[5] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_full_help[6] = gengetopt_args_info_detailed_help[6]; gengetopt_args_info_full_help[7] = gengetopt_args_info_detailed_help[7]; gengetopt_args_info_full_help[8] = gengetopt_args_info_detailed_help[8]; gengetopt_args_info_full_help[9] = gengetopt_args_info_detailed_help[9]; gengetopt_args_info_full_help[10] = gengetopt_args_info_detailed_help[10]; gengetopt_args_info_full_help[11] = gengetopt_args_info_detailed_help[11]; gengetopt_args_info_full_help[12] = gengetopt_args_info_detailed_help[12]; gengetopt_args_info_full_help[13] = gengetopt_args_info_detailed_help[14]; gengetopt_args_info_full_help[14] = gengetopt_args_info_detailed_help[15]; gengetopt_args_info_full_help[15] = gengetopt_args_info_detailed_help[16]; gengetopt_args_info_full_help[16] = gengetopt_args_info_detailed_help[17]; gengetopt_args_info_full_help[17] = gengetopt_args_info_detailed_help[18]; gengetopt_args_info_full_help[18] = gengetopt_args_info_detailed_help[19]; gengetopt_args_info_full_help[19] = gengetopt_args_info_detailed_help[20]; gengetopt_args_info_full_help[20] = 0; } const char *gengetopt_args_info_full_help[21]; static void init_help_array(void) { gengetopt_args_info_help[0] = gengetopt_args_info_detailed_help[0]; gengetopt_args_info_help[1] = gengetopt_args_info_detailed_help[1]; gengetopt_args_info_help[2] = gengetopt_args_info_detailed_help[2]; gengetopt_args_info_help[3] = gengetopt_args_info_detailed_help[3]; gengetopt_args_info_help[4] = gengetopt_args_info_detailed_help[4]; gengetopt_args_info_help[5] = gengetopt_args_info_detailed_help[5]; gengetopt_args_info_help[6] = gengetopt_args_info_detailed_help[6]; gengetopt_args_info_help[7] = gengetopt_args_info_detailed_help[7]; gengetopt_args_info_help[8] = gengetopt_args_info_detailed_help[8]; gengetopt_args_info_help[9] = gengetopt_args_info_detailed_help[9]; gengetopt_args_info_help[10] = gengetopt_args_info_detailed_help[10]; gengetopt_args_info_help[11] = gengetopt_args_info_detailed_help[11]; gengetopt_args_info_help[12] = gengetopt_args_info_detailed_help[12]; gengetopt_args_info_help[13] = gengetopt_args_info_detailed_help[14]; gengetopt_args_info_help[14] = gengetopt_args_info_detailed_help[15]; gengetopt_args_info_help[15] = gengetopt_args_info_detailed_help[16]; gengetopt_args_info_help[16] = gengetopt_args_info_detailed_help[17]; gengetopt_args_info_help[17] = gengetopt_args_info_detailed_help[19]; gengetopt_args_info_help[18] = gengetopt_args_info_detailed_help[20]; gengetopt_args_info_help[19] = 0; } const char *gengetopt_args_info_help[20]; typedef enum {ARG_NO , ARG_FLAG , ARG_STRING , ARG_INT , ARG_LONG } cmdline_parser_arg_type; static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error); static int cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); const char *cmdline_parser_enum_opt_values[] = {"foo", "bar", "hello", "bye", 0}; /*< Possible values for enum-opt. */ static char * gengetopt_strdup (const char *s); static void clear_given (struct gengetopt_args_info *args_info) { args_info->help_given = 0 ; args_info->detailed_help_given = 0 ; args_info->full_help_given = 0 ; args_info->version_given = 0 ; args_info->str_opt_given = 0 ; args_info->my_opt_given = 0 ; args_info->int_opt_given = 0 ; args_info->flag_opt_given = 0 ; args_info->funct_opt_given = 0 ; args_info->long_opt_given = 0 ; args_info->def_opt_given = 0 ; args_info->enum_opt_given = 0 ; args_info->secret_given = 0 ; args_info->dependant_given = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->str_opt_arg = NULL; args_info->str_opt_orig = NULL; args_info->my_opt_orig = NULL; args_info->int_opt_orig = NULL; args_info->flag_opt_flag = 0; args_info->long_opt_orig = NULL; args_info->def_opt_arg = gengetopt_strdup ("Hello"); args_info->def_opt_orig = NULL; args_info->enum_opt_arg = gengetopt_strdup ("hello"); args_info->enum_opt_orig = NULL; args_info->secret_orig = NULL; args_info->dependant_orig = NULL; } static void init_args_info(struct gengetopt_args_info *args_info) { init_full_help_array(); init_help_array(); args_info->help_help = gengetopt_args_info_detailed_help[0] ; args_info->detailed_help_help = gengetopt_args_info_detailed_help[1] ; args_info->full_help_help = gengetopt_args_info_detailed_help[2] ; args_info->version_help = gengetopt_args_info_detailed_help[3] ; args_info->str_opt_help = gengetopt_args_info_detailed_help[4] ; args_info->my_opt_help = gengetopt_args_info_detailed_help[6] ; args_info->int_opt_help = gengetopt_args_info_detailed_help[7] ; args_info->flag_opt_help = gengetopt_args_info_detailed_help[11] ; args_info->funct_opt_help = gengetopt_args_info_detailed_help[12] ; args_info->long_opt_help = gengetopt_args_info_detailed_help[15] ; args_info->def_opt_help = gengetopt_args_info_detailed_help[16] ; args_info->enum_opt_help = gengetopt_args_info_detailed_help[17] ; args_info->secret_help = gengetopt_args_info_detailed_help[18] ; args_info->dependant_help = gengetopt_args_info_detailed_help[19] ; } void cmdline_parser_print_version (void) { printf ("%s %s\n", (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), CMDLINE_PARSER_VERSION); if (strlen(gengetopt_args_info_versiontext) > 0) printf("\n%s\n", gengetopt_args_info_versiontext); } static void print_help_common(void) { cmdline_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); if (strlen(gengetopt_args_info_usage) > 0) printf("\n%s\n", gengetopt_args_info_usage); printf("\n"); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n\n", gengetopt_args_info_description); } void cmdline_parser_print_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } void cmdline_parser_print_full_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_full_help[i]) printf("%s\n", gengetopt_args_info_full_help[i++]); } void cmdline_parser_print_detailed_help (void) { int i = 0; print_help_common(); while (gengetopt_args_info_detailed_help[i]) printf("%s\n", gengetopt_args_info_detailed_help[i++]); } void cmdline_parser_init (struct gengetopt_args_info *args_info) { clear_given (args_info); clear_args (args_info); init_args_info (args_info); args_info->inputs = 0; args_info->inputs_num = 0; } void cmdline_parser_params_init(struct cmdline_parser_params *params) { if (params) { params->override = 0; params->initialize = 1; params->check_required = 1; params->check_ambiguity = 0; params->print_errors = 1; } } struct cmdline_parser_params * cmdline_parser_params_create(void) { struct cmdline_parser_params *params = (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); cmdline_parser_params_init(params); return params; } static void free_string_field (char **s) { if (*s) { free (*s); *s = 0; } } static void cmdline_parser_release (struct gengetopt_args_info *args_info) { unsigned int i; free_string_field (&(args_info->str_opt_arg)); free_string_field (&(args_info->str_opt_orig)); free_string_field (&(args_info->my_opt_orig)); free_string_field (&(args_info->int_opt_orig)); free_string_field (&(args_info->long_opt_orig)); free_string_field (&(args_info->def_opt_arg)); free_string_field (&(args_info->def_opt_orig)); free_string_field (&(args_info->enum_opt_arg)); free_string_field (&(args_info->enum_opt_orig)); free_string_field (&(args_info->secret_orig)); free_string_field (&(args_info->dependant_orig)); for (i = 0; i < args_info->inputs_num; ++i) free (args_info->inputs [i]); if (args_info->inputs_num) free (args_info->inputs); clear_given (args_info); } /** * @param val the value to check * @param values the possible values * @return the index of the matched value: * -1 if no value matched, * -2 if more than one value has matched */ static int check_possible_values(const char *val, const char *values[]) { int i, found, last; size_t len; if (!val) /* otherwise strlen() crashes below */ return -1; /* -1 means no argument for the option */ found = last = 0; for (i = 0, len = strlen(val); values[i]; ++i) { if (strncmp(val, values[i], len) == 0) { ++found; last = i; if (strlen(values[i]) == len) return i; /* exact macth no need to check more */ } } if (found == 1) /* one match: OK */ return last; return (found ? -2 : -1); /* return many values or none matched */ } static void write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { int found = -1; if (arg) { if (values) { found = check_possible_values(arg, values); } if (found >= 0) fprintf(outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]); else fprintf(outfile, "%s=\"%s\"\n", opt, arg); } else { fprintf(outfile, "%s\n", opt); } } int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) write_into_file(outfile, "help", 0, 0 ); if (args_info->detailed_help_given) write_into_file(outfile, "detailed-help", 0, 0 ); if (args_info->full_help_given) write_into_file(outfile, "full-help", 0, 0 ); if (args_info->version_given) write_into_file(outfile, "version", 0, 0 ); if (args_info->str_opt_given) write_into_file(outfile, "str-opt", args_info->str_opt_orig, 0); if (args_info->my_opt_given) write_into_file(outfile, "my-opt", args_info->my_opt_orig, 0); if (args_info->int_opt_given) write_into_file(outfile, "int-opt", args_info->int_opt_orig, 0); if (args_info->flag_opt_given) write_into_file(outfile, "flag-opt", 0, 0 ); if (args_info->funct_opt_given) write_into_file(outfile, "funct-opt", 0, 0 ); if (args_info->long_opt_given) write_into_file(outfile, "long-opt", args_info->long_opt_orig, 0); if (args_info->def_opt_given) write_into_file(outfile, "def-opt", args_info->def_opt_orig, 0); if (args_info->enum_opt_given) write_into_file(outfile, "enum-opt", args_info->enum_opt_orig, cmdline_parser_enum_opt_values); if (args_info->secret_given) write_into_file(outfile, "secret", args_info->secret_orig, 0); if (args_info->dependant_given) write_into_file(outfile, "dependant", args_info->dependant_orig, 0); i = EXIT_SUCCESS; return i; } int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); return EXIT_FAILURE; } i = cmdline_parser_dump(outfile, args_info); fclose (outfile); return i; } void cmdline_parser_free (struct gengetopt_args_info *args_info) { cmdline_parser_release (args_info); } /** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { char *result = 0; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result; } int cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); } int cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params) { int result; result = cmdline_parser_internal (argc, argv, args_info, params, 0); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct cmdline_parser_params params; params.override = override; params.initialize = initialize; params.check_required = check_required; params.check_ambiguity = 0; params.print_errors = 1; result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; if (cmdline_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result; } int cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->int_opt_given) { fprintf (stderr, "%s: '--int-opt' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } /* checks for dependences among options */ if (args_info->dependant_given && ! args_info->str_opt_given) { fprintf (stderr, "%s: '--dependant' ('-D') option depends on option 'str-opt'%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } return error_occurred; } static char *package_name = 0; /** * @brief updates an option * @param field the generic pointer to the field to update * @param orig_field the pointer to the orig field * @param field_given the pointer to the number of occurrence of this option * @param prev_given the pointer to the number of occurrence already seen * @param value the argument for this option (if null no arg was specified) * @param possible_values the possible values for this option (if specified) * @param default_value the default value (in case the option only accepts fixed values) * @param arg_type the type of this option * @param check_ambiguity @see cmdline_parser_params.check_ambiguity * @param override @see cmdline_parser_params.override * @param no_free whether to free a possible previous value * @param multiple_option whether this is a multiple option * @param long_opt the corresponding long option * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ static int update_arg(void *field, char **orig_field, unsigned int *field_given, unsigned int *prev_given, char *value, const char *possible_values[], const char *default_value, cmdline_parser_arg_type arg_type, int check_ambiguity, int override, int no_free, int multiple_option, const char *long_opt, char short_opt, const char *additional_error) { char *stop_char = 0; const char *val = value; int found; char **string_field; FIX_UNUSED (field); stop_char = 0; found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", package_name, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: `--%s' option given more than once%s\n", package_name, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0) { if (short_opt != '-') fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, short_opt, (additional_error ? additional_error : "")); else fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n", package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, (additional_error ? additional_error : "")); return 1; /* failure */ } if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; if (field_given) (*field_given)++; if (possible_values) val = possible_values[found]; switch(arg_type) { case ARG_FLAG: *((int *)field) = !*((int *)field); break; case ARG_INT: if (val) *((int *)field) = strtol (val, &stop_char, 0); break; case ARG_LONG: if (val) *((long *)field) = (long)strtol (val, &stop_char, 0); break; case ARG_STRING: if (val) { string_field = (char **)field; if (!no_free && *string_field) free (*string_field); /* free previous string */ *string_field = gengetopt_strdup (val); } break; default: break; }; /* check numeric conversion */ switch(arg_type) { case ARG_INT: case ARG_LONG: if (val && !(stop_char && *stop_char == '\0')) { fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); return 1; /* failure */ } break; default: ; }; /* store the original value */ switch(arg_type) { case ARG_NO: case ARG_FLAG: break; default: if (value && orig_field) { if (no_free) { *orig_field = value; } else { if (*orig_field) free (*orig_field); /* free previous string */ *orig_field = gengetopt_strdup (value); } } }; return 0; /* OK */ } int cmdline_parser_internal ( int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; int override; int initialize; int check_required; int check_ambiguity; package_name = argv[0]; override = params->override; initialize = params->initialize; check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) cmdline_parser_init (args_info); cmdline_parser_init (&local_args_info); optarg = 0; optind = 0; opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "detailed-help", 0, NULL, 0 }, { "full-help", 0, NULL, 0 }, { "version", 0, NULL, 'V' }, { "str-opt", 1, NULL, 's' }, { "my-opt", 1, NULL, 'm' }, { "int-opt", 1, NULL, 'i' }, { "flag-opt", 0, NULL, 0 }, { "funct-opt", 0, NULL, 'F' }, { "long-opt", 1, NULL, 0 }, { "def-opt", 1, NULL, 0 }, { "enum-opt", 1, NULL, 0 }, { "secret", 1, NULL, 'S' }, { "dependant", 1, NULL, 'D' }, { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVs:m:i:FS:D:", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ cmdline_parser_print_help (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ cmdline_parser_print_version (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); case 's': /* A string option, for a filename. */ if (update_arg( (void *)&(args_info->str_opt_arg), &(args_info->str_opt_orig), &(args_info->str_opt_given), &(local_args_info.str_opt_given), optarg, 0, 0, ARG_STRING, check_ambiguity, override, 0, 0, "str-opt", 's', additional_error)) goto failure; break; case 'm': /* Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I require a line break. */ if (update_arg( (void *)&(args_info->my_opt_arg), &(args_info->my_opt_orig), &(args_info->my_opt_given), &(local_args_info.my_opt_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "my-opt", 'm', additional_error)) goto failure; break; case 'i': /* A int option. */ if (update_arg( (void *)&(args_info->int_opt_arg), &(args_info->int_opt_orig), &(args_info->int_opt_given), &(local_args_info.int_opt_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "int-opt", 'i', additional_error)) goto failure; break; case 'F': /* A function option. */ if (update_arg( 0 , 0 , &(args_info->funct_opt_given), &(local_args_info.funct_opt_given), optarg, 0, 0, ARG_NO, check_ambiguity, override, 0, 0, "funct-opt", 'F', additional_error)) goto failure; break; case 'S': /* hidden option will not appear in --help. */ if (update_arg( (void *)&(args_info->secret_arg), &(args_info->secret_orig), &(args_info->secret_given), &(local_args_info.secret_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "secret", 'S', additional_error)) goto failure; break; case 'D': /* option that depends on str-opt. */ if (update_arg( (void *)&(args_info->dependant_arg), &(args_info->dependant_orig), &(args_info->dependant_given), &(local_args_info.dependant_given), optarg, 0, 0, ARG_INT, check_ambiguity, override, 0, 0, "dependant", 'D', additional_error)) goto failure; break; case 0: /* Long option with no short option */ if (strcmp (long_options[option_index].name, "detailed-help") == 0) { cmdline_parser_print_detailed_help (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); } if (strcmp (long_options[option_index].name, "full-help") == 0) { cmdline_parser_print_full_help (); cmdline_parser_free (&local_args_info); exit (EXIT_SUCCESS); } /* A flag option. */ if (strcmp (long_options[option_index].name, "flag-opt") == 0) { if (update_arg((void *)&(args_info->flag_opt_flag), 0, &(args_info->flag_opt_given), &(local_args_info.flag_opt_given), optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, "flag-opt", '-', additional_error)) goto failure; } /* A long option. */ else if (strcmp (long_options[option_index].name, "long-opt") == 0) { if (update_arg( (void *)&(args_info->long_opt_arg), &(args_info->long_opt_orig), &(args_info->long_opt_given), &(local_args_info.long_opt_given), optarg, 0, 0, ARG_LONG, check_ambiguity, override, 0, 0, "long-opt", '-', additional_error)) goto failure; } /* A string option with default. */ else if (strcmp (long_options[option_index].name, "def-opt") == 0) { if (update_arg( (void *)&(args_info->def_opt_arg), &(args_info->def_opt_orig), &(args_info->def_opt_given), &(local_args_info.def_opt_given), optarg, 0, "Hello", ARG_STRING, check_ambiguity, override, 0, 0, "def-opt", '-', additional_error)) goto failure; } /* A string option with list of values. */ else if (strcmp (long_options[option_index].name, "enum-opt") == 0) { if (update_arg( (void *)&(args_info->enum_opt_arg), &(args_info->enum_opt_orig), &(args_info->enum_opt_given), &(local_args_info.enum_opt_given), optarg, cmdline_parser_enum_opt_values, "hello", ARG_STRING, check_ambiguity, override, 0, 0, "enum-opt", '-', additional_error)) goto failure; } break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (check_required) { error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error); } cmdline_parser_release (&local_args_info); if ( error_occurred ) return (EXIT_FAILURE); if (optind < argc) { int i = 0 ; int found_prog_name = 0; /* whether program name, i.e., argv[0], is in the remaining args (this may happen with some implementations of getopt, but surely not with the one included by gengetopt) */ i = optind; while (i < argc) if (argv[i++] == argv[0]) { found_prog_name = 1; break; } i = 0; args_info->inputs_num = argc - optind - found_prog_name; args_info->inputs = (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; while (optind < argc) if (argv[optind++] != argv[0]) args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; } return 0; failure: cmdline_parser_release (&local_args_info); return (EXIT_FAILURE); } gengetopt-2.22.6/doc/sample1.output.texinfo0000664000175000017500000000337212046536672015606 00000000000000This one is from a C++ program Try to launch me with some options (type sample1 --help for the complete list) For example: ./sample1 *.* --funct-opt sample1 2.0 Usage: sample1 -iINT|--int-opt=INT [-h|--help] [--detailed-help] [--full-help] [-V|--version] [-sfilename|--str-opt=filename] [-mINT|--my-opt=INT] [--flag-opt] [-F|--funct-opt] [--long-opt=LONG] [--def-opt=STRING] [--enum-opt=STRING] [-DINT|--dependant=INT] [FILES]... -h, --help Print help and exit --detailed-help Print help, including all details and hidden options, and exit --full-help Print help, including hidden options, and exit -V, --version Print version and exit -s, --str-opt=filename A string option, for a filename A brief text description before the other options. -m, --my-opt=INT Another integer option, this time the description of the option should be "quite" long to require wrapping... possibly more than one wrapping :-) especially if I require a line break -i, --int-opt=INT A int option (mandatory) more involved options: the following options are more complex --flag-opt A flag option (default=off) -F, --funct-opt A function option last option section: --long-opt=LONG A long option --def-opt=STRING A string option with default (default=`Hello') --enum-opt=STRING A string option with list of values (possible values="foo", "bar", "hello", "bye" default=`hello') -D, --dependant=INT option that depends on str-opt An ending text. gengetopt-2.22.6/doc/gengetopt.texinfo0000664000175000017500000026027412045003074014667 00000000000000\input texinfo.tex @c -*-texinfo-*-* @c Copyright (C) 2001-2011 Free Software Foundation, Inc. @c @c This file is part of GNU gengetopt @c @c GNU gengetopt is free software; you can redistribute it and/or modify @c it under the terms of the GNU General Public License as published by @c the Free Software Foundation; either version 3, or (at your option) @c any later version. @c @c GNU gengetopt is distributed in the hope that it will be useful, but @c WITHOUT ANY WARRANTY; without even the implied warranty of @c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General @c Public License for more details. @c @c You should have received a copy of the GNU General Public License along @c with gengetopt; see the file COPYING. If not, see http://www.gnu.org/license @c %**start of header @setfilename gengetopt.info @include version.texi @settitle GNU Gengetopt @value{VERSION} @finalout @c @setchapternewpage odd @c %**end of header @set myhomepage @uref{http://www.lorenzobettini.it} @copying This manual is for GNU Gengetopt (version @value{VERSION}, @value{UPDATED}), a tool to write command line option parsers for C programs. Copyright @copyright{} 2001 - 2011 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled ``GNU Free Documentation License.'' (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.'' @end quotation @end copying @dircategory GNU programming tools @direntry * Gengetopt: (gengetopt). Create command line options parsers @end direntry @titlepage @title GNU Gengetopt @subtitle A command line option parser generator @subtitle for GNU Gengetopt version @value{VERSION} @subtitle updated on @value{UPDATED-MONTH} @author Lorenzo Bettini @page @vskip 0pt plus 1filll @insertcopying @end titlepage @contents @ifnottex @node Top, Audience, (dir), (dir) @top Gengetopt Gengetopt is a tool to write command line option parsing code for C programs. This is Edition @value{EDITION} of the Gengetopt manual. This file documents GNU Gengetopt version @value{VERSION}. @insertcopying @end ifnottex @c All the nodes can be updated using the EMACS command @c texinfo-every-node-update, which is normally bound to C-c C-u C-e. @c @node Top, Introduction, (dir), (dir) @c All the menus can be updated with the EMACS command @c texinfo-all-menus-update, which is normally bound to C-c C-u C-a. @menu * Audience:: What is gengetopt and who it is for. * Copying:: Your rights. * Installation:: Download and Installation * Basic Usage:: How to run Gengetopt; syntax of .ggo files * Invoking gengetopt:: gengetopt command line options * Terminology:: Definitions of options, values, and so forth. * Options with enumerated values:: Options accepting only a list of values * Group options:: Groups of mutually exclusive options * Mode options:: Mutually exclusive group of options * Parser function additional parameters:: * Configuration files:: Parsing a configuration file * Multiple Options:: Multiple options * String Parsers and Multiple Parsers:: Using multiple parsers in the same program * No getopt_long:: What if getopt_long is not available? * Bugs:: What is lame and/or buggy in Gengetopt @value{VERSION} * Mailing Lists:: For discussions and announces * Index:: Index. @end menu @node Audience, Copying, Top, Top @unnumbered Audience @cindex Audience @cindex Who should use Gengetopt Gengetopt is a tool to generate C code to parse the command line arguments @code{argc} and @code{argv} that are part of every C or C++ program. The generated code uses the C library function @code{getopt_long} to perform the actual command line parsing. This manual is written for C and C++ programmers, specifically the @emph{lazy} ones. If you've written any non-trivial C program, you've had to deal with argument parsing. It isn't particularly difficult, nor is it particularly exciting. It @emph{is} one of the classic programming nuisances, which is why most books on programming leave it as an exercise for the reader. Gengetopt can save you from this work, leaving you free to focus on the interesting parts of your program. Thus your program will be able to handle command line options such as: @example myprog --input foo.c -o foo.o --no-tabs -i 100 *.class @end example And both long options (those that start with @code{--}) and short options (start with @code{-} and consist of only one character) can be handled (see @ref{Terminology} for further details). For standards about short and long options you may want to take a look at the GNU Coding Standards (@uref{http://www.gnu.org/prep/standards_toc.html}). Gengetopt can also generate a function to save the command line options into a file (see @ref{Basic Usage}), and a function to read the command line options from a file (see @ref{Configuration files}). Of course, these two kinds of files are compliant. Generated code works also if you use GNU Autoconf and GNU Automake and it is documented with Doxygen comments. In particular, @cindex PACKAGE @code{PACKAGE}, @cindex PACKAGE_NAME @code{PACKAGE_NAME} and @cindex VERSION @code{VERSION} are used in the generated code to print information. @node Copying, Installation, Audience, Top @unnumbered Gengetopt Copying Conditions @cindex Copying conditions @cindex Conditions for copying Gengetopt Gengetopt is free software; you are free to use, share and modify it under the terms of the GNU General Public License that accompanies this manual. The code that Gengetopt generates is also free software; however it is licensed with a simple all-permissive license instead of the GPL or LGPL. You are free to do anything you like with the generated code, including incorporating it into or linking it with proprietary software. Gengetopt was originally written by Roberto Arturo Tena Sanchez. It is currently maintained by Lorenzo Bettini @value{myhomepage}. A primordial version of @ref{Terminology} was written by Adam Greenblatt. @node Installation, Basic Usage, Copying, Top @chapter Installation @cindex installation @cindex download See the file @file{INSTALL} for detailed building and installation instructions; anyway if you're used to compiling Linux software that comes with sources you may simply follow the usual procedure, i.e. untar the file you downloaded in a directory and then: @example cd ./configure make make install @end example Note: unless you specify a different install directory by @code{--prefix} option of configure (e.g. @code{./configure --prefix=}), you must be root to run @code{make install}. Files will be installed in the following directories: @table @code @item executables @code{/prefix/bin} @item docs @code{/prefix/share/doc/gengetopt} @item examples @code{/prefix/share/doc/gengetopt/examples} @item additional files @code{/prefix/share/gengetopt} @end table Default value for prefix is @code{/usr/local} but you may change it with @code{--prefix} option to configure. @section Download @cindex download You can download it from GNU's ftp site: @uref{ftp://ftp.gnu.org/gnu/gengetopt} or from one of its mirrors (see @uref{http://www.gnu.org/prep/ftp.html}). I do not distribute Windows binaries anymore; since, they can be easily built by using Cygnus C/C++ compiler, available at @uref{http://www.cygwin.com}. However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail (find my e-mail at my home page) and I can send them to you. Archives are digitally signed by me (Lorenzo Bettini) with GNU gpg (@uref{http://www.gnupg.org}). My GPG public key can be found at my home page (@value{myhomepage}). You can also get the patches, if they are available for a particular release (see below for patching from a previous version). @section Anonymous Git Checkout @cindex Git This project's git repository can be checked out through the following clone instruction@footnote{Since version 2.22.4 of Gengetopt the CVS repository was dismissed in favor of Git (@uref{http://git-scm.com/}).}: @example git clone git://git.savannah.gnu.org/gengetopt.git @end example Further instructions can be found at the address: @uref{http://savannah.gnu.org/projects/gengetopt}. And the git repository can also browsed on-line at @uref{http://git.savannah.gnu.org/cgit/gengetopt.git}. Please note that this way you will get the latest development sources of Gengetopt, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources. If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the tag @code{rel_X_Y_Z}. When you compile the sources that you get from the git repository, before running the @code{configure} and @code{make} commands, for the first time, you must run the command: @example autoreconf -i @end example @noindent This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of @cindex automake @cindex autoconf @cindex libtool @code{automake}, @code{autoconf} and @code{libtool} in order for this to succeed. @section What you need to build gengetopt @cindex requirements Gengetopt has been developed under GNU/Linux, using gcc (C++), and bison (yacc) and flex (lex), and ported under Win32 with Cygnus C/C++compiler, available at @uref{http://www.cygwin.com}. For developing gengetopt, I use the excellent @cindex automake @cindex autoconf @cindex libtool GNU Autoconf@footnote{@uref{http://www.gnu.org/software/autoconf}}, GNU Automake@footnote{@uref{http://www.gnu.org/software/automake}} and GNU Libtool@footnote{@uref{http://www.gnu.org/software/libtool}}. @cindex gnulib Since version 2.19 I also started to use Gnulib - The GNU Portability Library@footnote{@uref{http://www.gnu.org/software/gnulib}}, ``a central location for common GNU code, intended to be shared among GNU packages'' (for instance, I rely on Gnulib for checking for the presence and correctness of @code{getopt_long} function, @ref{Use Gnulib}). Moreover @emph{GNU Gengen} (@uref{http://www.gnu.org/software/gengen}) is used for automatically generating the code that generates the command line parser. Actually, you don't need all these tools above to build gengetopt because I provide generated sources, unless you want to develop gengetopt. The code generated by gengetopt relies on the @code{getopt_long} function that is usually in the standard C library; however, there may be some implementations of the C library that don't include it; we refer to @ref{No getopt_long}, for instructions on how to check whether getopt_long is part of the library and how to deal with their lacking (using autoconf and automake). @section Patching from a previous version @cindex patching If you downloaded a patch, say @file{gengetopt-1.3-1.3.1-patch.gz} (i.e., the patch to go from version 1.3 to version 1.3.1), cd to the directory with sources from the previous version (gengetopt-1.3) and type: @example gunzip -cd ../gengetopt-1.3-1.3.1.patch.gz | patch -p1 @end example and restart the compilation process (if you had already run configure a simple make should do). @node Basic Usage, Invoking gengetopt, Installation, Top @chapter Basic Usage @cindex how to use Gengetopt @cindex getting started with Gengetopt @cindex tutorial The command line options, which have to be handled by gengetopt generated function, are specified in a file (typically with @file{.ggo} extension). This file consists of sentences with the formats shown below (these sentences are allowed to span more than one line). Statements in @{@} are optional (the @code{option} sentences need not to be given in separate lines): @example package "" version "" purpose "" usage "" description "" versiontext "" args "" option "" @{details=""@} @{argtype@} @{typestr=""@} @{values="","",...@} @{default=""@} @{dependon=""@} @{required@} @{argoptional@} @{multiple@} @{hidden@} option "" flag section "section name" @{sectiondesc="optional section description"@} text "a textual sentence" @end example @noindent Where: @table @code @item package @cindex package @cindex PACKAGE @cindex PACKAGE_NAME This has the precedence over @code{PACKAGE} and @code{PACKAGE_NAME} generated by autoconf. This is required, unless you use autoconf. If @code{package} is specified, then it will be used to print the program name in the output of @code{--help} and @code{--version}, and also when printing errors (from within the generated parser). If it is not specified, then @code{PACKAGE} will be used when printing errors, and @code{PACKAGE_NAME} in the output of @code{--help} and @code{--version}. Note that if @code{PACKAGE_NAME} is empty, then @code{PACKAGE} will be used also in this case. @item version @cindex version @cindex VERSION This has the precedence over @code{VERSION} generated by autoconf. This is required, unless you use autoconf. @item purpose @cindex purpose What the program does (even on more than one line), it will be printed with the help, before the usage string. Optional. @item usage @cindex usage The ``Usage'' string that will be printed with the help@footnote{Since version 2.19.}. If not specified, it will be generated automatically. Optional. @item description @cindex description The ``Description'' string that will be printed with the help@footnote{Since version 2.19.}, after the usage string. Optional. @item versiontext @cindex versiontext Additional information that will be printed after the program name and version in the output of @code{--version}. This would be used, for example, to display copyright and licensing information. @item args @cindex args With @code{args}@footnote{Since version 2.18} you can specify options that will be added to the command line options of gengetopt itself. For instance, if you always run gengetopt on your input file with the options @code{--no-handle-error --string-parser -u}, you can add these options in the input file like this: @example args "--no-handle-error --string-parser -u" @end example @noindent and remove those recurrent options from the command line. Optional. @item long @cindex long The long option, a double quoted string with upper and lower case characters, digits, a dash (@code{-}) and a dot (@code{.}). No spaces allowed. The name of the variables generated to store arguments (see later in this section) are long options converted to be legal C variable names. This means that @code{.} and @code{-} are both replaced by @code{_}. @cindex short @item short The short option, a single upper or lower case char, or a digit. If a @code{-} is specified, then no short option is considered for the long option (thus long options with no associated short options are allowed). Since version 2.22 you can also specify @code{?} as the short option. @cindex desc @item desc @cindex wrapping This description will be printed during the output of @code{--help}. Wrapping will be automatically performed. @item details @cindex details @cindex @code{--detailed-help} This is an extended description string for the option that will be printed (after the option) during the output of @code{--detailed-help}@footnote{Since version 2.22.}, which will be automatically generated. Thus, these further details will NOT be printed with @code{--help}. Wrapping will be automatically performed. Optional. Note that if @code{--strict-hidden} is used, options that are hidden (@xref{hidden,,Hidden options}.) will not appear in the output of @code{--detailed-help}, even if those options have details. @cindex argtype @item argtype @code{string}, @code{int}, @code{short}, @code{long}, @code{float}, @code{double}, @code{longdouble} or @code{longlong}. If the option is an enumerated one (see @ref{Options with enumerated values}) the type can also be @code{enum}. If no type is specified the option does not accept an argument. @cindex typestr @item typestr a description for the type of the values for the option. This will be used during the output of @code{--help} (e.g., @code{"filename"} instead of simply @code{STRING}, or @code{"portnumber"} instead of simply @code{INT}). @cindex values @item values a list of strings containing all the possible values that can be passed to the option. If not specified, the type is considered string@footnote{Since version 2.22 the type can be specified}. For this kind of options, the type can also be @code{enum}. More on this feature can be found in @ref{Options with enumerated values}. @cindex default @item default an optional default value for the option. The value must always be specified as a double quoted string. It is possible to combine this with the @code{multiple} flag (@ref{Multiple Options}) but only by giving a single default value. It is not possible to specify a list of default values. @cindex dependon @item dependon this option depends on another option (whose long name description is specified). If this option is given at command line but not the option it depends on, an error will be generated. @cindex required @cindex optional @cindex @code{--default-optional} @item required @code{required} or @code{optional}. This specifies whether such option must be given at each program invocation. These keywords were introduced in release 2.17. Before, you had to use the keywords @code{yes} or @code{no}. You can still use these keywords but their use is not advised since they are not much explicative. If not specified, an option is considered mandatory; if you do not want this behavior, you can require that by default options are considered optional, by using the command line option @code{--default-optional}@footnote{Since version 2.20.}. @cindex argoptional @item argoptional If this flag is specified then this option has an argument that is optional. In this case, when you specify the argument at command line, please use @code{=} in case you use a long option, and avoid spaces if you use short option. For instance, if the option with optional argument is @code{-B|--bar}, use the following command line syntax: @code{-B15} or @code{--bar=15}, and NOT the following one @code{-B 15} nor @code{--bar 15}. By using this specification together with @code{default} you can obtain an option that even if not explicitly specified will have the default value, and if it is specified without an argument it will have, again, the default value. @cindex multiple @item multiple If this flag is specified then this option can be specified more than once at command line; all the values for this option are stored in an array. You can also specify the number of occurrences that a multiple option must be specified. Notice that this is independent from the @code{required} flag. See @ref{Multiple Options}. @cindex hidden @cindex details @cindex @code{--full-help} @cindex @code{--detailed-help} @item hidden @anchor{hidden} @anchor{fullhelp} If an option is ``hidden'' it will not appear in the output of @code{--help} but it can still be specified at command line@footnote{Since version 2.15.}. When hidden options are used, the command line option @code{--full-help} will also be generated. This will also print hidden options@footnote{Since version 2.16.}. Hidden options are also displayed in the output of @code{--detailed-help}, if it is present, along with any details that those options have. Note that when @code{--strict-hidden} is used, hidden options do not appear as described above, although they can still be given on the comand line. That is to say, the @code{--full-help} option is not generated, and hidden options do not appear in the output of @code{--detailed-help}, even if they have details. @cindex on/off @item on/off @code{on} or @code{off}. This is the state of the flag when the program starts. If user specifies the option, the flag toggles. @end table For strings (delimited by @code{"}) the following convention is adopted@footnote{This is true since version 2.19. Before this version, strings were not allowed to spawn more than one line.}: a string spanning more than one line will be interpreted with the corresponding line breaks; if the line break is not desired one can use the backslash @code{\} to break the line without inserting a line break. A line break in a string can also be inserted with the string @code{\n}. Here are some examples: @example "This string will be interpreted into two lines exactly as it is" "This string is specified with two lines \ but interpreted as specified in only one line \ i.e., without explicit line break" "This string\nwill have a line break" @end example @noindent Moreover, if the character @code{"} must be specified in the string, it will have to be escaped with the backslash@footnote{Since version 2.19.}: @example "This string contains \"a quoted string\" inside" @end example The part that must be provided in the correct order is @example option "" @end example @noindent while the other specifications can be given in any order@footnote{This holds since version 2.15: in previous versions the option specifications had to be given in a fixed order.}. Thus, for instance @example option "" @{argtype@} @{typestr=""@} @end example @noindent is the same as @example option "" @{typestr=""@} @{argtype@} @end example Comments begin with @code{#} in any place (but in strings) of the line and ends in the end of line. @cindex @code{-h,--help} @cindex @code{-V,--version} @anchor{addedoptions} Notice that the options @code{-h,--help} and @code{-V,--version} are added automatically; however, if you specify an option yourself that has @code{h} as short form, then only @code{--help} is added@footnote{Before version 2.22 neither @code{--help} was added and you had to handle the help option manually}. The same holds for @code{-V,--version}. @cindex @code{--full-help} In case hidden options are used, @xref{hidden,,Hidden options}, the command line option @code{--full-help} will also be generated. This will print also the hidden options@footnote{Since version 2.16.}. Note, though, that when @code{--strict-hidden} is used, this is not the case and @code{--full-help} is not generated. @cindex @code{--detailed-help} If there's at least one option with @code{details}, the command line option @code{--detailed-help} will also be generated. This will print also the details for options and hidden options@footnote{Since version 2.22.} (except when @code{--strict-hidden} is used). @cindex section Options can be part of sections, that provide a more meaningful descriptions of the options. A @emph{section} can be defined with the following syntax (the @code{sectiondesc} is optional) and all the options following a section declaration are considered part of that sections: @example section "section name" @{sectiondesc="optional section description"@} @end example @noindent Notice that the separation in sections is stronger than separation in groups of mutually exclusive options (see @ref{Group options}). Furthermore, sections should not be inserted among group options (but only externally). A section makes sense only if it is followed by some options. If you don't specify any option after a section, that section will not be printed at all. If you need to simply insert some text in the output of @code{--help}, then you must use @code{text}, explained in the next paragraph. @cindex text You can insert, among options, a textual string that will be printed in the output of @code{--help}@footnote{Since version 2.18.}: @example text "\nA text description with possible line\nbreaks" @end example @noindent Of course, you can use this mechanism even to manually insert blank lines among options with an empty text string: @example text "" @end example You can also specify the list of @code{values} that can be passed to an option (if the type is not specified, the option has type @code{string}). More on this feature can be found in @ref{Options with enumerated values}. If a value that is not in the list is passed, an error is raised. You can think of such options as @emph{enumerated} options. It is not necessary to pass the complete value at the command line option: a non ambiguous prefix will do. For instance, if the accepted values are @code{"foo","bar","foobar"}, then you can pass at the command line the value @code{"b"} and the value @code{"bar"} will be selected, or the value @code{"foob"} and the value @code{"foobar"} will be selected; instead, passing the value @code{"fo"} will raise an ambiguity error. Here's an example of such a file (the file is called @file{sample1.ggo}) @include sample1.ggo.texinfo The simplest way to use gengetopt is to pass this file as the standard input, i.e.: @example gengetopt < sample1.ggo @end example By default gengetopt generates @file{cmdline.h} and @file{cmdline.c}. Otherwise we can specify these names with a command line option: @example gengetopt < sample1.ggo --file-name=cmdline1 --unamed-opts @end example @cindex parameter @cindex option without name The option @code{--unamed-opts} allows the generated command line parser to accept also names, without an option (for instance you can pass a file name without an option in front of it, and also use wildcards, such as @code{*.c}, @code{foo*.?} and so on). These are also called @emph{parameters} (see @ref{Terminology}). You can specify an optional description for these additional names (default is @code{FILES}). In @file{cmdline1.h} you'll find the generated C struct: @include cmdline1.h.texinfo @cindex argv First of all, notice that the @code{argv} parameter (typically corresponding to the homonimous argument of your program's @code{main} function) is declared as @code{char **} and not as @code{char *const *}@footnote{as it was up to version 2.22.2 of gengetopt.}. Actually, the version of @code{getopt_long} in libc uses prototypes with @code{char *const *argv} that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1)@footnote{This is taken from the comments in @file{getopt.in.h} of gnulib.}. So, it is better to declare @code{argv} as @code{char **} in the generated parser functions. The @code{