Bug#468938: AC_TRY_RUN generates invalid shell code
"Artur R. Czechowski" <[EMAIL PROTECTED]> writes: > I kindly ask to fix the bug ASAP, it makes me impossible (well, hard) to fix > http://bugs.debian.org/456686, which is serious. I have now read through this bug report a couple of times and I still don't see how it relates to Autoconf. Can you explain? -- "Let others praise ancient times; I am glad I was born in these." --Ovid (43 BC-18 AD) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#468938: AC_TRY_RUN generates invalid shell code
* Artur R. Czechowski wrote on Sun, Mar 02, 2008 at 02:47:13PM CET: > > AC_TRY_RUN([#include > int main() > { > static struct random_data rand_data; > static char rand_state[256]; > initstate_r(0, rand_state, sizeof(rand_state), &rand_data); > exit(0); > }], initstate_r_works=yes,, ]) Please drop the two consecutive commas and the trailing space, then retry. > checking for usability of initstate_r... ./configure: line 2573: syntax error > near unexpected token `else' > ./configure: line 2573: `else' > > Around the line 2573 there is code: > > 2571 if test "$cross_compiling" = yes; then > 2572 > 2573 else Cheers, Ralf -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#468938: AC_TRY_RUN generates invalid shell code
* Ralf Wildenhues wrote on Sun, Mar 02, 2008 at 03:06:14PM CET: > * Artur R. Czechowski wrote on Sun, Mar 02, 2008 at 02:47:13PM CET: > > > > AC_TRY_RUN([#include > > int main() > > { > > static struct random_data rand_data; > > static char rand_state[256]; > > initstate_r(0, rand_state, sizeof(rand_state), &rand_data); > > exit(0); > > }], initstate_r_works=yes,, ]) > > Please drop the two consecutive commas and the trailing space, then > retry. Ah, now I understand why they are there. You are trying to fool autoconf so that the configure script does not cause an error when cross compiling. Well, don't do that. Do something like AC_TRY_RUN([#include int main() { static struct random_data rand_data; static char rand_state[256]; initstate_r(0, rand_state, sizeof(rand_state), &rand_data); exit(0); }], [initstate_r_works=yes], [initstate_r_works=no], [initstate_r_works=no]) in order to be on the safe side. In the cross-compiling arg, you could also test for $host or $host_os bits (in which case you have to ensure that AC_CANONICAL_HOST has been invoked earlier) and set things for systems you know about for sure. BTW, AC_TRY_RUN has been obsoleted, autoupdate can typically update your configure.ac script to use AC_RUN_IFELSE. Cheers, Ralf -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#468938: AC_TRY_RUN generates invalid shell code
Package: autoconf Version: 2.61-6 Severity: important Hello, Please consider a minimal configure.ac containing: 8<-[cut here]-8<---8<-[cut here]-8< AC_INIT([IMMS],[3.0.2],[EMAIL PROTECTED]) AC_PREREQ([2.52g]) AC_REVISION($Id: configure.ac,v 1.30 2003/10/23 23:53:20 mag Exp $) AC_PROG_CC AC_MSG_CHECKING([for usability of initstate_r]) AC_TRY_RUN([#include int main() { static struct random_data rand_data; static char rand_state[256]; initstate_r(0, rand_state, sizeof(rand_state), &rand_data); exit(0); }], initstate_r_works=yes,, ]) 8<-[cut here]-8<---8<-[cut here]-8< then run autoconf on it and then run ./configure. There result is: [EMAIL PROTECTED]:/tmp/c$ ./configure checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for usability of initstate_r... ./configure: line 2573: syntax error near unexpected token `else' ./configure: line 2573: `else' Around the line 2573 there is code: 2571 if test "$cross_compiling" = yes; then 2572 2573 else 2574 { { echo "$as_me:$LINENO: error: cannot run test program while cross comp iling 2575 See \`config.log' for more details." >&5 2576 echo "$as_me: error: cannot run test program while cross compiling 2577 See \`config.log' for more details." >&2;} 2578{ (exit 1); exit 1; }; } 2579 fi 2580 ]]) which is invalid. Please consider following shell script: 8<-[cut here]-8<---8<-[cut here]-8< #!/bin/sh if test "$1" = "foo"; then else echo There is no foo fi 8<-[cut here]-8<---8<-[cut here]-8< It always run with an error: ./foo: line 4: syntax error near unexpected token `else' ./foo: line 4: `else' /bin/sh is a symlink to /bin/bash on my box. Replacing the shebang line with #!/bin/dash doesn't help too: ./foo: 4: Syntax error: "else" unexpected Valid script is: 8<-[cut here]-8<---8<-[cut here]-8< #!/bin/sh if test "$1" = "foo"; then :; else echo There is no foo fi 8<-[cut here]-8<---8<-[cut here]-8< It runs correctly with bash and with dash. My bash and dash versions: ||/ Name VersionDescription +++-==-==- ii bash 3.1dfsg-9 The GNU Bourne Again SHell ii dash 0.5.4-7POSIX-compliant shell I kindly ask to fix the bug ASAP, it makes me impossible (well, hard) to fix http://bugs.debian.org/456686, which is serious. Best regards Artur -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=pl_PL (charmap=ISO-8859-2) Shell: /bin/sh linked to /bin/bash Versions of packages autoconf depends on: ii debianutils 2.28.4 Miscellaneous utilities specific t ii m41.4.10-1 a macro processing language ii perl 5.8.8-12 Larry Wall's Practical Extraction Versions of packages autoconf recommends: ii automake [automaken] 1:1.10.1-3 A tool for generating GNU Standard -- no debconf information -- windows jest jak Odie - głupi jak but, cały czas się uśmiecha, a linux jak Garfield - może i by coś zrobił, ale trzeba go najpierw do tego zmusić. /yacoob/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]