autoconf
[Top][All Lists]
Advanced

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

Detecting Autoconf and Including Additional M4 Files


From: Christopher Key
Subject: Detecting Autoconf and Including Additional M4 Files
Date: Mon, 24 Sep 2007 12:15:16 +0100
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Hello,

I'm completely new to autotools and am trying to autoconfiscate a pretty simple existing package, and I've a couple of questions.

Firstly, some sections of the code are endian dependent. Autoconf has a test, AC_C_BIGENDIAN, which defines WORDS_BIGENDIAN on big endian systems, does nothing on little endian systems, and issues an error if endianness couldn't be detected. This is fine when you know that autoconf has definately been used; the absence of WORDS_BIGENDIAN specifically implies a little endian system. However, clearly this is not the case if the code is being compiled entirely separately from autoconf, e.g. in MSVC. Hence, what I'd like to do is to be able to detect whether autoconf has been used, and act appropriately, e.g.

#ifdef USED_AUTOCONF
#ifdef WORDS_BIGENDIAN
do stuff for big endian systems
#else
do stuff for little endian systems
#endif
#else
#ifndef BYTE_ORDER
#error Please set BYTE_ORDER
#elseif BYTE_ORDER == BIG_ENDIAN
do stuff for big endian systems
#elseif BYTE_ORDER == LITTLE_ENDIAN
do stuff for little endian systems
#else
#error Unknown BYTE_ORDER
#endif
#endif

Bascially, what I'm wondering is whether this is the best way to do this, whether there's any standard name for 'USED_AUTOCONF', and where the best place to set it is.


Secondly, I'm also wanting to detect whether there an arithmetic right shift available. I've found a test that does this, and have put it in package/m4/asr.m4. What I'm wondering is how to ensure that this file is included. The only way I've found to achieve this is to add 'ACLOCAL_AMFLAGS = -I m4' to package/Makefile.am, but this doesn't seem quite right. I've seen adding 'AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")' to configure.ac suggested online, but this didn;t seem to do the trick. Any suggestions?

Regards,

Chris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]