Re: [PATCH] allow cross-compiling samba-2.2.7

2002-12-13 Thread Dan Kegel
Gerald (Jerry) Carter wrote:

Dan,

Please send me the patch and I'll work on getting it in. 

On Fri, 6 Dec 2002, Dan Kegel wrote:


Here's the only use of HAVE_GETTIMEOFDAY_TZ:

void GetTimeOfDay(struct timeval *tval)
{
#ifdef HAVE_GETTIMEOFDAY_TZ
gettimeofday(tval,NULL);
#else
gettimeofday(tval);
#endif
}

Thus all it's trying to do is tell whether the 2nd parameter
has to be there.  You can do that without a runtime check --
unless you're trying to be sneaky and optimize away one
parameter for performance reasons.

If the group feels that there's an important performance reason
to avoid that 2nd parameter, then sure, I can submit another
patch that keeps the current "skip the 2nd parameter if it
didn't crash the first time we called it with only 1 parameter" behavior.


Thanks, looking forward to hearing what you think about the patch.
Patch attached.
- Dan





--- samba-2.2.7/source/configure.in.origThu Dec  5 12:09:07 2002
+++ samba-2.2.7/source/configure.in Thu Dec  5 12:18:52 2002
@@ -1167,10 +1167,10 @@
 fi
 
 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
-AC_TRY_RUN([
+AC_TRY_COMPILE([
 #include 
-#include 
-main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
+#include ],
+[struct timeval tv; exit(gettimeofday(&tv, NULL));],

samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)



Re: [PATCH] allow cross-compiling samba-2.2.7

2002-12-13 Thread Gerald (Jerry) Carter
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dan,

Please send me the patch and I'll work on getting it in.




cheers, jerry


On Fri, 6 Dec 2002, Dan Kegel wrote:

> Here's the only use of HAVE_GETTIMEOFDAY_TZ:
> 
> void GetTimeOfDay(struct timeval *tval)
> {
> #ifdef HAVE_GETTIMEOFDAY_TZ
>  gettimeofday(tval,NULL);
> #else
>  gettimeofday(tval);
> #endif
> }
> 
> Thus all it's trying to do is tell whether the 2nd parameter
> has to be there.  You can do that without a runtime check --
> unless you're trying to be sneaky and optimize away one
> parameter for performance reasons.
> 
> If the group feels that there's an important performance reason
> to avoid that 2nd parameter, then sure, I can submit another
> patch that keeps the current "skip the 2nd parameter if it
> didn't crash the first time we called it with only 1 parameter" behavior.
> 
> - Dan
> 

- -- 
 --
 Hewlett-Packard- http://www.hp.com
 SAMBA Team -- http://www.samba.org
 GnuPG Key   http://www.plainjoe.org/gpg_public.asc
 ISBN 0-672-32269-2 "SAMS Teach Yourself Samba in 24 Hours" 2ed
 "You can never go home again, Oatman, but I guess you can shop there."  
--John Cusack - "Grosse Point Blank" (1997)


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.0 (GNU/Linux)
Comment: For info see http://quantumlab.net/pine_privacy_guard/

iD8DBQE9+h3EIR7qMdg1EfYRAh6cAKDvfsibGbHI9oZJbqlaTdkMfEa56QCg3yua
wZWpDj/x7oM8ppKE63vbaJw=
=hD85
-END PGP SIGNATURE-




Re: [PATCH] allow cross-compiling samba-2.2.7

2002-12-06 Thread Dan Kegel
Steve Langasek wrote:

On Fri, Dec 06, 2002 at 07:29:52AM -0800, Dan Kegel wrote:

Here's a patch that removes the one use of AC_TRY_RUN in configure.in
that was causing trouble.  (And oddly, this makes the definition of
HAVE_GETTIMEOFDAY_TZ better match how this macro is used in the sources,
I think.)  Please apply if you agree it's benign.  Thanks!


Are you certain that the runtime check isn't needed on some platforms?
There may be some platforms that appear to have a working gettimeofday()
until you actually try to *use* it; maybe the AC_TRY_RUN was frivolous,
but maybe it was added to deal with a real problem. 

Here's the only use of HAVE_GETTIMEOFDAY_TZ:

void GetTimeOfDay(struct timeval *tval)
{
#ifdef HAVE_GETTIMEOFDAY_TZ
gettimeofday(tval,NULL);
#else
gettimeofday(tval);
#endif
}

Thus all it's trying to do is tell whether the 2nd parameter
has to be there.  You can do that without a runtime check --
unless you're trying to be sneaky and optimize away one
parameter for performance reasons.

If the group feels that there's an important performance reason
to avoid that 2nd parameter, then sure, I can submit another
patch that keeps the current "skip the 2nd parameter if it
didn't crash the first time we called it with only 1 parameter" behavior.

- Dan




Re: [PATCH] allow cross-compiling samba-2.2.7

2002-12-06 Thread Steve Langasek
On Fri, Dec 06, 2002 at 07:29:52AM -0800, Dan Kegel wrote:
> I needed to cross-compile Samba for ppc linux from x86 linux.
> Fortunately, samba-2.2.7 is very nearly cross-compile-friendly.
> The main problem when cross-compiling autoconf'd projects is AC_TRY_RUN
> in configure.in, which just doesn't work.  Sure enough, to get
> Samba to build in a cross-compilation environment, all I had
> to do was get rid of one use of AC_TRY_RUN in configure.in,
> run autoconf2.50 (to generate a configure script that sets
> SIZEOF_INT without using AC_TRY_RUN), and run configure like this:

> CC=/opt/cegl-1.4/hardhat/devkit/ppc/405/bin/powerpc-linux-gcc 
> CFLAGS="-mcpu=403" ../samba-2.2.7/source/configure 
> --build=pentium-unknown-linux --host=ppc-unknown-linux

> Here's a patch that removes the one use of AC_TRY_RUN in configure.in
> that was causing trouble.  (And oddly, this makes the definition of
> HAVE_GETTIMEOFDAY_TZ better match how this macro is used in the sources,
> I think.)  Please apply if you agree it's benign.  Thanks!

Are you certain that the runtime check isn't needed on some platforms?
There may be some platforms that appear to have a working gettimeofday()
until you actually try to *use* it; maybe the AC_TRY_RUN was frivolous,
but maybe it was added to deal with a real problem.  In the latter case,
AC_TRY_RUN should be called with a sane default for cross-compiling.

-- 
Steve Langasek
postmodern programmer



msg04813/pgp0.pgp
Description: PGP signature