From: Hartmut Holzgraefe Date: Wed, 30 Oct 2002 15:11:11 +0000 (+0000) Subject: getopt with long options reverted to configure problems X-Git-Tag: php-4.3.0RC1~410 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8837750de3971fa3e5023fad02512140f3f2a76;p=php getopt with long options reverted to configure problems (may find the wrong getopt.h so needed structures are not defined :( ) --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 17b2f471c6..0e5a88fa11 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -73,7 +73,7 @@ # include #endif -#ifdef HAVE_GETOPT_H +#ifdef HARTMUT_0 #include #endif @@ -1373,7 +1373,7 @@ static void free_argv(char **argv, int argc) } /* }}} */ -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 /* {{{ free_longopts Free the memory allocated to an longopt array. */ static void free_longopts(struct option *longopts) @@ -1400,7 +1400,7 @@ PHP_FUNCTION(getopt) char *optname; int argc = 0, options_len = 0, o; zval *val, **args = NULL, *p_longopts = NULL; -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 struct option *longopts = NULL; int longindex = 0; #endif @@ -1451,7 +1451,7 @@ PHP_FUNCTION(getopt) } if(p_longopts) { -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 int len, c = zend_hash_num_elements(Z_ARRVAL_P(p_longopts)); struct option *p; zval **arg; @@ -1505,7 +1505,7 @@ PHP_FUNCTION(getopt) optind = 0; /* Invoke getopt(3) on the argument array. */ -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 while ((o = getopt_long(argc, argv, options, longopts, &longindex)) != -1) { #else while ((o = getopt(argc, argv, options)) != -1) { @@ -1517,7 +1517,7 @@ PHP_FUNCTION(getopt) /* Prepare the option character and the argument string. */ if(o == 0) { -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 optname = (char *)longopts[longindex].name; #endif } else { @@ -1546,7 +1546,7 @@ PHP_FUNCTION(getopt) } free_argv(argv, argc); -#ifdef HAVE_GETOPT_LONG +#ifdef HARTMUT_0 free_longopts(longopts); #endif } diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index b85ef6c7ee..9d4fc7b985 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -225,9 +225,13 @@ AC_ARG_WITH(regex, AC_FUNC_FNMATCH -AC_CHECK_HEADERS(getopt.h) +dnl getopt long options disabled for now +dnl as we can't be sure that we get the right getopt.h here +dnl using the standard AC_CHECK macros +dnl AC_CHECK_HEADERS(getopt.h) +dnl AC_CHECK_FUNCS(getopt_long getopt_long_only) -AC_CHECK_FUNCS(glob strfmon getopt_long getopt_long_only) +AC_CHECK_FUNCS(glob strfmon) if test "$PHP_SAPI" = "cgi"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])