diff --git a/configure b/configure
index 5deb69ea0d2c4fc6030faae36516359131d6f264..d165e68dfff778cd2de9ebb5da30ac1cb21283a3 100755
--- a/configure
+++ b/configure
@@ -3499,6 +3499,7 @@ check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
 
 check_func  fcntl
 check_func  fork
+check_func_headers stdlib.h getenv
 check_func  gethrtime
 check_func  getopt
 check_func  getrusage
@@ -4086,6 +4087,8 @@ if enabled yasm; then
     printf '' >$TMPASM
 fi
 
+enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
+
 if enabled msvc && ! enabled shared; then
     echo '#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")' >> $TMPH
     echo '#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")' >> $TMPH