php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57015 syntax error in configure
Submitted: 2006-05-15 15:24 UTC Modified: 2007-10-17 16:18 UTC
From: duck at obala dot net Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 5.0.5 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2006-05-15 15:24 UTC] duck at obala dot net
Description:
------------
zlib detection fails on pecl or manual install
in verison 2.0.3

Reproduce code:
---------------
/tmp/tmp5W9yT9/memcache-2.0.3/configure: line 1376: syntax error near unexpected token `elif'
'tmp/tmp5W9yT9/memcache-2.0.3/configure: line 1376: `    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-15 15:36 UTC] mikael at synd dot info
What operating system and more specifically what shell version are you using?

//Mikael
 [2006-05-15 15:50 UTC] duck at obala dot net
tried on:
GNU bash, version 3.1.5(1)-release (i686-pc-linux-gnu)
GNU bash, version 3.1.17(1)-release (i686-pc-linux-gnu)
 [2006-05-16 05:52 UTC] mikael at synd dot info
Haven't been able to reproduce this problem on either

 GNU bash, version 3.00.15(1)-release(x86_64-redhat-linux-gnu)
 GNU bash, version 3.1.7(2)-release (i586-mandriva-linux-gnu)

With PHP 5.0.5 or 4.4.1

Would you mind checking what "/bin/sh --version", "aclocal --version" and "autoconf --version" outputs and attach an excerpt from your generated configure script around line 1376 where the error occur.

Also; please check where your zlib installation resides (for example using "locate zlib.h", most likely it's in /usr/include/zlib.h or something similar)

//Mikael
 [2006-05-16 06:04 UTC] duck at obala dot net
zlib path: 
/usr/include/zlib.h

versions:
GNU bash, version 3.1.17(1)-release (i686-pc-linux-gnu)
aclocal (GNU automake) 1.9.6
autoconf (GNU Autoconf) 2.59

code:
  if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
    if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
        else
      { echo "configure: error: Can't find ZLIB headers under "$PHP_ZLIB_DIR"" 1>&2; exit 1; }
    fi
  else
    for i in /usr/local /usr; do
      if test -f "$i/include/zlib/zlib.h"; then
        PHP_ZLIB_DIR="$i"
        PHP_ZLIB_INCDIR="$i/include/zlib"
      elif test -f "$i/include/zlib.h"; then
        PHP_ZLIB_DIR="$i"
        PHP_ZLIB_INCDIR="$i/include"
      fi
    done
  fi
 [2006-05-16 22:18 UTC] cccooogm at gmail dot com
this syntax error appeared on redhat 8.0 too
memcache verison 2.0.4

Reproduce code:
---------------
checking for gawk... gawk
: command not found
checking whether to enable memcache support... yes, shared
: command not found
: command not found
./configure: line 1376: syntax error near unexpected token `elif'
'/configure: line 1376: `    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
 [2006-05-17 02:37 UTC] tony2001 at phpclub dot net
I cannot reproduce it neither on Redhat nor on Suse.
There is absolutely nothing special and there are tons of "elif" in other .m4 files all around PHP sources, so I honestly do not see a reason for such code to fail except for your misconfiguration.

Please create a shell script like this:
#!/bin/sh

    if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
    fi

And try to execute it.
 [2006-05-24 07:03 UTC] sh at tix dot no
I'm experiencing the same problem om Debian Sarge.

Output is:
checking for gawk... gawk
: command not foundache-2.0.4/configure: line 2528:
checking whether to enable memcache support... yes, shared
: command not foundache-2.0.4/configure: line 2577:
: command not foundache-2.0.4/configure: line 2578:
/tmp/tmpTTJ1L4/memcache-2.0.4/configure: line 2612: syntax error near unexpected token `elif'
/tmp/tmpTTJ1L4/memcache-2.0.4/configure: line 2612: `    elif test -f "$PHP_ZLIB_DIR/include/zlib.h'; then
ERROR: `/tmp/tmpTTJ1L4/memcache-2.0.4/configure' failed
 [2006-06-23 19:28 UTC] alisterb+pecl at gmail dot com
Running dos2unix, to remove ^M characters from the config.m4 files allows a good ./configure

 tar xzf memcache-2.0.4.tgz && cd memcache-2.0.4 && dos2unix *m4 && phpize && ./configure
 [2006-08-31 20:20 UTC] evert at collab dot nl
Wow that was strange..

I had the same problem.. I'm running multiple boxes, all with Debian Sarge, all very up to date and 2 of them had no problem running ./configure

The last one however, did.. Couldn't convert at all.. only after removing the windows linebreaks it did

How can this be? The boxes are using the exact same packages and are nearly identical.
 [2007-10-17 16:18 UTC] mikael at synd dot info
This was a problem with ^M chars in the config.m4 file, closing bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC