Instead of checking manually, please do something like this:

```perl
check_lib "fcgi", <<C;
    #include <fcgiapp.h>

    int main() {
        FCGX_IsCGI();
    }
C
```

This will make sure the CGI SAPI won't be compiled if libfcgi isn't installed.