gfortran5 on at least FreeBSD emits a line starting with "Driving: " that confuses the libtool elicitation of used libraries for shared linking. $ gfortran5 -shared -v conftest.o Driving: gfortran5 -shared -v conftest.o -l gfortran -l m -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran5 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/lto-wrapper Target: x86_64-portbld-freebsd10.1 Configured with: ./../gcc-5.3.0/configure --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc5 --libexecdir=/usr/local/libexec/gcc5 --program-suffix=5 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc5/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --with-ecj-jar=/usr/local/share/java/ecj-4.5.jar --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/gcc5 --build=x86_64-portbld-freebsd10.1 Thread model: posix gcc version 5.3.0 (FreeBSD Ports Collection) Reading specs from /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../../libgfortran.spec rename spec lib to liborig COLLECT_GCC_OPTIONS='-shared' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' COMPILER_PATH=/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/:/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/:/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/:/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/:/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/:/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../../../../x86_64-portbld-freebsd10.1/bin/ LIBRARY_PATH=/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/:/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../../../../x86_64-portbld-freebsd10.1/lib/:/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-shared' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/collect2 -plugin /usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/liblto_plugin.so -plugin-opt=/usr/local/libexec/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp//cceTPVmy.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -V -Bshareable /usr/lib/crti.o /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/crtbeginS.o -L/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0 -L/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../../../../x86_64-portbld-freebsd10.1/lib -L/usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/../../.. conftest.o -lgfortran -lm -lgcc_s -lquadmath -lm -lgcc_s -lc -lgcc_s /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd10.1/5.3.0/crtendS.o /usr/lib/crtn.o GNU ld (GNU Binutils) 2.25.1 Supported emulations: elf_x86_64_fbsd elf_i386_fbsd elf_x86_64 elf_i386 elf_l1om elf_l1om_fbsd elf_k1om elf_k1om_fbsd For that reason, I patched m4/libtool.m4 to filter out this line in addition to the 'Configured with' line seen also.