#!/bin/sh

binary_name="mold"
# Enable build with mold when the mold binary exists.
if which "$binary_name" > /dev/null 2>&1; then
  mold_path=$(which "$binary_name")
  if [ ! -x $mold_path ]; then
    exit 0
  fi

  if grep -Fxq $2 $1;then
    echo "-fuse-ld=mold"
  fi
fi
