rem For reference, here is a list of which builds of gmake are known to\r
rem work or not, and whether they work in the presence and/or absence of\r
rem sh.exe.\r
-rem \r
+rem\r
rem sh exists no sh\r
rem cygwin b20.1 make (3.75): okay[1] fails[2]\r
rem MSVC compiled gmake 3.77: okay okay\r
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" == "--without-jpeg" goto withoutjpeg\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
+echo. --without-jpeg do not use jpeglib 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
+shift\r
+goto again\r
+\r
+rem ----------------------------------------------------------------------\r
+\r
+:withoutjpeg\r
+set jpegsupport=N\r
+set HAVE_JPEG=\r
+shift\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
del junk.o\r
\r
:checkgcc\r
-if (%nocygwin%) == (Y) goto checkw32api\r
+Rem WARNING -- COMMAND.COM on some systems only looks at the first\r
+Rem 8 characters of a label. So do NOT be tempted to change\r
+Rem chkapi* into something fancier like checkw32api\r
+Rem You HAVE been warned!\r
+if (%nocygwin%) == (Y) goto chkapi\r
echo Checking whether gcc requires '-mno-cygwin'...\r
echo #include "cygwin/version.h" >junk.c\r
echo main(){} >>junk.c\r
gcc -c junk.c\r
-if not exist junk.o goto checkw32api\r
+if not exist junk.o goto chkapi\r
gcc -mno-cygwin -c junk.c\r
if exist junk.o set nocygwin=Y\r
rm -f junk.c junk.o\r
\r
-:checkw32api\r
+:chkapi\r
rem ----------------------------------------------------------------------\r
rem Older versions of the Windows API headers either don't have any of\r
rem the IMAGE_xxx definitions (the headers that come with Cygwin b20.1\r
echo #include "windows.h" >junk.c\r
echo test(PIMAGE_NT_HEADERS pHeader) >>junk.c\r
echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c\r
-if (%nocygwin%) == (Y) goto checkw32api1\r
+if (%nocygwin%) == (Y) goto chkapi1\r
set cf=%usercflags%\r
-goto checkw32api2\r
-:checkw32api1\r
+goto chkapi2\r
+:chkapi1\r
set cf=%usercflags% -mno-cygwin\r
-:checkw32api2\r
+:chkapi2\r
echo on\r
gcc %cf% -c junk.c\r
echo off\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
+if (%jpegsupport%) == (N) goto jpegDone\r
+\r
+echo Checking for jpeg ...\r
+echo #include "jconfig.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 haveJpeg\r
+\r
+echo ...building without JPEG support.\r
+set HAVE_JPEG=\r
+goto :jpegDone\r
+\r
+:haveJpeg\r
+echo ...JPEG header available, building with JPEG support.\r
+set HAVE_JPEG=1\r
+\r
+:jpegDone\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
+if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 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
if not exist ..\leim\makefile.w32-in copy /b config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile\r
del config.settings\r
\r
+Rem Some people use WinZip which doesn't create empty directories!\r
+if not exist ..\site-lisp\nul mkdir ..\site-lisp\\r
+if not exist ..\site-lisp\subdirs.el copy subdirs.el ..\site-lisp\subdirs.el\r
+\r
echo.\r
echo Emacs successfully configured.\r
echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.\r