Re: checkin of glthread/glcond modules
Yoann Vandoorselaere wrote: > > Can you see alternatives? Maybe something like , > > , , , > > ? > > Look good to me, can you handle the renaming part so that all the > modules look consistant? Done as follows: 2008-08-14 Bruno Haible <[EMAIL PROTECTED]> * lib/glthread/lock.h: Renamed from lib/lock.h. * lib/glthread/lock.c: Renamed from lib/lock.c. Update includes. * lib/glthread/tls.h: Renamed from lib/tls.h. * lib/glthread/tls.c: Renamed from lib/tls.c. Update includes. * lib/fstrcmp.c: Update includes. * lib/strsignal.c: Update includes. * modules/lock (Files, Makefile.am): Update. (Include): Change to "glthread/lock.h". * modules/tls (Files, Makefile.am): Update. (Include): Change to "glthread/tls.h". * tests/test-lock.c: Update includes. * tests/test-tls.c: Update includes. * NEWS: Mention the renamed header files. --- NEWS.orig 2008-08-14 10:56:06.0 +0200 +++ NEWS2008-08-14 10:51:09.0 +0200 @@ -6,6 +6,11 @@ DateModules Changes +2008-08-14 lockThe include file is changed from "lock.h" +to "glthread/lock.h". +tls The include file is changed from "tls.h" +to "glthread/tls.h". + 2008-07-17 c-stack The module now requires the addition of $(LIBCSTACK) or $(LTLIBCSTACK) in Makefile.am, since it may depend on linking with libsigsegv. --- lib/fstrcmp.c.orig 2008-08-14 10:56:06.0 +0200 +++ lib/fstrcmp.c 2008-08-14 10:40:41.0 +0200 @@ -1,5 +1,6 @@ /* Functions to make fuzzy comparisons between strings - Copyright (C) 1988-1989, 1992-1993, 1995, 2001-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1988-1989, 1992-1993, 1995, 2001-2003, 2006, 2008 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,8 +51,8 @@ #include #include -#include "lock.h" -#include "tls.h" +#include "glthread/lock.h" +#include "glthread/tls.h" #include "minmax.h" #include "xalloc.h" --- lib/strsignal.c.orig2008-08-14 10:56:07.0 +0200 +++ lib/strsignal.c 2008-08-14 10:39:58.0 +0200 @@ -36,8 +36,8 @@ #ifdef _LIBC # include #else /* !_LIBC */ -# include "lock.h" -# include "tls.h" +# include "glthread/lock.h" +# include "glthread/tls.h" # define __libc_once_define(CLASS, NAME) gl_once_define (CLASS, NAME) # define __libc_once(NAME, INIT) gl_once ((NAME), (INIT)) # define __libc_key_t gl_tls_key_t --- modules/lock.orig 2008-08-14 10:56:07.0 +0200 +++ modules/lock2008-08-14 10:41:55.0 +0200 @@ -2,8 +2,8 @@ Locking in multithreaded situations. Files: -lib/lock.h -lib/lock.c +lib/glthread/lock.h +lib/glthread/lock.c m4/lock.m4 build-aux/config.rpath @@ -17,10 +17,10 @@ gl_LOCK Makefile.am: -lib_SOURCES += lock.h lock.c +lib_SOURCES += glthread/lock.h glthread/lock.c Include: -"lock.h" +"glthread/lock.h" Link: $(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise --- modules/tls.orig2008-08-14 10:56:07.0 +0200 +++ modules/tls 2008-08-14 10:42:39.0 +0200 @@ -2,8 +2,8 @@ Thread-local storage in multithreaded situations. Files: -lib/tls.h -lib/tls.c +lib/glthread/tls.h +lib/glthread/tls.c m4/tls.m4 Depends-on: @@ -13,10 +13,10 @@ gl_TLS Makefile.am: -lib_SOURCES += tls.h tls.c +lib_SOURCES += glthread/tls.h glthread/tls.c Include: -"tls.h" +"glthread/tls.h" License: LGPLv2+ --- tests/test-lock.c.orig 2008-08-14 10:56:07.0 +0200 +++ tests/test-lock.c 2008-08-14 10:47:12.0 +0200 @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ # undef USE_PTH_THREADS # undef USE_WIN32_THREADS #endif -#include "lock.h" +#include "glthread/lock.h" #if ENABLE_DEBUGGING # define dbgprintf printf --- tests/test-tls.c.orig 2008-08-14 10:56:07.0 +0200 +++ tests/test-tls.c2008-08-14 10:47:19.0 +0200 @@ -1,5 +1,5 @@ /* Test of thread-local storage in multithreaded situations. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ #include #include -#include "tls.h" +#include "glthread/tls.h" #if ENABLE_DEBUGGING # define dbgprintf printf
Re: checkin of glthread/glcond modules
Le jeudi 14 août 2008 à 10:58 +0200, Bruno Haible a écrit : > Yoann Vandoorselaere wrote: > > > Can you see alternatives? Maybe something like , > > > , , , > > > ? > > > > Look good to me, can you handle the renaming part so that all the > > modules look consistant? > > Done as follows: Thanks Bruno, attached is an updated diff of the cond/thread module, renamed using this new policy. Can you check it in the GnuLib repository? Additionally, what should be the name for the module exporting the sched_yield() function? -- Yoann Vandoorselaere <[EMAIL PROTECTED]> diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h new file mode 100644 index 000..3c7b933 --- /dev/null +++ b/lib/glthread/cond.h @@ -0,0 +1,325 @@ +/* Condition waiting in multithreaded situations. + Copyright (C) 2005-2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Yoann Vandoorselaere <[EMAIL PROTECTED]>, 2008. + Based on Bruno Haible <[EMAIL PROTECTED]> lock.h */ + +/* + Condition variables can be used for waiting until a condition + becomes true. In this respect, they are similar to wait queues. But + contrary to wait queues, condition variables have different + semantics that allows events to be lost when there is no thread + waiting for them. + + Condition variable: + Type:gl_cond_t + Declaration: gl_cond_define(extern, name) + Initializer: gl_cond_define_initialized(, name) + Waiting: gl_cond_wait(name) + Timed wait: gl_cond_timedwait(name, tv) + Signaling: gl_cond_signal(name) + Broadcasting:gl_cond_broadcast(name) +*/ + + +#ifndef _GLCOND_H +#define _GLCOND_H + +#include +#include "glthread/lock.h" + +/* = */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_cond_init +# pragma weak pthread_cond_wait +# pragma weak pthread_cond_timedwait +# pragma weak pthread_cond_signal +# pragma weak pthread_cond_broadcast +# pragma weak pthread_cond_destroy + +# if !PTHREAD_IN_USE_DETECTION_HARD +# pragma weak pthread_cancel +# define pthread_in_use() (pthread_cancel != NULL) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + + +/* -- gl_cond_t datatype -- */ + +typedef pthread_cond_t gl_cond_t; +# define gl_cond_define(STORAGECLASS, NAME) \ +STORAGECLASS pthread_cond_t NAME; +# define gl_cond_define_initialized(STORAGECLASS, NAME) \ +STORAGECLASS pthread_cond_t NAME = gl_cond_initializer; +# define gl_cond_initializer \ +PTHREAD_COND_INITIALIZER +# define glthread_cond_init(COND) \ +(pthread_in_use () ? pthread_cond_init (COND, NULL) : 0) +# define glthread_cond_wait(COND, LOCK) \ +(pthread_in_use () ? pthread_cond_wait (COND, LOCK) : 0) +# define glthread_cond_timedwait(COND, LOCK, TS
Re: Lock module improvement
Addendum: For the gettext macros, it's better to distinguish macros and functions, i.e. not to have symbols which are macros on one platform and functions on others. I'm applying this: 2008-08-14 Bruno Haible <[EMAIL PROTECTED]> * lib/glthread/lock.h (glthread_lock_lock, glthread_lock_unlock, glthread_lock_destroy, glthread_rwlock_rdlock, glthread_rwlock_wrlock, glthread_rwlock_unlock, glthread_rwlock_destroy, glthread_recursive_lock_lock, glthread_recursive_lock_unlock, glthread_recursive_lock_destroy): Define as macros always. * lib/glthread/lock.c (glthread_lock_lock_func): Renamed from glthread_lock_lock. (glthread_lock_unlock_func): Renamed from glthread_lock_unlock. (glthread_lock_destroy_func): Renamed from glthread_lock_destroy. (glthread_rwlock_rdlock_func): Renamed from glthread_rwlock_rdlock. (glthread_rwlock_wrlock_func): Renamed from glthread_rwlock_wrlock. (glthread_rwlock_unlock_func): Renamed from glthread_rwlock_unlock. (glthread_rwlock_destroy_func): Renamed from glthread_rwlock_destroy. (glthread_recursive_lock_lock_func): Renamed from glthread_recursive_lock_lock. (glthread_recursive_lock_unlock_func): Renamed from glthread_recursive_lock_unlock. (glthread_recursive_lock_destroy_func): Renamed from glthread_recursive_lock_destroy. --- lib/glthread/lock.h.orig2008-08-14 12:49:08.0 +0200 +++ lib/glthread/lock.h 2008-08-14 12:48:13.0 +0200 @@ -673,10 +673,16 @@ { { 0, -1 } } # define glthread_lock_init(LOCK) \ (glthread_lock_init_func (LOCK), 0) +# define glthread_lock_lock(LOCK) \ +glthread_lock_lock_func (LOCK) +# define glthread_lock_unlock(LOCK) \ +glthread_lock_unlock_func (LOCK) +# define glthread_lock_destroy(LOCK) \ +glthread_lock_destroy_func (LOCK) extern void glthread_lock_init_func (gl_lock_t *lock); -extern int glthread_lock_lock (gl_lock_t *lock); -extern int glthread_lock_unlock (gl_lock_t *lock); -extern int glthread_lock_destroy (gl_lock_t *lock); +extern int glthread_lock_lock_func (gl_lock_t *lock); +extern int glthread_lock_unlock_func (gl_lock_t *lock); +extern int glthread_lock_destroy_func (gl_lock_t *lock); /* - gl_rwlock_t datatype - */ @@ -709,11 +715,19 @@ { { 0, -1 } } # define glthread_rwlock_init(LOCK) \ (glthread_rwlock_init_func (LOCK), 0) +# define glthread_rwlock_rdlock(LOCK) \ +glthread_rwlock_rdlock_func (LOCK) +# define glthread_rwlock_wrlock(LOCK) \ +glthread_rwlock_wrlock_func (LOCK) +# define glthread_rwlock_unlock(LOCK) \ +glthread_rwlock_unlock_func (LOCK) +# define glthread_rwlock_destroy(LOCK) \ +glthread_rwlock_destroy_func (LOCK) extern void glthread_rwlock_init_func (gl_rwlock_t *lock); -extern int glthread_rwlock_rdlock (gl_rwlock_t *lock); -extern int glthread_rwlock_wrlock (gl_rwlock_t *lock); -extern int glthread_rwlock_unlock (gl_rwlock_t *lock); -extern int glthread_rwlock_destroy (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_func (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_func (gl_rwlock_t *lock); /* - gl_recursive_lock_t datatype - */ @@ -737,10 +751,16 @@ { { 0, -1 }, 0, 0 } # define glthread_recursive_lock_init(LOCK) \ (glthread_recursive_lock_init_func (LOCK), 0) +# define glthread_recursive_lock_lock(LOCK) \ +glthread_recursive_lock_lock_func (LOCK) +# define glthread_recursive_lock_unlock(LOCK) \ +glthread_recursive_lock_unlock_func (LOCK) +# define glthread_recursive_lock_destroy(LOCK) \ +glthread_recursive_lock_destroy_func (LOCK) extern void glthread_recursive_lock_init_func (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); -extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_func (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_func (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_func (gl_recursive_lock_t *lock); /* -- gl_once_t datatype -- */ --- lib/glthread/lock.c.orig2008-08-14 12:49:07.0 +0200 +++ lib/glthread/lock.c 2008-08-14 12:48:13.0 +0200 @@ -681,7 +681,7 @@ } int -glthread_lock_lock (gl_lock_t *lock) +glthread_lock_lock_func (gl_lock_t *lock) { if (!lock->guard.done) { @@ -699,7 +699,7 @@ } int -glthread_lock_unlock (gl_lock_t *lock) +glthread_lock_unlock_func (gl_lock_t *lock) { if (!lock->guard.done) return EINVAL; @@ -708,7 +708,7 @@ } int -glthread_lock_destroy (gl_lock_t *lock) +glthread_lock_de
Re: checkin of glthread/glcond modules
Le jeudi 14 août 2008 à 11:30 +0200, Yoann Vandoorselaere a écrit : > Le jeudi 14 août 2008 à 10:58 +0200, Bruno Haible a écrit : > > Yoann Vandoorselaere wrote: > > > > Can you see alternatives? Maybe something like , > > > > , , , > > > > ? > > > > > > Look good to me, can you handle the renaming part so that all the > > > modules look consistant? > > > > Done as follows: > > Thanks Bruno, attached is an updated diff of the cond/thread module, > renamed using this new policy. Can you check it in the GnuLib > repository? > > Additionally, what should be the name for the module exporting the > sched_yield() function? Here is an updated patch, that fixes several naming issue and implement the yield module. -- Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies Tel: +33 (0)8 70 70 21 58 Fax: +33(0)4 78 42 21 58 http://www.prelude-ids.com diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h new file mode 100644 index 000..a23f1ce --- /dev/null +++ b/lib/glthread/cond.h @@ -0,0 +1,325 @@ +/* Condition waiting in multithreaded situations. + Copyright (C) 2005-2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Yoann Vandoorselaere <[EMAIL PROTECTED]>, 2008. + Based on Bruno Haible <[EMAIL PROTECTED]> lock.h */ + +/* + Condition variables can be used for waiting until a condition + becomes true. In this respect, they are similar to wait queues. But + contrary to wait queues, condition variables have different + semantics that allows events to be lost when there is no thread + waiting for them. + + Condition variable: + Type:gl_cond_t + Declaration: gl_cond_define(extern, name) + Initializer: gl_cond_define_initialized(, name) + Waiting: gl_cond_wait(name) + Timed wait: gl_cond_timedwait(name, tv) + Signaling: gl_cond_signal(name) + Broadcasting:gl_cond_broadcast(name) +*/ + + +#ifndef _GLTHREAD_COND_H +#define _GLTHREAD_COND_H + +#include +#include "glthread/lock.h" + +/* = */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_cond_init +# pragma weak pthread_cond_wait +# pragma weak pthread_cond_timedwait +# pragma weak pthread_cond_signal +# pragma weak pthread_cond_broadcast +# pragma weak pthread_cond_destroy + +# if !PTHREAD_IN_USE_DETECTION_HARD +# pragma weak pthread_cancel +# define pthread_in_use() (pthread_cancel != NULL) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + + +/* -- gl_cond_t datatype -- */ + +typedef pthread_cond_t gl_cond_t; +# define gl_cond_define(STORAGECLASS, NAME) \ +STORAGECLASS pthread_cond_t NAME; +# define gl_cond_define_initialized(STORAGECLASS, NAME) \ +STORAGECLASS pthread_cond_t NAME = gl_
Re: sa_sigaction [was: snapshot in preparation for m4 1.4.12]
On Wed, Aug 13, 2008 at 08:14:43PM -0600, Eric Blake wrote: > According to Tom G. Christensen on 8/13/2008 2:45 PM: > >>Weird. So Irix 5.3 has sigaction, but not sa_sigaction? Can you please > >>post the definition of struct sigaction from ? > >> > >>From : > >typedef struct sigaction { > >int sa_flags; /* see below for values */ > >__sigret_t (*sa_handler)(_sigargs); /* SIG_DFL, SIG_IGN, or > >*fn */ > >sigset_t sa_mask; /* additional set of sigs to be */ > >/* blocked during handler > >execution */ > >int sa_resv[2]; > >} sigaction_t; > > Let's try resolving this one first. Does this program compile > successfully (although it probably issues a warning)? > [EMAIL PROTECTED] ~]$ cat sigaction.c #include #define sa_sigaction sa_handler static void handler (int i, siginfo_t *s, void *v) { } int main() { struct sigaction sa; sa.sa_sigaction = handler; sa.sa_flags = SA_SIGINFO; return 0; } [EMAIL PROTECTED] ~]$ cc sigaction.c [EMAIL PROTECTED] ~]$ No warnings. > Then, since your latest logs show: > libsigsegv: mips-sgi-irix5.3 | yes | yes | 2.5 > it looks like c-stack will work with libsigsegv, once we downgrade the > compiler error on sa_sigaction to a warning. > Let's hope so though it didn't seem to be enough for Irix 6.x. -tgc
Using gl_ABSOLUTE_HEADER after AC_CHECK_HEADER breaks CPPFLAGS
Hi, We found an odd side effect of gnulib's absolute_header.m4 over on the Autoconf mailing list ( http://lists.gnu.org/archive/html/autoconf/2008-08/msg00024.html). Within an Autoconf macro, modifying CPPFLAGS, calling AC_CHECK_HEADER, and then calling gl_ABSOLUTE_HEADER prevents the header check from using the updated CPPFLAGS value. The expansion of gl_ABSOLUTE_HEADER causes the function look for the header before CPPFLAGS is modified. Then, after CPPFLAGS changes and AC_CHECK_HEADER does occur, the previously cached "no" result is used. A recreate: 1. Snag absolute_header.m4 from http://cvs.savannah.gnu.org/viewvc/*checkout*/gnulib/m4/absolute-header.m4?root=gnulib&content-type=text/plain 2. Pick your favorite Makefile.am. 3. Use this configure.ac: AC_INIT(recreate, 0.0.1, [EMAIL PROTECTED]) > AM_CONFIG_HEADER(config.h) > AM_INIT_AUTOMAKE(1.9 -Wall -Werror foreign) > AC_PREREQ([2.61]) > > AC_DEFUN([AX_TRILINOS_BASE],[ > if test -n "${TRILINOS_HOME}"; then CPPFLAGS="-I${TRILINOS_HOME}/include $CPPFLAGS" > fi > > AC_MSG_NOTICE([DEBUG: CPPFLAGS=${CPPFLAGS}]) > AC_CHECK_HEADER([Trilinos_version.h],[found_header=yes]) > > if test "$found_header" = yes; then > gl_ABSOLUTE_HEADER([Trilinos_version.h]) > AC_DEFINE(HAVE_TRILINOS,1,[Define if Trilinos is available]) > else > AC_MSG_ERROR([Trilinos_version.h not found]) > fi > ]) > AX_TRILINOS_BASE > > AC_CONFIG_FILES([ > Makefile > ]) > AC_OUTPUT() > 4. Invoke 'TRILINOS_HOME=somewhere ./configure' 5. Look at config.log and observe that the failed Trilinos_version.h check did not use the DEBUG: CPPFLAGS=-Isomewhere value displayed in step #4. To workaround the issue, choose any of: 1. Remove gl_ABSOLUTE_HEADER([Trilinos_version.h]) from AX_TRILINOS_BASE 2. Move the gl_ABSOLUTE_HEADER call outside of AX_TRILINOS_BASE into the toplevel configure.ac. 3. Move the gl_ABSOLUTE_HEADER call into a separate function that isn't AX_TRILINOS_BASE. But, you cannot call the new, separate function from within AX_TRILINOS_BASE otherwise you hit the same issue. 4. Remove the function AX_TRILINOS_BASE and just dump the function's code into the main configure.ac file. - Rhys
Re: Using gl_ABSOLUTE_HEADER after AC_CHECK_HEADER breaks CPPFLAGS
The recreate behaves as I expect if I modify gl_ABSOLUTE_HEADER to use AC_CHECK_HEADERS instead of AC_CHECK_HEADERS_ONCE. -Rhys On Thu, Aug 14, 2008 at 11:47 AM, Rhys Ulerich <[EMAIL PROTECTED]>wrote: > Hi, > > We found an odd side effect of gnulib's absolute_header.m4 over on the > Autoconf mailing list ( > http://lists.gnu.org/archive/html/autoconf/2008-08/msg00024.html). Within > an Autoconf macro, modifying CPPFLAGS, calling AC_CHECK_HEADER, and then > calling gl_ABSOLUTE_HEADER prevents the header check from using the updated > CPPFLAGS value. > > The expansion of gl_ABSOLUTE_HEADER causes the function look for the header > before CPPFLAGS is modified. Then, after CPPFLAGS changes and > AC_CHECK_HEADER does occur, the previously cached "no" result is used. > > A recreate: > 1. Snag absolute_header.m4 from > http://cvs.savannah.gnu.org/viewvc/*checkout*/gnulib/m4/absolute-header.m4?root=gnulib&content-type=text/plain > 2. Pick your favorite Makefile.am. > 3. Use this configure.ac: > > AC_INIT(recreate, 0.0.1, [EMAIL PROTECTED]) >> AM_CONFIG_HEADER(config.h) >> AM_INIT_AUTOMAKE(1.9 -Wall -Werror foreign) >> AC_PREREQ([2.61]) >> >> AC_DEFUN([AX_TRILINOS_BASE],[ >> if test -n "${TRILINOS_HOME}"; then > >CPPFLAGS="-I${TRILINOS_HOME}/include $CPPFLAGS" >> fi >> >> AC_MSG_NOTICE([DEBUG: CPPFLAGS=${CPPFLAGS}]) >> AC_CHECK_HEADER([Trilinos_version.h],[found_header=yes]) >> >> if test "$found_header" = yes; then >> gl_ABSOLUTE_HEADER([Trilinos_version.h]) >> AC_DEFINE(HAVE_TRILINOS,1,[Define if Trilinos is available]) >> else >> AC_MSG_ERROR([Trilinos_version.h not found]) >> fi >> ]) >> AX_TRILINOS_BASE >> >> AC_CONFIG_FILES([ >> Makefile >> ]) >> AC_OUTPUT() >> > 4. Invoke 'TRILINOS_HOME=somewhere ./configure' > 5. Look at config.log and observe that the failed Trilinos_version.h check > did not use the DEBUG: CPPFLAGS=-Isomewhere value displayed in step #4. > > To workaround the issue, choose any of: > >1. Remove gl_ABSOLUTE_HEADER([Trilinos_version.h]) from >AX_TRILINOS_BASE >2. Move the gl_ABSOLUTE_HEADER call outside of AX_TRILINOS_BASE into >the toplevel configure.ac. >3. Move the gl_ABSOLUTE_HEADER call into a separate function that isn't >AX_TRILINOS_BASE. But, you cannot call the new, separate function from >within AX_TRILINOS_BASE otherwise you hit the same issue. >4. Remove the function AX_TRILINOS_BASE and just dump the function's >code into the main configure.ac file. > > > - Rhys >
Re: snapshot in preparation for m4 1.4.12
On Thu, Aug 07, 2008 at 07:37:47AM -0600, Eric Blake wrote: > I have released a new snapshot from branch-1.4, and hope to release it as > M4 1.4.12 in the near future. This should fix many of the complaints > about strtod and other test failures that were reported against 1.4.11. > However, it also introduces a new optional dependency on libsigsegv [1]. > It also swaps the order of the two testsuites, so that the m4 tests are > run prior to the gnulib tests. Therefore I would appreciate some feedback > before making the 1.4.12 release (if you encounter a testsuite failure in > the m4 suite, please rerun with 'make -k check' before reporting it, so > that the gnulib testsuite is also run). One failure on NetBSD-4.99.72/amd64: test-frexp.c:113: assertion failed [1] Abort trap (core dumped) EXEEXT="" EXEEXT... FAIL: test-frexp Three more skipped: SKIP: test-c-stack2.sh SKIP: test-lock SKIP: test-tls Cheers, Thomas
Re: Using gl_ABSOLUTE_HEADER after AC_CHECK_HEADER breaks CPPFLAGS
Hello, Rhys Ulerich wrote: > AC_INIT(recreate, 0.0.1, [EMAIL PROTECTED]) > > AM_CONFIG_HEADER(config.h) > > AM_INIT_AUTOMAKE(1.9 -Wall -Werror foreign) > > AC_PREREQ([2.61]) > > > > AC_DEFUN([AX_TRILINOS_BASE],[ > > if test -n "${TRILINOS_HOME}"; then > >CPPFLAGS="-I${TRILINOS_HOME}/include $CPPFLAGS" > > fi > > > > AC_MSG_NOTICE([DEBUG: CPPFLAGS=${CPPFLAGS}]) > > AC_CHECK_HEADER([Trilinos_version.h],[found_header=yes]) > > > > if test "$found_header" = yes; then > > gl_ABSOLUTE_HEADER([Trilinos_version.h]) > > AC_DEFINE(HAVE_TRILINOS,1,[Define if Trilinos is available]) > > else > > AC_MSG_ERROR([Trilinos_version.h not found]) > > fi > > ]) > > AX_TRILINOS_BASE > > > > AC_CONFIG_FILES([ > > Makefile > > ]) > > AC_OUTPUT() You need to bear in mind two things: - Even the most innocent looking macro invocation can expand into something that does an AC_REQUIRE([SOMETHING]). The SOMETHING macro then gets expanded before the _outermost_ autoconf macro invocation. In your case it's before the AX_TRILINOS_BASE macro. - Lots of tests use the value of CPPFLAGS. Therefore if want to modify CPPFLAGS, you need to do it as early as possible. In particular, before any gnulib macros. The best place to do that is in configure.ac, right after AC_PROG_CC. > To workaround the issue, choose any of: > >1. Remove gl_ABSOLUTE_HEADER([Trilinos_version.h]) from AX_TRILINOS_BASE >2. Move the gl_ABSOLUTE_HEADER call outside of AX_TRILINOS_BASE into the >toplevel configure.ac. >3. Move the gl_ABSOLUTE_HEADER call into a separate function that isn't >AX_TRILINOS_BASE. But, you cannot call the new, separate function from >within AX_TRILINOS_BASE otherwise you hit the same issue. Not sufficient. >4. Remove the function AX_TRILINOS_BASE and just dump the function's code >into the main configure.ac file. That's ok. A lighter solution is: 4a. Move the CPPFLAGS modifying code into your configure.ac, early after AC_PROG_CC. Bruno