I have set the git variables [merge] and [diff] to the appropriate values like this:
[merge]
keepBackup = false;
tool = p4merge
[mergetool]
prompt = false
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
tool = p4merge
[difftool]
prompt = false
[difftool "p4merge"]
cmd = p4merge "$LOCAL" "$REMOTE"
keepTemporaries = false
trustExitCode = false
keepBackup = false
and this works from the command line. I am not sure how to open external diff and merge tools from within magit.
I found this tool https://github.com/Perlmint/magit-exttool , but it doesn't work.