diff options
| author | Jason Rumney | 2003-01-25 20:50:48 +0000 |
|---|---|---|
| committer | Jason Rumney | 2003-01-25 20:50:48 +0000 |
| commit | e00065384265cb8b1068757d044b2ad565301d68 (patch) | |
| tree | 306963a395d06713ddd3f3504003d44e6ccab5f3 | |
| parent | c262430d1174625b0388f5be9a086dc8aedb4247 (diff) | |
| download | emacs-e00065384265cb8b1068757d044b2ad565301d68.tar.gz emacs-e00065384265cb8b1068757d044b2ad565301d68.zip | |
Automatically detect libpng.
| -rwxr-xr-x | nt/configure.bat | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/nt/configure.bat b/nt/configure.bat index 0525b53bd21..2aa477ca628 100755 --- a/nt/configure.bat +++ b/nt/configure.bat | |||
| @@ -85,6 +85,7 @@ if "%1" == "--no-opt" goto noopt | |||
| 85 | if "%1" == "--no-cygwin" goto nocygwin | 85 | if "%1" == "--no-cygwin" goto nocygwin |
| 86 | if "%1" == "--cflags" goto usercflags | 86 | if "%1" == "--cflags" goto usercflags |
| 87 | if "%1" == "--ldflags" goto userldflags | 87 | if "%1" == "--ldflags" goto userldflags |
| 88 | if "%1" == "--without-png" goto withoutpng | ||
| 88 | if "%1" == "" goto checkutils | 89 | if "%1" == "" goto checkutils |
| 89 | :usage | 90 | :usage |
| 90 | echo Usage: configure [options] | 91 | echo Usage: configure [options] |
| @@ -97,6 +98,7 @@ echo. --no-opt disable optimization | |||
| 97 | echo. --no-cygwin use -mno-cygwin option with GCC | 98 | echo. --no-cygwin use -mno-cygwin option with GCC |
| 98 | echo. --cflags FLAG pass FLAG to compiler | 99 | echo. --cflags FLAG pass FLAG to compiler |
| 99 | echo. --ldflags FLAG pass FLAG to compiler when linking | 100 | echo. --ldflags FLAG pass FLAG to compiler when linking |
| 101 | echo. --without-png do not use libpng even if it is installed | ||
| 100 | goto end | 102 | goto end |
| 101 | rem ---------------------------------------------------------------------- | 103 | rem ---------------------------------------------------------------------- |
| 102 | :setprefix | 104 | :setprefix |
| @@ -143,6 +145,12 @@ set userldflags=%userldflags%%sep2%%1 | |||
| 143 | set sep2= %nothing% | 145 | set sep2= %nothing% |
| 144 | shift | 146 | shift |
| 145 | goto again | 147 | goto again |
| 148 | rem ---------------------------------------------------------------------- | ||
| 149 | |||
| 150 | :withoutpng | ||
| 151 | set pngsupport=N | ||
| 152 | set HAVE_PNG= | ||
| 153 | goto again | ||
| 146 | 154 | ||
| 147 | rem ---------------------------------------------------------------------- | 155 | rem ---------------------------------------------------------------------- |
| 148 | rem Check that necessary utilities (cp and rm) are present. | 156 | rem Check that necessary utilities (cp and rm) are present. |
| @@ -165,7 +173,7 @@ goto end | |||
| 165 | rem ---------------------------------------------------------------------- | 173 | rem ---------------------------------------------------------------------- |
| 166 | rem Auto-detect compiler if not specified, and validate GCC if chosen. | 174 | rem Auto-detect compiler if not specified, and validate GCC if chosen. |
| 167 | :checkcompiler | 175 | :checkcompiler |
| 168 | if (%COMPILER%)==(cl) goto genmakefiles | 176 | if (%COMPILER%)==(cl) goto compilercheckdone |
| 169 | if (%COMPILER%)==(gcc) goto checkgcc | 177 | if (%COMPILER%)==(gcc) goto checkgcc |
| 170 | 178 | ||
| 171 | echo Checking whether 'cl' is available... | 179 | echo Checking whether 'cl' is available... |
| @@ -231,13 +239,39 @@ goto end | |||
| 231 | set COMPILER=gcc | 239 | set COMPILER=gcc |
| 232 | rm -f junk.c junk.o | 240 | rm -f junk.c junk.o |
| 233 | echo Using 'gcc' | 241 | echo Using 'gcc' |
| 234 | goto genmakefiles | 242 | goto compilercheckdone |
| 235 | 243 | ||
| 236 | :clOk | 244 | :clOk |
| 237 | set COMPILER=cl | 245 | set COMPILER=cl |
| 238 | rm -f junk.c junk.obj | 246 | rm -f junk.c junk.obj |
| 239 | echo Using 'MSVC' | 247 | echo Using 'MSVC' |
| 240 | goto genmakefiles | 248 | |
| 249 | :compilercheckdone | ||
| 250 | |||
| 251 | rem ---------------------------------------------------------------------- | ||
| 252 | rem Check for external image libraries. Since they are loaded | ||
| 253 | rem dynamically, the libraries themselves do not need to be present | ||
| 254 | rem at compile time, but the header files are required. | ||
| 255 | |||
| 256 | if (%pngsupport%) == (N) goto pngDone | ||
| 257 | |||
| 258 | echo Checking for libpng... | ||
| 259 | echo #include "png.h" >junk.c | ||
| 260 | echo main (){} >>junk.c | ||
| 261 | rem -o option is ignored with cl, but allows result to be consistent. | ||
| 262 | %COMPILER% %usercflags% -c junk.c -o junk.obj | ||
| 263 | if exist junk.obj goto havePng | ||
| 264 | |||
| 265 | echo ...building without PNG support. | ||
| 266 | set HAVE_PNG= | ||
| 267 | goto :pngDone | ||
| 268 | |||
| 269 | :havePng | ||
| 270 | echo ...PNG header available, building with PNG support. | ||
| 271 | set HAVE_PNG=1 | ||
| 272 | |||
| 273 | :pngDone | ||
| 274 | rm -f junk.c junk.obj | ||
| 241 | 275 | ||
| 242 | rem ---------------------------------------------------------------------- | 276 | rem ---------------------------------------------------------------------- |
| 243 | :genmakefiles | 277 | :genmakefiles |
| @@ -261,8 +295,13 @@ echo # End of settings from configure.bat>>config.settings | |||
| 261 | echo. >>config.settings | 295 | echo. >>config.settings |
| 262 | 296 | ||
| 263 | copy config.nt ..\src\config.h | 297 | copy config.nt ..\src\config.h |
| 298 | echo. >>..\src\config.h | ||
| 299 | echo /* Start of settings from configure.bat. */ >>..\src\config.h | ||
| 264 | if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h | 300 | if not "(%usercflags%)" == "()" echo #define USER_CFLAGS " %usercflags%">>..\src\config.h |
| 265 | if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h | 301 | if not "(%userldflags%)" == "()" echo #define USER_LDFLAGS " %userldflags%">>..\src\config.h |
| 302 | if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>..\src\config.h | ||
| 303 | echo /* End of settings from configure.bat. */ >>..\src\config.h | ||
| 304 | |||
| 266 | copy paths.h ..\src\epaths.h | 305 | copy paths.h ..\src\epaths.h |
| 267 | 306 | ||
| 268 | copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile | 307 | copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile |