This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: getting autoheader to define macros?


Hi,

-- try to define your symbols in acconfig.h, call AC_DEFINE() in
configure.in, and run autoheader, it should get into the config.h

Feiyi

Assar Westerlund wrote:
> 
> I was having a hard time getting autoheader to add definitions for the
> symbols that I needed to config.h.in
> 
> I can't use the third argument ot AC_DEFINE because I want to be able
> to use shell variables and because I have two macros, one that handles
> just one argument and another that handles a list (and calls the other
> in a for-loop).
> 
> I finally got it to do what I wanted by adding @@@funcs lines, which
> adds the correct #undef's but with confusing comments.  Is there any
> better way to doing this?  My two macros are appended below.
> 
> /assar
> 
>   ------------------------------------------------------------------------
> dnl
> dnl $Id: have-linux-kernel-types.m4,v 1.1 1999/05/15 22:45:27 assar Exp $
> dnl
> dnl Check for types in the Linux kernel
> dnl
> 
> AC_DEFUN(AC_HAVE_LINUX_KERNEL_TYPES, [
> for i in $1; do
>         AC_HAVE_LINUX_KERNEL_TYPE($i)
> done
> : << END
> @@@funcs="$funcs patsubst([$1], [\w+], [linux_kernel_\&])"@@@
> END
> ])
> 
>   ------------------------------------------------------------------------
> dnl
> dnl $Id: have-linux-kernel-type.m4,v 1.1 1999/05/15 22:45:27 assar Exp $
> dnl
> dnl Check for types in the Linux kernel
> dnl
> 
> dnl AC_HAVE_LINUX_KERNEL_TYPE(type)
> AC_DEFUN(AC_HAVE_LINUX_KERNEL_TYPE, [
> cv=`echo "$1" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
> AC_MSG_CHECKING(for $i in the linux kernel)
> AC_CACHE_VAL(ac_cv_linux_kernel_type_$cv,
> AC_TRY_COMPILE([
> #define __KERNEL__
> #include <linux/types.h>
> ],
> $1 x;
> ,
> eval "ac_cv_linux_kernel_type_$cv=yes",
> eval "ac_cv_linux_kernel_type_$cv=no"))dnl
> AC_MSG_RESULT(`eval echo \\$ac_cv_linux_kernel_type_$cv`)
> if test `eval echo \\$ac_cv_linux_kernel_type_$cv` = yes; then
>   ac_tr_hdr=HAVE_LINUX_KERNEL_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
>   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
> fi
> ])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]