automake subdir-object mode needs check for -c -o

Older automake versions (at least 1.13.1) will complain if we asked for subdir
mode and we did not verify that both -c and -o flags work (AM_PROG_CC_C_O)

(cherry picked from commit a0123726981888d8fd6697c5ab7671f8fc9057dc)