Compiling Nginx on Solaris 10 - Configure:test:argument expected

Yesterday I was working on compiling nginx on one of our solaris boxes at work (someone please tell me why companies still choose Solaris over the various other unix or linux distros out there) and I ran into a problem. When I ran configure with any options, I saw the following error:

. / Configure: test: argument expected

And if you try to run make or gmake after that you get this error

Make: Fatal error: Command failed for target `objs / src / core / nginx.o

That’s no fun, huh? Well, I searched around for a while and found the solution here, which happened to be in Russian (Dear Google Translate).

Basically, the problem was that the version of sh that Solaris 10 defaults to is very old and not POSIX compliant (go figure). The solution is to change the configure script to use a different version of sh. At the top of your config file, change the following line from

#!/bin/sh

to

#!/usr/xpg4/bin/sh

Rerun your configure script with all of your switches and all should be well (yay!). Once you’ve done that, gmake/make should run without a hitch (at least not due to this problem we hope).

Category:Solaris Category:Nginx