Skip to main content.
home | support | download

Back to List Archive

Re: Little bug, some annoying installation details

From: Christian Ferrari <christian.ferrari(at)not-real.primeur.com>
Date: Wed Feb 26 2003 - 16:50:11 GMT
Bill Moseley wrote:

> On 26 Feb 2003, David L Norris wrote:
> 
> 
>>I suspect that was an oversight on my part when I replaced the #ifdef
>>WIN32 with a more general version.  Windows prefixes Standard C
>>functions with _ unless STDC (or something like that) is defined.  It
>>should be safe to remove the _ prefix completely.
>>
> 
> I think it's correct to test for a feature instead of an OS, but it might
> require a bit more testing in the configure script.
> 
> Bill Meier replied to me with a bit of research.  It's not entirely clear
> what the correct thing to do is (especially since you build the Windows
> binary on Linux).
> 
> Bill found example code that does this:
> 
> #ifdef _WIN32
> #define FTIME(dummy) _ftime(dummy)
> #define TIMEB _timeb
> #else
> #define FTIME(dummy) ftime(dummy)
> #define TIMEB timeb
> #endif
> 


An alternative approach is using autoconf:

AC_CHECK_FUNCS(ftime _ftime)

[some likely stuff for timeb/_timeb ... ;-) ]

and using labels


HAVE_FTIME
HAVE__FTIME
..

it works fine with "cygwin & MSVC" too.


> So that might be one option, but not really the "autoconf" way of testing
> for features.
> 
> He also pointed out:
> 
> http://www.cgal.org/Manual/doc_html/support_lib/Miscellany_ref/Class_Real_timer.html
> 
> which says
> 
> "The timer class is based in the C function gettimeofday() on POSIX
> systems, the C function _ftime() on MS Visual C++, the C function ftime()
> on Borland C++, and time() on Metrowerks Codewarrior."
> 
> So I'm not sure change to just ftime() wouldn't break things on Windows.
> 
> Perhaps the check for gettimeofday needs to be expanded in configure.in.
> 
> [I would think that there would be a standard macro for checking this as
> it seems like a common need in portable programs.]
> 
> That code is getting close to two years old, so it has not been a huge
> issue for people.
> 
> 


-- 
______________________________________

Christian Ferrari
c/o PRIMEUR ITALIA
Via E. Mattei, 1/106 A
30020 Marcon (VE) - ITALY

Tel.:    +39 041 5950998
Fax:     +39 041 5951024
Mobile:  +39 348 8960572
E-mail:  Christian.Ferrari@primeur.com
Web:     http://www.primeur.com/
Received on Wed Feb 26 17:46:30 2003