#! /usr/bin/env bash

# NOTE: boost have unique global symbols and using them would make plumed lib not unloadable
# NOTE: also shared_ptr in some GNU library version has the same problem :-( This seems not solvable.
# NOTE: ubuntu 22 have something in the std library, I remove std:: from the checks (GB)

LIST=$(nm -C "$@" 2>/dev/null | grep " u " | grep -v "boost::" | grep -v "std::_Sp_make_shared_tag" | grep -v " std::")

if test -n "$LIST" ;
then
  echo "WARNING: there are unique global symbols"
  echo "$LIST"
  echo "see https://github.com/plumed/plumed2/issues/549"
  exit 1
fi
