Do math journals consider a paper in which most of the content referred to another accepted but not yet published paper? In a case in which this is allowed, do one need to give a copy of the accepted paper to the editor of the target journal?
You can cite anything you want, regardless of whether it has been accepted for publication or even submitted. Of course citing preprints can make life more difficult for the referee, but there's no issue with accepted papers. They are considered just as reliable as published papers, since they've already gone through the refereeing process.
If you rely on a paper that is not yet publicly available, then you should provide a copy for the referee. However, if it's your own paper, then it's much better to post it online, for example through the arXiv. (If you supply a copy for the referee without posting it online, then it gives the impression that you are deliberately restricting access to the paper.)
This is definitely allowed in Computer Science. One way to cite the soon-to-be-published paper is, "To appear in ".
Here is an example. The authors develop a technique, write two papers, one on its theory and the other on the application, and submit the papers to suitable venues. The linked paper is the application paper. It often cites the theory paper which is the first entry in the bibliography at the end.