-------- Original Message -------- Subject: Re: Specifying which shell to use Date: Mon, 12 Oct 2009 14:31:25 +0100 From: Dan Smithers <dan@xxxxxxxxxxxxxx> To: Ralf Wildenhues <Ralf.Wildenhues@xxxxxx> References: <4ACE03D0.8080908@xxxxxxxxxxxxxx> <20091008183536.GB11824@xxxxxx> 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@xxxxxxx > http://lists.gnu.org/mailman/listinfo/autoconf > _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf