On Fri, 2005-08-19 at 12:15 -0600, Philip Prindeville wrote: > Paul Howarth wrote: > > > Philip Prindeville wrote: > > > >> I'm trying to tweak a package so that it autodetects when it's being > >> built under Redhat/Fedora (et al) and does the right thing. > >> > >> Is there a simple and foolproof test for this? > > > > > > How about something like this: > > > > %define redhat %(/bin/grep "^Red Hat " /etc/redhat-release &> > > /dev/null && echo 1 || echo 0) > > %define fedora %(/bin/grep "^Fedora " /etc/redhat-release &> /dev/null > > && echo 1 || echo 0) > > > > ... > > > > %if %{redhat} > > echo Building on RedHat > > %else > > echo Not building on RedHat > > %endif > > > > %if %{fedora} > > echo Building on Fedora > > %else > > echo Not building on Fedora > > %endif > > > > %if %{redhat} || %{fedora} > > echo Building on RedHat or Fedora > > %else > > echo Not building on RedHat or Fedora > > %endif > > > > Paul. > > > > Sorry, I wasn't very clear. > > The test needs to be in the Makefile, not in the RPM spec file. > > What I decided on was: > > REDHAT := $(shell test -f /etc/redhat-release && echo yes) > > ... > > ifeq ($(REDHAT),yes) > ... > endif > > as the solution. That may not be reliable. Mandriva will certainly be detected as a redhat distribution with this test; not sure about SuSE. Paul. -- Paul Howarth <paul@xxxxxxxxxxxx>