if "%1" == "--no-cygwin" goto nocygwin\r
if "%1" == "--cflags" goto usercflags\r
if "%1" == "--ldflags" goto userldflags\r
+if "%1" == "--without-png" goto withoutpng\r
if "%1" == "" goto checkutils\r
:usage\r
echo Usage: configure [options]\r
echo. --no-cygwin use -mno-cygwin option with GCC\r
echo. --cflags FLAG pass FLAG to compiler\r
echo. --ldflags FLAG pass FLAG to compiler when linking\r
+echo. --without-png do not use libpng even if it is installed \r
goto end\r
rem ----------------------------------------------------------------------\r
:setprefix\r
set sep2= %nothing%\r
shift\r
goto again\r
+rem ----------------------------------------------------------------------\r
+\r
+:withoutpng\r
+set pngsupport=N\r
+set HAVE_PNG=\r
+goto again\r
\r
rem ----------------------------------------------------------------------\r
rem Check that necessary utilities (cp and rm) are present.\r
rem ----------------------------------------------------------------------\r
rem Auto-detect compiler if not specified, and validate GCC if chosen.\r
:checkcompiler\r
-if (%COMPILER%)==(cl) goto genmakefiles\r
+if (%COMPILER%)==(cl) goto compilercheckdone\r
if (%COMPILER%)==(gcc) goto checkgcc\r
\r
echo Checking whether 'cl' is available...\r
set COMPILER=gcc\r
rm -f junk.c junk.o\r
echo Using 'gcc'\r
-goto genmakefiles\r
+goto compilercheckdone\r
\r
:clOk\r
set COMPILER=cl\r
rm -f junk.c junk.obj\r
echo Using 'MSVC'\r
-goto genmakefiles\r
+\r
+:compilercheckdone\r
+\r
+rem ----------------------------------------------------------------------\r
+rem Check for external image libraries. Since they are loaded\r
+rem dynamically, the libraries themselves do not need to be present\r
+rem at compile time, but the header files are required.\r
+\r
+if (%pngsupport%) == (N) goto pngDone\r
+\r
+echo Checking for libpng...\r
+echo #include "png.h" >junk.c\r
+echo main (){} >>junk.c\r
+rem -o option is ignored with cl, but allows result to be consistent.\r
+%COMPILER% %usercflags% -c junk.c -o junk.obj\r
+if exist junk.obj goto havePng\r
+\r
+echo ...building without PNG support.\r
+set HAVE_PNG=\r
+goto :pngDone\r
+\r
+:havePng\r
+echo ...PNG header available, building with PNG support.\r
+set HAVE_PNG=1\r
+\r
+:pngDone\r
+rm -f junk.c junk.obj\r
\r
rem ----------------------------------------------------------------------\r
:genmakefiles\r
echo. >>config.settings\r
\r
copy config.nt ..\src\config.h\r
+echo. >>..\src\config.h\r
+echo /* Start of settings from configure.bat. */ >>..\src\config.h\r
if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h\r
if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h\r
+if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>..\src\config.h\r
+echo /* End of settings from configure.bat. */ >>..\src\config.h\r
+\r
copy paths.h ..\src\epaths.h\r
\r
copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r