This is a minimal example exposing a bug that bit me while I was running the Automake testsuite on a Solaris system. The bug seems to be located in the macro `AC_FC_LIBRARY_LDFLAGS'.
$ cat configure.ac AC_INIT([foo], [1.0]) AC_PROG_FC AC_FC_LIBRARY_LDFLAGS AC_CONFIG_FILES([Makefile]) AC_OUTPUT $ cat Makefile.in FCLIBS = @FCLIBS@ default:; @echo $(FCLIBS) $ uname -a SunOS freddy 5.10 Generic_141445-09 i86pc i386 i86pc $ /usr/bin/bash --version GNU bash, version 3.00.16(1)-release (i386-pc-solaris2.10) Copyright (C) 2004 Free Software Foundation, Inc. $ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-pc-solaris2.10 $ autconf --version autoconf (GNU Autoconf) 2.65 Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille. $ autoconf $ ./configure FC=gfortran # quotation problems in detection of fortran libs checking for gfortran... gfortran checking whether the Fortran compiler works... yes checking for Fortran compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU Fortran compiler... yes checking whether gfortran accepts -g... yes checking how to get verbose linking output from gfortran... -v checking for Fortran libraries of gfortran... -R/usr/local/lib' -L/usr/ccs/lib -L/usr/lib -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. -lgfortranbegin - lgfortran -lm configure: creating ./config.status config.status: creating Makefile $ cat Makefile # note the unbalanced single quote in definition of FCLIBS FCLIBS = -R/usr/local/lib' -L/usr/ccs/lib -L/usr/lib -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. -lgfortranbegin -lgfortran -lm default:; @echo $(FCLIBS) $ make SHELL=/usr/bin/bash /usr/bin/bash: -c: line 0: unexpected EOF while looking for matching `'' /usr/bin/bash: -c: line 1: syntax error: unexpected end of file make: *** [default] Error 2 $ ./configure FC=sunf90 # this will be ok ./configure FC=sunf90 checking whether the Fortran compiler works... yes checking for Fortran compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU Fortran compiler... no checking whether sunf90 accepts -g... yes checking how to get verbose linking output from sunf90... -v checking for Fortran libraries of sunf90... -R/opt/SUNWspro/lib -L/opt/SUNWspro/lib -L/opt/SUNWspro/prod/lib -L/usr/ccs/lib -L/lib -L/usr/lib -lfui -lfai -lfsu -lsunmath -lmtsk -lm configure: creating ./config.status config.status: creating Makefile $ cat Makefile FCLIBS = -R/opt/SUNWspro/lib -L/opt/SUNWspro/lib -L/opt/SUNWspro/prod/lib -L/usr/ccs/lib -L/lib -L/usr/lib -lfui -lfai -lfsu -lsunmath -lmtsk -lm default:; @echo $(FCLIBS) $ make SHELL=/usr/bin/bash -R/opt/SUNWspro/lib -L/opt/SUNWspro/lib -L/opt/SUNWspro/prod/lib -L/usr/ccs/lib -L/lib -L/usr/lib -lfui -lfai -lfsu -lsunmath -lmtsk -lm Attached is the config.log of the configure run with FC=gfortran. Regards, Stefano
This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by foo configure 1.0, which was generated by GNU Autoconf 2.65. Invocation command line was $ ./configure ## --------- ## ## Platform. ## ## --------- ## hostname = freddy uname -m = i86pc uname -r = 5.10 uname -s = SunOS uname -v = Generic_141445-09 /usr/bin/uname -p = i386 /bin/uname -X = System = SunOS Node = freddy Release = 5.10 KernelID = Generic_141445-09 Machine = i86pc BusType = <unknown> Serial = <unknown> Users = <unknown> OEM# = 0 Origin# = 1 NumCPU = 4 /bin/arch = i86pc /usr/bin/arch -k = i86pc /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown PATH: /home/latta/bin PATH: /usr/local/bin PATH: /usr/local64/bin PATH: /usr/games PATH: /usr/X11/bin PATH: /usr/ccs/bin PATH: /usr/xpg6/bin PATH: /usr/xpg4/bin PATH: /usr/bin PATH: /usr/sbin PATH: /sbin PATH: /usr/ucb ## ----------- ## ## Core tests. ## ## ----------- ## configure:1748: checking for gfortran configure:1764: found /usr/local/bin/gfortran configure:1775: result: gfortran configure:1801: checking for Fortran compiler version configure:1810: gfortran --version >&5 GNU Fortran (GCC) 4.4.4 Copyright (C) 2010 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING configure:1821: $? = 0 configure:1810: gfortran -v >&5 Using built-in specs. Target: i386-pc-solaris2.10 Configured with: /home/bfriesen/src/gnu/gcc-4.4.4/configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' --program-suffix=-4.4.4 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.20/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --with-cpu=opteron --enable-languages=c,c++,fortran Thread model: posix gcc version 4.4.4 (GCC) configure:1821: $? = 0 configure:1810: gfortran -V >&5 gfortran: '-V' option must have argument configure:1821: $? = 1 configure:1810: gfortran -qversion >&5 gfortran: unrecognized option '-qversion' gfortran: no input files configure:1821: $? = 1 configure:1836: checking whether the Fortran compiler works configure:1858: gfortran conftest.f >&5 configure:1862: $? = 0 configure:1911: result: yes configure:1914: checking for Fortran compiler default output file name configure:1916: result: a.out configure:1922: checking for suffix of executables configure:1929: gfortran -o conftest conftest.f >&5 configure:1933: $? = 0 configure:1955: result: configure:1971: checking whether we are cross compiling configure:1979: gfortran -o conftest conftest.f >&5 configure:1983: $? = 0 configure:1990: ./conftest configure:1994: $? = 0 configure:2009: result: no configure:2014: checking for suffix of object files configure:2030: gfortran -c conftest.f >&5 configure:2034: $? = 0 configure:2055: result: o configure:2063: checking whether we are using the GNU Fortran compiler configure:2076: gfortran -c conftest.F >&5 configure:2076: $? = 0 configure:2085: result: yes configure:2091: checking whether gfortran accepts -g configure:2102: gfortran -c -g conftest.f >&5 configure:2102: $? = 0 configure:2110: result: yes configure:2139: checking how to get verbose linking output from gfortran configure:2149: gfortran -c -g -O2 conftest.f >&5 configure:2149: $? = 0 configure:2167: gfortran -o conftest -g -O2 -v conftest.f Using built-in specs. Target: i386-pc-solaris2.10 Configured with: /home/bfriesen/src/gnu/gcc-4.4.4/configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' --program-suffix=-4.4.4 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.20/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --with-cpu=opteron --enable-languages=c,c++,fortran Thread model: posix gcc version 4.4.4 (GCC) /usr/local/libexec/gcc/i386-pc-solaris2.10/4.4.4/f951 conftest.f -ffixed-form -quiet -dumpbase conftest.f -mtune=opteron -auxbase conftest -g -O2 -version -fintrinsic-modules-path /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/finclude -o /tmp/ccT7T3Ia.s GNU Fortran (GCC) version 4.4.4 (i386-pc-solaris2.10) compiled by GNU C version 4.4.4, GMP version 4.3.1, MPFR version 2.3.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/local/lib/binutils-2.20/bin/as -v --traditional-format -V -Qy -s -o /tmp/ccwkjmMe.o /tmp/ccT7T3Ia.s GNU assembler version 2.20 (i386-pc-solaris2.10) using BFD version (GNU Binutils) 2.20 /usr/local/libexec/gcc/i386-pc-solaris2.10/4.4.4/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o conftest /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/crtbegin.o -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. /tmp/ccwkjmMe.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.497 configure:2232: result: -v configure:2234: checking for Fortran libraries of gfortran configure:2257: gfortran -o conftest -g -O2 -v conftest.f Using built-in specs. Target: i386-pc-solaris2.10 Configured with: /home/bfriesen/src/gnu/gcc-4.4.4/configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' --program-suffix=-4.4.4 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.20/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --with-cpu=opteron --enable-languages=c,c++,fortran Thread model: posix gcc version 4.4.4 (GCC) /usr/local/libexec/gcc/i386-pc-solaris2.10/4.4.4/f951 conftest.f -ffixed-form -quiet -dumpbase conftest.f -mtune=opteron -auxbase conftest -g -O2 -version -fintrinsic-modules-path /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/finclude -o /tmp/cchy5ZWe.s GNU Fortran (GCC) version 4.4.4 (i386-pc-solaris2.10) compiled by GNU C version 4.4.4, GMP version 4.3.1, MPFR version 2.3.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/local/lib/binutils-2.20/bin/as -v --traditional-format -V -Qy -s -o /tmp/ccsu9Nen.o /tmp/cchy5ZWe.s GNU assembler version 2.20 (i386-pc-solaris2.10) using BFD version (GNU Binutils) 2.20 /usr/local/libexec/gcc/i386-pc-solaris2.10/4.4.4/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o conftest /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/crtbegin.o -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. /tmp/ccsu9Nen.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/crtend.o /usr/lib/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.497 configure:2431: result: -R/usr/local/lib' -L/usr/ccs/lib -L/usr/lib -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. -lgfortranbegin -lgfortran -lm configure:2582: creating ./config.status ## ---------------------- ## ## Running config.status. ## ## ---------------------- ## This file was extended by foo config.status 1.0, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = CONFIG_HEADERS = CONFIG_LINKS = CONFIG_COMMANDS = $ ./config.status on freddy config.status:722: creating Makefile ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_env_FCFLAGS_set= ac_cv_env_FCFLAGS_value= ac_cv_env_FC_set= ac_cv_env_FC_value= 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_fc_compiler_gnu=yes ac_cv_fc_libs=' -R/usr/local/lib'\'' -L/usr/ccs/lib -L/usr/lib -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. -lgfortranbegin -lgfortran -lm' ac_cv_objext=o ac_cv_prog_ac_ct_FC=gfortran ac_cv_prog_fc_g=yes ac_cv_prog_fc_v=-v ## ----------------- ## ## Output variables. ## ## ----------------- ## DEFS='-DPACKAGE_NAME=\"foo\" -DPACKAGE_TARNAME=\"foo\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"foo\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\"' ECHO_C='' ECHO_N='-n' ECHO_T='' EXEEXT='' FC='gfortran' FCFLAGS='-g -O2' FCLIBS=' -R/usr/local/lib'\'' -L/usr/ccs/lib -L/usr/lib -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4 -L/usr/local/lib/gcc/i386-pc-solaris2.10/4.4.4/../../.. -lgfortranbegin -lgfortran -lm' LDFLAGS='' LIBOBJS='' LIBS='' LTLIBOBJS='' OBJEXT='o' PACKAGE_BUGREPORT='' PACKAGE_NAME='foo' PACKAGE_STRING='foo 1.0' PACKAGE_TARNAME='foo' PACKAGE_URL='' PACKAGE_VERSION='1.0' PATH_SEPARATOR=':' SHELL='/bin/bash' ac_ct_FC='gfortran' bindir='${exec_prefix}/bin' build_alias='' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='${prefix}' host_alias='' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/usr/local' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define PACKAGE_NAME "foo" #define PACKAGE_TARNAME "foo" #define PACKAGE_VERSION "1.0" #define PACKAGE_STRING "foo 1.0" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "" configure: exit 0