110

I am trying to setup my machine with pecl_http and memcache and in both cases, I get similar errors. This is on MAC OS X 10.7.3 (lion) and I also have XCODE installed on it. I also installed Zend Server community edition before running these commands and have CFLAGS='-arch i386 -arch x86_64' environment variables set. So please help with what I need to do

bash-3.2# **sudo pecl install pecl_http-1.7.1**
downloading pecl_http-1.7.1.tgz ...
Starting to download pecl_http-1.7.1.tgz (174,098 bytes)
.....................................done: 174,098 bytes
71 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
Ares
  • 5,905
  • 3
  • 35
  • 51
krishna
  • 3,547
  • 5
  • 27
  • 29
  • 4
    did you try `export PHP_AUTOCONF=/usr/bin/autoconf` before running the command? Of course assuming `$PHP_AUTOCONF` is supposed to be a localtion for the autoconf binary it should have been found, but maybe it just needs a little help :-) – prodigitalson Feb 17 '12 at 04:08
  • @prodigitalson there is no /usr/bin/autoconf in that path. You think that could be the reason why?. How do I install autoconf then ? thanks. – krishna Feb 17 '12 at 04:22
  • 1
    Yeah youll need autoconf then. Thats, wierd I have it on both my 10.7 and my 10.6 box. Youll have to download and build it manually i think. Or you could jsut take the easy way out and use Macports, Homebrew, or Fink. – prodigitalson Feb 17 '12 at 05:09
  • I have tried getting homebrew and ports but still didn't help. Then I tried downgrading from XCODE 4.3 TO 4.2.1 and everything works great from then on. No errors anymore :). I updated my answer – krishna Feb 17 '12 at 20:33
  • 1
    I upgraded XCode and I had the same issue till I added /Developer/usr/bin/ to $PATH. – Eduardo Romero Jul 01 '13 at 17:13
  • Since this is tagged autoconf, it really deserves a remark that this installation process is completely opposed to the philosophy and indeed the point of autoconf. Any installation process that requires the installer to run autoconf is completely broken. The whole point of autoconf is to allow the developer to create a tarball that can be used to build the project *without* needing to have autoconf on the target system. It saddens me that this has become so commonplace. If you require your user to install autoconf, your distribution is broken! – William Pursell Jan 07 '16 at 17:24

6 Answers6

319
brew install autoconf

Much easier solution

Bob Spryn
  • 17,742
  • 12
  • 68
  • 91
  • 2
    'sudo brew install autoconf' otherwise won't be linked because you have no permissions and this can look like it's not working. – Mc- Oct 09 '12 at 08:31
  • 25
    You aren't supposed to sudo brew install anything. In fact I think it fails these days. – Bob Spryn Oct 09 '12 at 17:08
  • If you don't have installed brew you can do it from here http://brew.sh/index_es.html – Ricardo Mar 23 '14 at 17:31
  • I also had the same problem as @krishna. I did it like you said, suing brew and I also created a variable `export PHP_AUTOCONF=/usr/bin/autoconf` to be sure and it worked fine. Just edited the `php.ini` adding a `extension=apcu.so` on the end. – Joabe da Luz Jul 22 '15 at 16:46
  • then "brew link autoconf" to make it available to the os and phpize. – txyoji Jul 30 '15 at 15:03
  • It works but need to get ownership of /usr/local/Cellar first: http://stackoverflow.com/questions/4804169/installing-in-homebrew-errors – Jennie Ji Aug 26 '15 at 03:34
  • for using BREW on mac, run this : `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ` – William Rossier Dec 05 '16 at 11:33
  • Working on 10.12.5 – James Marino Jul 24 '17 at 07:16
  • Nowadays, Homebrew installs to `usr/local/bin` rather than `usr/bin`, so you may need to export the `$PHP_AUTOCONF` environment variable to this newer directory: `export PHP_AUTOCONF=/usr/local/bin/autoconf` rather than the one mentioned by @JoabMendes. To confirm which one you need, just run `which autoconf` after installing it. – Jamie Birch Feb 22 '18 at 15:25
93

You need to install autoconfig. I usually like to install libraries from source. So you can do the following:

curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install

I just went through this with Mountain Lion.

Ares
  • 5,905
  • 3
  • 35
  • 51
  • 3
    For those dopes - LIKE ME! - who are new to Mac-World - make sure you do the above in the /usr/bin/ folder. – Bill Ortell Nov 19 '12 at 16:15
  • 6
    This does NOT have to be made inside the /usr/bin folder. If you understand the commands given you will notice that you are downloading some files (curl), decompressing them (tar) configuring the installation to your machine needs (./configure), compiling it (make) and installing the library (make install). The installation should take care copying files wherever they need to be. However, it is very important that you "sudo" the last command so you get the permissions you need to copy those files. – Ares Nov 20 '12 at 16:18
  • Valid points Ares, I'm not sure tho - as I was already logged-in via Terminal as 'su'... and its till wasn't able do find the files as it built the folder in root which is where I was at the time (as i too would typ. think the same - when copying files, etc..) (i'm SURE i did something wrong - just don't know what it was... but moving to /usr/bin/ and then doing the SAME - made all the diff.) – Bill Ortell Nov 25 '12 at 03:35
  • Great snippet Ares! If you want to always use the latest build try these modifications - Change any reference to `autoconf-2.68...` to just `autoconf-*` – Kevin M Dec 12 '12 at 22:01
  • 2
    @Kevin, So, using the wildcard will automatically select the "higher" version? I've learned something today! – Ares Dec 19 '12 at 18:06
  • @Ares, I forgot to mention the curl url will have to point to the latest build `http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz`. Using the wildcard in the commands is similar to hitting the tab key for autocomplete. With the * the script will autocomplete the tar -latest.tar.gz . Then autocomplete to cd in to the -2.69 (or whatever the current number is). – Kevin M Dec 20 '12 at 16:04
  • I am getting this GNU M4 1.4.6 or later is required; 1.4.14 is recommended? – pal4life Dec 26 '12 at 20:57
  • @KevinM I have updated the answer to reflect your comment. Thanks. – Ares Dec 28 '12 at 20:29
  • 1
    @Ares Link to the tar file is dead. – Seth Jan 24 '14 at 21:28
  • @KristenWaiteJukowski This should work regardless of the OS version. :) – Ares Sep 23 '15 at 13:27
  • 1
    I spent longer than i'd care to admit on figuring this out. You saved the day. This works on 10.12.x too – TheValyreanGroup May 24 '17 at 00:28
  • I'm getting the following error: `curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz` `curl: (7) Failed to connect to mirror.rasanegar.com port 80: Operation timed out` – Jaideep Ghosh Sep 18 '18 at 06:16
55

On Mac OS X 10.8 situation is slightly different. Highly voted solution from Bob Spryn doesn't work, because it doesn't create symlinks, so after installing autoconf you should make them:

sudo ln -s /usr/local/Cellar/autoconf/2.69/bin/autoconf /usr/bin/autoconf
sudo ln -s /usr/local/Cellar/autoconf/2.69/bin/autoheader /usr/bin/autoheader

I know that this question was for 10.7, but I hope my answer is useful for someone on 10.8. :)

Updated: Also works on 10.10 Yosemite.

Anton Babenko
  • 6,586
  • 2
  • 36
  • 44
15

or

sudo port install autoconf

if you use macports

stoefln
  • 14,498
  • 18
  • 79
  • 138
4

XCODE 4.3 doesn't put all the autoconf etc. tools in the Developer folder. It doesn't even create that folder in MACINTOSH HD. I had to downgrade to XCODE 4.2.1 which installs everything you need in the Developer folder and now I see no errors.

Also here is a useful reference.

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
krishna
  • 3,547
  • 5
  • 27
  • 29
0

maybe you need link autoconf with brew link autoconf.

Jichao
  • 40,341
  • 47
  • 125
  • 198