[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

porting issue

On Wed, May 02, 2001 at 11:54:10PM -0700, Jeff Bailey wrote:
> On Thu, May 03, 2001 at 02:23:08PM +1000, Glenn McGrath wrote:
> > I was going to do this
> > 
> > ifeq ($(strip $(shell uname)),Linux)
> >   LIBBB_CSRC+= interface.c module_syscalls.c syscalls.c
> > endif

Parsing the output of uname in this way is barely aceptable for postinst
scripts.  This should be done in a config.guess file and the output of
config.guess can be checked.

You can use the config.guess of automake, or better use autoconf for the
whole thing.  If you look at /usr/share/automake/config.guess, you will see
how careful it is to allow cross-compiling.  You will also see that it uses
various uname invocations to assemble the system configuration, but with
some post procession.

> > to isolate linux specific code, but im told this wont work under a cross
> > compiler.
> > 
> > I dont know much about setting up cross compilers... anyone have a
> > better suggestion for modifying a makefile (it doesnt use a configure)
> > to switch behaviour if compiling for linux or the Hurd ?
> In general, if you're not using autoconf and automake, your Makefile
> probably won't usefully cross-compile anyway.  (Unless you've very
> intentionally made this possible)

Stressing "probably". Setting CC can do wonders.

> Are you doing this in the context of a Debian package?  If yes, look for $(DEB_BUILD_GNU_TYPE)
> to be 'i386-linux' or 'i386-gnu'

Please do $(DEB_BUILD_GNU_SYSTEM) comparison with linux or gnu, so you match
non-i386, too (unless you don't want to).
> Failing that, your uname trick is just as good as any others.

If this is upstream software, it should provide a proper mechanism to
maintain portability.  As a quick hack, just to get things rolling, the
above hack will work.

Another idea is to add this as a feature.  Something like
configure --with-linux-syscalls, where this is default on linux, but
disabled on all other platforms.


Reply to: