Re: pkgconfig-0.5.0
Status: Beta
Brought to you by:
lotr
|
From: Frank H. <fr...@g-...> - 2001-05-28 23:31:13
|
> On Mon, May 28, 2001 at 09:18:06PM +0200, Frank Heckenbach wrote:
> > > On Thu, May 17, 2001 at 12:35:56AM +0200, Frank Heckenbach wrote:
> > > > --- pkgconfig-0.5.0/parse.c.orig Wed Jan 3 10:34:49 2001
> > > > +++ pkgconfig-0.5.0/parse.c Thu May 17 00:27:45 2001
> > > > @@ -1,3 +1,4 @@
> > > > +#define _POSIX_THREAD_SAFE_FUNCTIONS
> > > >
> > > > #include "parse.h"
> > > > #include <stdio.h>
> > > >
> > > > Otherwise, make fails with undefined references to getc_unlocked()
> > > > on my system.
> > >
> > > Could you please explain why this is neccesary, and what your system
> > > is?
> >
> > As I said, to avoid undefined references to getc_unlocked(). My
> > system is i586-pc-linux-gnulibc1 system, and my <stdio.h> contains:
> >
> > #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
> >
> > #ifndef __SVR4_I386_ABI_L1__
> > #define getc_unlocked(fp) _IO_getc(fp)
> > ...
> >
> > However, #define _POSIX_THREADS will also work (this automatically
> > defines _POSIX_THREAD_SAFE_FUNCTIONS), I don't know which one is
> > better.
>
> Ok, this is supposed to be caught by a check for flockfile in your
> libc. Seems like you have one that does have flockfile, but not
> getc_unlocked. or at least not without a #define.
My <stdio.h> has flockfile() with the same conditionals:
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
#ifndef __SVR4_I386_ABI_L1__
#define getc_unlocked(fp) _IO_getc(fp)
#define getchar_unlocked() getc_unlocked(stdin)
#define putc_unlocked(x, fp) _IO_putc(x,fp)
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif
extern void flockfile __P((FILE *));
...
However, I figure since it's only an extern declaration the autoconf
check will succeed without it (using an implicit declaration).
Whereas getc_unlocked is a macro, and if its declaration is missing,
things don't work.
If you don't want to define _POSIX_THREAD_SAFE_FUNCTIONS for some
reason, you could perhaps check if flockfile is declared. For such
tests I've used the following macro:
dnl GPC_DEFINE(NAME)
dnl Define $1 in upper case
AC_DEFUN(GPC_DEFINE,[AC_DEFINE(translit($1, [a-z], [A-Z]))])
dnl The second parameter is used by make-acconfig-h.m4
AC_DEFUN(GPC_MSG_CHECKING,[AC_MSG_CHECKING([$1])])
dnl Checks for function declarations
dnl GPC_CHECK_FUNC_DECL(FUNC, HEADERS, HEADER_MSG)
dnl Check whether function $1 is declared in $2
AC_DEFUN(GPC_CHECK_FUNC_DECL,
[ GPC_MSG_CHECKING(for $1 declaration in $3,if the $1 function is declared in $3)
AC_CACHE_VAL(gpc_cv_decl_$1,
[AC_TRY_COMPILE(
[$2],
[void (*tmp)() = (void (*)) $1;],
gpc_cv_decl_$1=yes,
gpc_cv_decl_$1=no)])
AC_MSG_RESULT($gpc_cv_decl_$1)
if test $gpc_cv_decl_$1 = yes; then
GPC_DEFINE($1_DECLARED)
fi
])
E.g.:
GPC_CHECK_FUNC_DECL(malloc, [#include <stdlib.h>], <stdlib.h>)
> Could you tell us exactly which version of libc and what distro
> you are running? thanks,
It was originally SuSE 5.2, but heavily changed, patched and
partially updated by me. The libc it 5.4.46 (AFAICR ;-).
Frank
--
Frank Heckenbach, fr...@g-...
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan
|