diff --git a/configure.ac b/configure.ac index 18593de..a5fd1ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,22 @@ AC_PREREQ([2.68]) -AC_INIT([pkgconf], [0.8], [http://github.com/nenolod/pkgconf/issues]) +AC_INIT([pkgconf], [0.8.1], [http://github.com/nenolod/pkgconf/issues]) AC_CONFIG_SRCDIR([pkg.c]) AC_CONFIG_HEADERS([config.h]) AC_CHECK_FUNCS([strlcpy strlcat strndup]) +AC_ARG_ENABLE([strict], + [AC_HELP_STRING([--enable-strict], + [enable POSIX-strict argument checking and disable some workarounds])], + [ac_cv_use_strict=$enableval], [ac_cv_use_strict=no]) +AC_CACHE_CHECK([whether to enable strict mode], + [ac_cv_use_strict], [ac_cv_use_strict=no]) + +if test "x$ac_cv_use_strict" = "xyes"; then + AC_DEFINE([HAVE_STRICT_MODE], [1], [Define if strict mode is requested.]) +else + AC_DEFINE([HAVE_STRICT_MODE], [0], [Define if strict mode is requested.]) +fi + AC_PROG_CPP AC_PROG_CC AC_PROG_INSTALL diff --git a/getopt_long.c b/getopt_long.c index d1a4c93..4e1cf2c 100644 --- a/getopt_long.c +++ b/getopt_long.c @@ -68,7 +68,9 @@ #include #include -#define GNU_COMPATIBLE /* Be more compatible, configure's use us! */ +#if HAVE_STRICT_MODE > 0 +# define GNU_COMPATIBLE /* Be more compatible, configure's use us! */ +#endif int pkg_opterr = 1; /* if error message should be printed */ int pkg_optind = 1; /* index into parent argv vector */ @@ -378,6 +380,9 @@ getopt_internal(int nargc, char * const *nargv, const char *options, flags &= ~FLAG_PERMUTE; else if (*options == '-') flags |= FLAG_ALLARGS; +#endif +#if HAVE_STRICT_MODE >= 1 + flags &= ~FLAG_PERMUTE; #endif if (*options == '+' || *options == '-') options++; diff --git a/main.c b/main.c index 55957f1..c0b5ab7 100644 --- a/main.c +++ b/main.c @@ -407,7 +407,7 @@ out: static void version(void) { - printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION); + printf("%s %s%s\n", PACKAGE_NAME, PACKAGE_VERSION, HAVE_STRICT_MODE ? " [strict]" : " [pkg-config compatible]"); printf("Copyright (c) 2011 - 2012 William Pitcock .\n\n"); printf("Permission to use, copy, modify, and/or distribute this software for any\n"); printf("purpose with or without fee is hereby granted, provided that the above\n");