Firefighters in California on Saturday were struggling to contain a giant blaze that threatened thousands of homes and was sweeping into the storied Yosemite National Park.