Cut the eggplants lengthwise into 3/4 to 1 inch thick slices. Place a few slices in a colander and sprinkle with a little of the salt. Continue to slice the eggplants and place them in the colander with salt. Place a plate that just covers the eggplant on top, and then weight it down with a heavy can or canister. Let the eggplant drain in the sink for about 45 minutes. Pat the eggplant dry.
While the eggplant is being purged of any bitterness, begin the sauce by heating the olive oil in a heavy saucepan. Add the onion and cook until soft. Add the garlic and cook an additional minute or two. Next add the tomatoes, salt pepper, and red pepper flakes. Cook over low heat until the sauce has thickened, about 30 minutes. Add the chopped basil and mix well.
Turn on the broiler in the oven and place the eggplant slices flat on a lightly greased baking sheet.
Lightly brush the top of the eggplants with olive oil and then broil until lightly browned.
Turn the eggplant, and brown the other side. Continue in this manner until all of the eggplant slices have been browned.
Preheat oven to 350 degrees. F. In a large baking pan, first spoon in a little sauce to just barely cover the bottom of the pan. Place a layer of eggplant slices side by side without touching each other.
Spoon a little sauce on each slice, and then sprinkle a little of each of the grated cheeses.
Choose another slice of equal size for each of the prepared eggplant slices in the pan, and cover each one with this second slice. Spoon some sauce on each of these slices, and then sprinkle with the remaining cheese.
Bake the eggplant until bubbly and lightly browned, about 35 to 40 minutes.