autoconf, Fortran, LAPACK, and AC_SEARCH_LIBS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a Fortran program that uses LAPACK.  Since LAPACK can come from different vendors depending on the platform, 
and be in different locations (e.g., /usr/lib/liblapack.a with the reference implementation, or in mkl_lapack.a in 
the Intel compiler tree when using the Intel compiler), I want to use autoconf to make by build process agnostic about this. 
How do I accomplish this?

I thought I'd put this in my configure.ac file:

		AC_SEARCH_LIBS([sgetrf], [lapack mkl_lapack])

'sgetrf' is a subroutine in LAPACK.

After I run aclocal ; autoconf ; automake ; ./configure, among the output is this:

		checking for library containing sgetrf... no 

And in the config.log file (attached), there's this:

		configure:3968: checking for library containing sgetrf                                                                                                                                                                                       
		configure:4009: gcc -o conftest -g -O2   conftest.c >&5                                                                                                                                                                                     
		/tmp/cckOOIRY.o: In function `main':                                                                                                                                                                                                         
		/home/dventimi/work/cosmosurfo/conftest.c:21: undefined reference to `sgetrf'                                                                                                                                                                
		collect2: ld returned 1 exit status                                                                                                                                                                                                          
		configure:4015: $? = 1                                                                                                                                                                                                                       

Evidently, to find a library file that supports the test subprogram 'sgetrf', it tries to compile and link a test
program that calls 'sgetrf', but it comes back with 'undefined reference'.

Perhaps this is a consequence of using autoconf to search for Fortran libraries (like LAPACK).  But either way, how is one
supposed to do this?  Thanks!

Cheers,
David

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

It was created by CosmoSurFo configure 0.0.1, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure 

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

hostname = dventimi-laptop
uname -m = i686
uname -r = 2.6.24-21-eeepc
uname -s = Linux
uname -v = #1 SMP Thu Aug 7 22:18:05 MDT 2008

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

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

PATH: /home/dventimi/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:1746: checking for a BSD-compatible install
configure:1802: result: /usr/bin/install -c
configure:1813: checking whether build environment is sane
configure:1856: result: yes
configure:1884: checking for a thread-safe mkdir -p
configure:1923: result: /bin/mkdir -p
configure:1936: checking for gawk
configure:1952: found /usr/bin/gawk
configure:1963: result: gawk
configure:1974: checking whether make sets $(MAKE)
configure:1995: result: yes
configure:2231: checking for gcc
configure:2247: found /usr/bin/gcc
configure:2258: result: gcc
configure:2496: checking for C compiler version
configure:2503: gcc --version >&5
gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Copyright (C) 2007 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.

configure:2506: $? = 0
configure:2513: gcc -v >&5
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
configure:2516: $? = 0
configure:2523: gcc -V >&5
gcc: '-V' option must have argument
configure:2526: $? = 1
configure:2549: checking for C compiler default output file name
configure:2576: gcc    conftest.c  >&5
configure:2579: $? = 0
configure:2617: result: a.out
configure:2634: checking whether the C compiler works
configure:2644: ./a.out
configure:2647: $? = 0
configure:2664: result: yes
configure:2671: checking whether we are cross compiling
configure:2673: result: no
configure:2676: checking for suffix of executables
configure:2683: gcc -o conftest    conftest.c  >&5
configure:2686: $? = 0
configure:2710: result: 
configure:2716: checking for suffix of object files
configure:2742: gcc -c   conftest.c >&5
configure:2745: $? = 0
configure:2768: result: o
configure:2772: checking whether we are using the GNU C compiler
configure:2801: gcc -c   conftest.c >&5
configure:2807: $? = 0
configure:2824: result: yes
configure:2829: checking whether gcc accepts -g
configure:2859: gcc -c -g  conftest.c >&5
configure:2865: $? = 0
configure:2964: result: yes
configure:2981: checking for gcc option to accept ISO C89
configure:3055: gcc  -c -g -O2  conftest.c >&5
configure:3061: $? = 0
configure:3084: result: none needed
configure:3113: checking for style of include used by make
configure:3141: result: GNU
configure:3166: checking dependency style of gcc
configure:3257: result: gcc3
configure:3325: checking for g77
configure:3341: found /usr/bin/g77
configure:3352: result: g77
configure:3382: checking for Fortran 77 compiler version
configure:3389: g77 --version >&5
GNU Fortran (GCC) 3.4.6 (Ubuntu 3.4.6-6ubuntu5)
Copyright (C) 2006 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
or type the command `info -f g77 Copying'.
configure:3392: $? = 0
configure:3399: g77 -v >&5
Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs
Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=pentium4 i486-linux-gnu
Thread model: posix
gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu5)
configure:3402: $? = 0
configure:3409: g77 -V >&5
g77: `-V' option must have argument
configure:3412: $? = 1
configure:3420: checking whether we are using the GNU Fortran 77 compiler
configure:3439: g77 -c  conftest.F >&5
configure:3445: $? = 0
configure:3462: result: yes
configure:3468: checking whether g77 accepts -g
configure:3485: g77 -c -g conftest.f >&5
configure:3491: $? = 0
configure:3507: result: yes
configure:3585: checking for ifort
configure:3615: result: no
configure:3585: checking for gfortran
configure:3601: found /usr/bin/gfortran
configure:3612: result: gfortran
configure:3642: checking for Fortran compiler version
configure:3649: gfortran --version >&5
GNU Fortran (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Copyright (C) 2007 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:3652: $? = 0
configure:3659: gfortran -v >&5
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
configure:3662: $? = 0
configure:3669: gfortran -V >&5
gfortran: '-V' option must have argument
configure:3672: $? = 1
configure:3680: checking whether we are using the GNU Fortran compiler
configure:3699: gfortran -c   conftest.F >&5
configure:3705: $? = 0
configure:3722: result: yes
configure:3728: checking whether gfortran accepts -g
configure:3745: gfortran -c -g  conftest.f >&5
configure:3751: $? = 0
configure:3767: result: yes
configure:3804: checking for a BSD-compatible install
configure:3860: result: /usr/bin/install -c
configure:3914: checking for ranlib
configure:3930: found /usr/bin/ranlib
configure:3941: result: ranlib
configure:3968: checking for library containing sgetrf
configure:4009: gcc -o conftest -g -O2   conftest.c  >&5
/tmp/cckOOIRY.o: In function `main':
/home/dventimi/work/cosmosurfo/conftest.c:21: undefined reference to `sgetrf'
collect2: ld returned 1 exit status
configure:4015: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "CosmoSurFo"
| #define PACKAGE_TARNAME "CosmoSurFo"
| #define PACKAGE_VERSION "0.0.1"
| #define PACKAGE_STRING "CosmoSurFo 0.0.1"
| #define PACKAGE_BUGREPORT "David A. Ventimiglia ventimig@xxxxxxx"
| #define PACKAGE "CosmoSurFo"
| #define VERSION "0.0.1"
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char sgetrf ();
| int
| main ()
| {
| return sgetrf ();
|   ;
|   return 0;
| }
configure:4009: gcc -o conftest -g -O2   conftest.c -llapack   >&5
/tmp/ccMWkSZj.o: In function `main':
/home/dventimi/work/cosmosurfo/conftest.c:21: undefined reference to `sgetrf'
collect2: ld returned 1 exit status
configure:4015: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "CosmoSurFo"
| #define PACKAGE_TARNAME "CosmoSurFo"
| #define PACKAGE_VERSION "0.0.1"
| #define PACKAGE_STRING "CosmoSurFo 0.0.1"
| #define PACKAGE_BUGREPORT "David A. Ventimiglia ventimig@xxxxxxx"
| #define PACKAGE "CosmoSurFo"
| #define VERSION "0.0.1"
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char sgetrf ();
| int
| main ()
| {
| return sgetrf ();
|   ;
|   return 0;
| }
configure:4009: gcc -o conftest -g -O2   conftest.c -lmkl_lapack   >&5
/usr/bin/ld: cannot find -lmkl_lapack
collect2: ld returned 1 exit status
configure:4015: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "CosmoSurFo"
| #define PACKAGE_TARNAME "CosmoSurFo"
| #define PACKAGE_VERSION "0.0.1"
| #define PACKAGE_STRING "CosmoSurFo 0.0.1"
| #define PACKAGE_BUGREPORT "David A. Ventimiglia ventimig@xxxxxxx"
| #define PACKAGE "CosmoSurFo"
| #define VERSION "0.0.1"
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char sgetrf ();
| int
| main ()
| {
| return sgetrf ();
|   ;
|   return 0;
| }
configure:4043: result: no
configure:4199: creating ./config.status

## ---------------------- ##
## Running config.status. ##
## ---------------------- ##

This file was extended by CosmoSurFo config.status 0.0.1, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  CONFIG_FILES    = 
  CONFIG_HEADERS  = 
  CONFIG_LINKS    = 
  CONFIG_COMMANDS = 
  $ ./config.status 

on dventimi-laptop

config.status:631: creating README
config.status:631: creating Makefile
config.status:631: creating m4/Makefile
config.status:631: creating doc/Makefile
config.status:631: creating src/Makefile
config.status:631: creating src/cosmofisher/Makefile
config.status:631: creating src/cosmomodel/Makefile
config.status:631: creating src/cosmoutils/Makefile
config.status:631: creating src/cubpack/Makefile
config.status:631: creating src/cubpack/CUBPACK/Makefile
config.status:822: executing depfiles commands

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

ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_F77_set=
ac_cv_env_F77_value=
ac_cv_env_FCFLAGS_set=
ac_cv_env_FCFLAGS_value=
ac_cv_env_FC_set=
ac_cv_env_FC_value=
ac_cv_env_FFLAGS_set=
ac_cv_env_FFLAGS_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_f77_compiler_gnu=yes
ac_cv_fc_compiler_gnu=yes
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_ac_ct_F77=g77
ac_cv_prog_ac_ct_FC=gfortran
ac_cv_prog_ac_ct_RANLIB=ranlib
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_f77_g=yes
ac_cv_prog_fc_g=yes
ac_cv_prog_make_make_set=yes
ac_cv_search_sgetrf=no
am_cv_CC_dependencies_compiler_type=gcc3

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

ACLOCAL='${SHELL} /home/dventimi/work/cosmosurfo/missing --run aclocal-1.10'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /home/dventimi/work/cosmosurfo/missing --run tar'
AUTOCONF='${SHELL} /home/dventimi/work/cosmosurfo/missing --run autoconf'
AUTOHEADER='${SHELL} /home/dventimi/work/cosmosurfo/missing --run autoheader'
AUTOMAKE='${SHELL} /home/dventimi/work/cosmosurfo/missing --run automake-1.10'
AWK='gawk'
CC='gcc'
CCDEPMODE='depmode=gcc3'
CFLAGS='-g -O2'
CPPFLAGS=''
CYGPATH_W='echo'
DEFS='-DPACKAGE_NAME=\"CosmoSurFo\" -DPACKAGE_TARNAME=\"CosmoSurFo\" -DPACKAGE_VERSION=\"0.0.1\" -DPACKAGE_STRING=\"CosmoSurFo\ 0.0.1\" -DPACKAGE_BUGREPORT=\"David\ A.\ Ventimiglia\ ventimig@xxxxxxx\" -DPACKAGE=\"CosmoSurFo\" -DVERSION=\"0.0.1\"'
DEPDIR='.deps'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
F77='g77'
FC='gfortran'
FCFLAGS='-g -O2'
FFLAGS='-g -O2'
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/dventimi/work/cosmosurfo/missing --run makeinfo'
OBJEXT='o'
PACKAGE='CosmoSurFo'
PACKAGE_BUGREPORT='David A. Ventimiglia ventimig@xxxxxxx'
PACKAGE_NAME='CosmoSurFo'
PACKAGE_STRING='CosmoSurFo 0.0.1'
PACKAGE_TARNAME='CosmoSurFo'
PACKAGE_VERSION='0.0.1'
PATH_SEPARATOR=':'
RANLIB='ranlib'
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
VERSION='0.0.1'
ac_ct_CC='gcc'
ac_ct_F77='g77'
ac_ct_FC='gfortran'
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
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='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='$(SHELL) /home/dventimi/work/cosmosurfo/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='/usr/local'
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 "CosmoSurFo"
#define PACKAGE_TARNAME "CosmoSurFo"
#define PACKAGE_VERSION "0.0.1"
#define PACKAGE_STRING "CosmoSurFo 0.0.1"
#define PACKAGE_BUGREPORT "David A. Ventimiglia ventimig@xxxxxxx"
#define PACKAGE "CosmoSurFo"
#define VERSION "0.0.1"

configure: exit 0
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux