FFmpeg during the configure stage generates a config.h file with
```
#define HAVE_UNISTD_H 0
```
on windows. Then somewhere in FFmpeg's code there is:
```
#include "config.h" // FFmpeg's config.h
#include <zlib.h>
```
which causes zlib.h to include unistd.h on windows. It is way easier to handle the issue here than in FFmpeg.
Co-authored-by: Mika Lindqvist <postmaster@raasu.org>
if(HAVE_UNISTD_H)
SET(ZCONF_UNISTD_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */")
else()
- SET(ZCONF_UNISTD_LINE "#ifdef HAVE_UNISTD_H /* may be set to #if 1 by configure/cmake/etc */")
+ SET(ZCONF_UNISTD_LINE "#if 0 /* was set to #if 0 by configure/cmake/etc */")
endif()
if(NEED_PTRDIFF_T)
SET(ZCONF_PTRDIFF_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */")
mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
echo "Checking for unistd.h... Yes." | tee -a configure.log
else
+ sed < zconf${SUFFIX}.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be set to #if 1/ 0\1 was set to #if 0/" > zconf${SUFFIX}.temp.h
+ mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h
echo "Checking for unistd.h... No." | tee -a configure.log
fi