Fix runpath handling for FreeBSD 10+ and DragonFly 3.2+. LD_LIBRARY_PATH no longer overrides DT_RPATH. DragonFly 4f0bc915b65fc and FreeBSD r238471 changed the runtime linker to search order to DT_RPATH, LD_LIBRARY_PATH, DT_RUNPATH, etc. It used to be LD_LIBRARY_PATH, DT_RPATH|DT_RUNPATH as these were aliased. This issue is seen by running a test suite from a checkout that has its own shared library while also having an older version of that library in /usr/lib. The test would use the wrong library. diff --git m4/libtool.m4 m4/libtool.m4 index f2d1f398..ac21a3b3 100644 --- m4/libtool.m4 +++ m4/libtool.m4 @@ -2715,10 +2715,15 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - *) # from 4.6 on, and DragonFly + freebsd4.[[6-9]] | freebsd[[56789]].[[0-9]]* | dragonfly[[12]].[[0-9]]* | \ + dragonfly3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; + *) # from FreeBSD 10.0 on, and DragonFly 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; esac ;;