Specifying which shell to use

View: New views
6 Messages — Rating Filter:   Alert me  

Specifying which shell to use

by Dan Smithers-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a way of specifying the shell to ues when running the configure
scripts?

I see that the default configure begins

#! /bin/sh

that specifies to use sh.

On my Ubuntu system, this is a link to /bin/dash.

If I edit configure by hand to start

#! /bin/bash

it works. If I leave it pointing to dash it fails to execute the code
generated by the intel compiler (icpc).

thanks

dan


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: Specifying which shell to use

by Warren Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan Smithers wrote:
> If I edit configure by hand to start
>
> #! /bin/bash
>
> it works.

You shouldn't be writing configure tests that depend on Bash.

The whole point of autoconf is that it lets you test for features on a
system whose capabilities you do not yet fully understand.  One of those
capabilities is exactly how functional the Bourne-style shell is.  On
some systems, you won't find Bash *at all*, and on others, you will find
something that's crippled even by SysVR3 standards.

Your tests should cope with all of this, using only as much shell
functionality as is available on *all* of the systems you want to port to.


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: Specifying which shell to use

by Bob Friesenhahn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 8 Oct 2009, Warren Young wrote:
>
> You shouldn't be writing configure tests that depend on Bash.

As a side note, I read some recent Debian news which says that the
default shell for Debian GNU Linux will be switched to 'dash'.  It
seems that they were not happy with the execution performance of the
World's Slowest Shell (TM).

Bob
--
Bob Friesenhahn
bfriesen@..., http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: Specifying which shell to use

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Dan,

* Dan Smithers wrote on Thu, Oct 08, 2009 at 05:22:56PM CEST:
> Is there a way of specifying the shell to ues when running the configure
> scripts?

At configure run time?  Read `info Autoconf --index CONFIG_SHELL'.

> I see that the default configure begins
>
> #! /bin/sh
>
> that specifies to use sh.
>
> On my Ubuntu system, this is a link to /bin/dash.

Which shouldn't be a big problem.  configure has machinery to either
cope with shells, or try to find a better one and use that.

> If I edit configure by hand to start
>
> #! /bin/bash
>
> it works. If I leave it pointing to dash it fails to execute the code
> generated by the intel compiler (icpc).

Can you please be more specific here?  Show a small configure.ac script
that fails, and how it fails, copy and pasting the commands and error
messages?  Things should work just fine with icpc.

Or is it that some of the code that you wrote yourself, not coming from
Autoconf, doesn't cope with dash?  In that case, the first
recommendation is the one you heard from the others: write portable
code.  If absolutely impossible, there also exists a (currently internal
only) API to specify tests that the shell in use must pass in order to
be eligible.  We could make a public API  to _AS_DETECT_REQUIRED, if
it's deemed safe enough to use.

Thanks,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Parent Message unknown Re: Specifying which shell to use

by Dan Smithers-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



-------- Original Message --------
Subject: Re: Specifying which shell to use
Date: Mon, 12 Oct 2009 14:31:25 +0100
From: Dan Smithers <dan@...>
To: Ralf Wildenhues <Ralf.Wildenhues@...>
References: <4ACE03D0.8080908@...>
<20091008183536.GB11824@...>

Hi all,

My supposition comes from these facts

When I use CC=gcc and CXX=g++ the configure works and produces a working
Makefile.

If I set CC=icc and CXX=icpc then the configure fails as shown below.

The first line of the configure is
#! /bin/sh

On my Ubuntu system /bin/sh is a link to /bin/dash

If I change the first line to
#! /bin/bash
then the build works using either gcc or icc.

If I run configure on a Redhat 7.3 machine then it works correctly (but
/bin/sh is a link to /bin/bash).

The problem comes before I get to my code in the autotools bit.

This may not be the ideal recipe for portable code, but I would like to
be able to get this working in both environments.

thanks for your input

dan
>
> Can you please be more specific here?  Show a small configure.ac script
> that fails, and how it fails, copy and pasting the commands and error
> messages?  Things should work just fine with icpc.
>

I have written a four line "hello world" to demonstrate this.
-------- command line and error output --------

/homesint/dwhs1/test/amake/hello_world/configure -C --prefix
/opt/astraguard/2.6.20-16-generic/icc8/debug CC=icc CXX=icpc
'CPPFLAGS=-D_GNU_SOURCE -DDEBUG' 'CFLAGS=-w1 -wd 963 -wd 964 -wd 1338
-xK -openmp -D__Linux__ -g -O0' 'CXXFLAGS=-w1 -wd 963 -wd 964 -wd 1338
-wd 444 -xK -openmp -D__Linux__ -g -O0 -openmp'
configure: loading cache config.cache
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... icc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C
compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

-------- configure.ac ----------

# preamble
AC_INIT([hello_world], [1522])
AC_PREREQ([2.61])

# specify alternative directory
AC_CONFIG_AUX_DIR([config])

# set up auto make - require version 1.10
AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.10])
# specify config header name.
AM_CONFIG_HEADER([config.h])

# set default path prefix
AC_PREFIX_DEFAULT([/opt/test/])

AC_FUNC_VPRINTF

AC_OUTPUT(Makefile)

-------- Makefile.am -----------

AM_CPPFLAGS=
AM_CFLAGS=-Wall -Werror
AM_CXXFLAGS=$(AM_CFLAGS)

bin_PROGRAMS=hello_world
hello_world_SOURCES= hello_world.cpp
hello_world_LDADD=
EXTRA_DIST=

MAINTAINERCLEANFILES=Makefile.in

-------- config.log ------------

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by hello_world configure 1522, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ /homesint/dwhs1/test/amake/hello_world/configure -C --prefix
/opt/astraguard/2.6.20-16-generic/icc8/debug CC=icc CXX=icpc
CPPFLAGS=-D_GNU_SOURCE -DDEBUG CFLAGS=-w1 -wd 963 -wd 964 -wd 1338 -xK
-openmp -D__Linux__ -g -O0 CXXFLAGS=-w1 -wd 963 -wd 964 -wd 1338 -wd 444
-xK -openmp -D__Linux__ -g -O0 -openmp

## --------- ##
## Platform. ##
## --------- ##

hostname = ganymede
uname -m = i686
uname -r = 2.6.20-16-generic
uname -s = Linux
uname -v = #2 SMP Thu Jun 7 20:19:32 UTC 2007

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = i686
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /vol/build/intel/compiler80/bin
PATH: /homesint/dwhs1/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1590: loading cache config.cache
configure:1734: checking for a BSD-compatible install
configure:1790: result: /usr/bin/install -c
configure:1801: checking whether build environment is sane
configure:1844: result: yes
configure:1872: checking for a thread-safe mkdir -p
configure:1911: result: /bin/mkdir -p
configure:1924: checking for gawk
configure:1954: result: no
configure:1924: checking for mawk
configure:1940: found /usr/bin/mawk
configure:1951: result: mawk
configure:1962: checking whether make sets $(MAKE)
configure:1983: result: yes
configure:2190: checking for style of include used by make
configure:2218: result: GNU
configure:2288: checking for gcc
configure:2315: result: icc
configure:2553: checking for C compiler version
configure:2560: icc --version >&5
8.0
configure:2563: $? = 0
configure:2570: icc -v >&5
Version 8.0
configure:2573: $? = 0
configure:2580: icc -V >&5
Intel(R) C++ Compiler for 32-bit applications, Version 8.0   Build
20031016Z Package ID: l_cc_p_8.0.055
Copyright (C) 1985-2003 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

icc: Command line error: no files specified; for help type "icc -help"
configure:2583: $? = 1
configure:2606: checking for C compiler default output file name
configure:2633: icc -w1 -wd 963 -wd 964 -wd 1338 -xK -openmp -D__Linux__
-g -O0 -D_GNU_SOURCE -DDEBUG  conftest.c  >&5
configure:2636: $? = 0
configure:2674: result: a.out
configure:2691: checking whether the C compiler works
configure:2701: ./a.out
/homesint/dwhs1/test/amake/hello_world/configure: line 2702: 15162
Segmentation fault      (core dumped) ./$ac_file
configure:2704: $? = 139
configure:2713: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=set
ac_cv_env_CC_value=icc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-w1 -wd 963 -wd 964 -wd 1338 -xK -openmp
-D__Linux__ -g -O0'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-D_GNU_SOURCE -DDEBUG'
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_ac_ct_CC=icc
ac_cv_prog_make_make_set=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /homesint/dwhs1/test/amake/hello_world/config/missing
--run aclocal-1.10'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /homesint/dwhs1/test/amake/hello_world/config/missing
--run tar'
AUTOCONF='${SHELL} /homesint/dwhs1/test/amake/hello_world/config/missing
--run autoconf'
AUTOHEADER='${SHELL}
/homesint/dwhs1/test/amake/hello_world/config/missing --run autoheader'
AUTOMAKE='${SHELL} /homesint/dwhs1/test/amake/hello_world/config/missing
--run automake-1.10'
AWK='mawk'
CC='icc'
CCDEPMODE=''
CFLAGS='-w1 -wd 963 -wd 964 -wd 1338 -xK -openmp -D__Linux__ -g -O0'
CPPFLAGS='-D_GNU_SOURCE -DDEBUG'
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /homesint/dwhs1/test/amake/hello_world/config/missing
--run makeinfo'
OBJEXT=''
PACKAGE='hello_world'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='hello_world'
PACKAGE_STRING='hello_world 1522'
PACKAGE_TARNAME='hello_world'
PACKAGE_VERSION='1522'
PATH_SEPARATOR=':'
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
VERSION='1522'
ac_ct_CC='icc'
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=' -I$(srcdir)'
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='$(SHELL)
/homesint/dwhs1/test/amake/hello_world/config/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='/bin/mkdir -p'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/opt/astraguard/2.6.20-16-generic/icc8/debug'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME "hello_world"
#define PACKAGE_TARNAME "hello_world"
#define PACKAGE_VERSION "1522"
#define PACKAGE_STRING "hello_world 1522"
#define PACKAGE_BUGREPORT ""
#define PACKAGE "hello_world"
#define VERSION "1522"

configure: exit 1



> Or is it that some of the code that you wrote yourself, not coming from
> Autoconf, doesn't cope with dash?  In that case, the first
> recommendation is the one you heard from the others: write portable
> code.  If absolutely impossible, there also exists a (currently internal
> only) API to specify tests that the shell in use must pass in order to
> be eligible.  We could make a public API  to _AS_DETECT_REQUIRED, if
> it's deemed safe enough to use.
>
> Thanks,
> Ralf
>
>
> _______________________________________________
> Autoconf mailing list
> Autoconf@...
> http://lists.gnu.org/mailman/listinfo/autoconf
>




_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: Specifying which shell to use

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Dan,

please don't top-post, thank you.

* Dan Smithers wrote on Mon, Oct 12, 2009 at 03:32:01PM CEST:
> When I use CC=gcc and CXX=g++ the configure works and produces a working
> Makefile.
>
> If I set CC=icc and CXX=icpc then the configure fails as shown below.

> On my Ubuntu system /bin/sh is a link to /bin/dash
>
> If I change the first line to
> #! /bin/bash
> then the build works using either gcc or icc.

How old is this system?  Which version is the (d)ash on this system?

> If I run configure on a Redhat 7.3 machine then it works correctly (but
> /bin/sh is a link to /bin/bash).

Redhat 7.3 is quite old, which makes me suspicious of the above.

> The problem comes before I get to my code in the autotools bit.

The problem looks like a segfault in either dash, or the program
generated by your compiler.

Cheers,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf