libtool doesn't PIC flags for PGI?

I think I’ve found a bug in the way that GNU libtool identifies PIC flags for recent PGI compilers. Has anyone else noticed this?

I’m looking at libtool-2.4.6/m4/libtool.m4. The section where the PIC flags are detected is:

  case `$CC -V 2>&1 | sed 5q` in
  *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
    # Sun Fortran 8.3 passes all unrecognized flags to the linker
    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
    ;;
  *Sun\ F* | *Sun*Fortran*)
    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
    ;;
  *Sun\ C*)
    # Sun C 5.9
    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    ;;
        *Intel*\ [[CF]]*Compiler*)
    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
    ;;
  *Portland\ Group*)
    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    ;;
  esac
  ;;

The problem I see is that libtool is expecting $CC -V 2>&1 | sed 5q to contain the words “Portland Group”. However, I see that in the latest versions of the PGI compilers, pgcc -V identifies itself as:

pgcc 17.10-0 64-bit target on x86-64 Linux -tp haswell
PGI Compilers and Tools
Copyright © 2017, NVIDIA CORPORATION. All rights reserved.

Which doesn’t contain “Portland Group”.

I noticed this problem when an autool project failed at link time. The “-fpic” flag hadn’t been added to the link line.

Has anyone else noticed this issue?

Many thanks,
Ron

Hi Ron,

We have not had any similar reports. Though, let me see if anyone here can contact the libtool folks to see if we can get it updated with the name change.

Thanks for the report,
Mat