cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: _REENTRANT, _ALL_SOURCE, _THREAD_SAFE, _LARGE_FILES, etc

From: Yang Tse <yangsita_at_gmail.com>
Date: Sun, 13 Jul 2008 04:31:10 +0200

There's something which is itching me a little bit...

In curl's tool src/setup.h, introduced in revision 1.17 five years ago, we have:

#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
/* This is an ugly hack for CURLDEBUG conditions only. We need to include
   the file here, since it might set the _FILE_OFFSET_BITS define, which must
   be set BEFORE all normal system headers. */
#include "../lib/setup.h"
#endif

Since revision 1.33 of buildconf more than three years ago,
src/config.h.in is copied from lib/config.h.in

This implies that whatever symbol _FILE_OFFSET_BITS, _LARGE_FILES,
_ALL_SOURCE, _THREAD_SAFE and others defined for the library in
lib/config.h will also be defined for the tool in src/config.h and
picked by src/setup.h for configure capable systems without the need
to include lib/setup.h from src/setup.h

This would suggest that the 'ugly hack' in src/setup.h is no longer needed.

But, lib/setup.h also has the following which defines _REENTRANT for
the library on _all_ systems...

#ifndef _REENTRANT
/* Solaris needs _REENTRANT set for a few function prototypes and things to
   appear in the #include files. We need to #define it before all #include
   files. Unixware needs it to build proper reentrant code. Others may also
   need it. */
#define _REENTRANT
#endif

Which in the current status would also define it for the curl tool
when built with both CURLDEBUG and CURLTOOLDEBUG defined. This would
suggest that the 'ugly hack' in src/setup.h can not be removed.

But CURLTOOLDEBUG is not defined in any source or script. So it must
be hand-defined to be used and pull the _REENTRANT definition for the
curl tool.

Should the 'ugly hack' be removed or not ?

I don't think there's much problem in doing so. But I might be missing
some fact.

Non-configure systems should have, or could have, their own
config-platform.h file for the tool so...

Should it stay or should it go now ? la la la la ;-)

-- 
-=[Yang]=-
Received on 2008-07-13