// This code returns the current directory of fpc system units.
// One may add other units in here without messing up the
// pristine fpc configuration ( /etc/fpc.cfg ), ensuring that
// the unit names do not clash with a system unit.
// Achieving this is messy for various reasons:
// fpc -h DOES NOT return the correct full cpu-os target
// only the cpu...
// the FPCTARGETOS macro is also bad because it returns a
// capitalised OS name Linux NOT linux this is problematic
// in a script which is case sensitive.
// IMHO there should be a simple way to ask fpc to return
// the values of the macro usable in a script
// may be "fpc -M UNITPATH" should return the info as the
// code below...
program unitpath;

const
  fpcver={$I %FPCVERSION%};
  fpctgt={$I %FPCTARGETCPU%};
  fpcos={$I %FPCTARGETOS%};

var
  s: PChar;

begin
  s := '/usr/lib/fpc/'+fpcver+'/units/'+fpctgt+'-'+fpcos;
  writeln(lowerCase(s))
end.
