[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request: detect CPU instruction set
From: |
Sam Steingold |
Subject: |
Re: feature request: detect CPU instruction set |
Date: |
Tue, 31 Aug 2010 14:55:24 -0400 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100721) |
Bruno Haible wrote:
Compared to the code that you proposed:
- I changed the name, of course.
- I chose to use AC_CACHE_CHECK once for the result of the entire macro, not
for each AC_EGREP_CPP inside it.
- I dropped Convex CPUs; these are dead for more than 10 years.
- I added an AH_TOP invocation so that the __xyz__ macro gets defined through
config.h.
these are not the only changes:
AC_EGREP_CPP([yes],
[#if defined __LP64__ || defined __x86_64__ || defined __amd64__
yes
#endif],
...
AC_EGREP_CPP([yes],
[#if defined __ARMEL__
yes
#endif],
... etc
I have
dnl CL_CACHE_EGREP_CPP(what,variable,condition)
AC_DEFUN([CL_CACHE_EGREP_CPP],
[AC_CACHE_CHECK([for $1], [$2], [AC_EGREP_CPP(yes,
[#if $3
yes
#endif
], [$2=yes], [$2=no])])])
dnl CL_SET_CPU_ABI(what,variable,condition,yes_abi,no_abi)
AC_DEFUN([CL_SET_CPU_ABI],
[CL_CACHE_EGREP_CPP([$1],[$2],[$3])
if test $$2 = yes; then
host_cpu_abi=$4
else
host_cpu_abi=$5
fi])
which make the code much more readable.
you say you want to cache just once.
fine, remove AC_CACHE_CHECK.