[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LLVM m4 macros
From: |
Rik |
Subject: |
LLVM m4 macros |
Date: |
Sun, 21 Jul 2013 20:42:32 -0700 |
7/21/13
LYH,
I noticed that in your most recent changeset you used AC_MSG_ERROR("...").
The quote character for m4 is '[' and ']' so I changed that in in this
changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/8d84dc5f5b5d).
Programming in m4 is a pain in the ass...
I had a question, though, about using AC_MSG_ERROR. That construct will
stop configure immediately and abort. We only use it when something
absolutely has to be present for Octave to compile, such as a BLAS
library. In this case, if someone has a screwed up installation of LLVM I
think it makes sense just to warn them, or possibly disable LLVM
compilation, but not to prevent Octave itself from compiling. Thus, I
would avoid the AC_MSG_ERROR macro.
In general the m4 macros should look like this in pseudo-code
check for feature XXX
if (XXX present)
define HAVE_XXX in config.h
endif
The new tests for LLVM, however, are
check for feature XXX
if (XXX present)
define HAVE_XXX in config.h
else
if (! XXX present)
AC_MSG_ERROR
endif
endif
As a specific example, I would take the OCTAVE_LLVM_DATALAYOUT_HEADER macro
dnl
dnl Detect TargetData.h or DataLayout.h.
dnl
AC_DEFUN([OCTAVE_LLVM_DATALAYOUT_HEADER], [
AC_CHECK_HEADER([llvm/DataLayout.h], [
octave_is_datalayout_header=yes], [
AC_CHECK_HEADER([llvm/Target/TargetData.h], [
octave_is_datalayout_header=no], [
AC_MSG_ERROR([DataLayout.h or Target/TargetData.h is required.])
])
])
if test $octave_is_datalayout_header = yes; then
AC_DEFINE(HAVE_DATALAYOUT, 1,
[Define to 1 if DataLayout.h exist.])
fi
])
and simplify it to
dnl
dnl Detect TargetData.h or DataLayout.h.
dnl
AC_DEFUN([OCTAVE_LLVM_DATALAYOUT_HEADER], [
AC_CHECK_HEADER([llvm/DataLayout.h], [
octave_is_datalayout_header=yes], [
octave_is_datalayout_header=no]
)
if test $octave_is_datalayout_header = yes; then
AC_DEFINE(HAVE_DATALAYOUT, 1,
[Define to 1 if DataLayout.h exist.])
fi
])
Is this sort of change acceptable?
Cheers,
Rik