I have already solved this problem, but there was an error when I was trying to emerge emacs that said

Xm/whatever.h
Xm/whateverelse.h

and so on...

and when I tried to emerge xpdf, it said it wasn't going to compile the parts that needed X.

What I had to do is:

cd /usr/include
ln -s openmotif<tab>/Xm

then they gave me errors about -lXm not working with gcc, so to solve that:

cd /usr/lib
ln -s openmotif<tab>/libXm*

then everything compiled. Hope that helps someone.