@echo off
if %1.==C:. goto DRIVEOK
if %1.==c:. goto DRIVEOK
if %1.==D:. goto DRIVEOK
if %1.==d:. goto DRIVEOK
if %1.==E:. goto DRIVEOK
if %1.==e:. goto DRIVEOK
if %1.==F:. goto DRIVEOK
if %1.==f:. goto DRIVEOK
if %1.==G:. goto DRIVEOK
if %1.==g:. goto DRIVEOK
if %1.==H:. goto DRIVEOK
if %1.==h:. goto DRIVEOK
if %1.==I:. goto DRIVEOK
if %1.==i:. goto DRIVEOK
if %1.==J:. goto DRIVEOK
if %1.==j:. goto DRIVEOK
if %1.==K:. goto DRIVEOK
if %1.==k:. goto DRIVEOK
if %1.==L:. goto DRIVEOK
if %1.==l:. goto DRIVEOK
if %1.==M:. goto DRIVEOK
if %1.==m:. goto DRIVEOK
if %1.==N:. goto DRIVEOK
if %1.==n:. goto DRIVEOK
if %1.==O:. goto DRIVEOK
if %1.==o:. goto DRIVEOK
if %1.==P:. goto DRIVEOK
if %1.==p:. goto DRIVEOK
if %1.==Q:. goto DRIVEOK
if %1.==q:. goto DRIVEOK
if %1.==R:. goto DRIVEOK
if %1.==r:. goto DRIVEOK
if %1.==S:. goto DRIVEOK
if %1.==s:. goto DRIVEOK
if %1.==T:. goto DRIVEOK
if %1.==t:. goto DRIVEOK
if %1.==U:. goto DRIVEOK
if %1.==u:. goto DRIVEOK
if %1.==V:. goto DRIVEOK
if %1.==v:. goto DRIVEOK
if %1.==W:. goto DRIVEOK
if %1.==w:. goto DRIVEOK
if %1.==X:. goto DRIVEOK
if %1.==x:. goto DRIVEOK
if %1.==Y:. goto DRIVEOK
if %1.==y:. goto DRIVEOK
if %1.==Z:. goto DRIVEOK
if %1.==z:. goto DRIVEOK
goto USAGE
:DRIVEOK
if not exist %1\emx\bin\gcc.exe  goto NoGcc
if not exist %1\emx\bin\gnat1.exe  goto NoGnat1
%1
cd \emx\bin
if not exist \emx\temp mkdir \emx\temp
echo @ECHO OFF>%1\emx\bin\setgnat.cmd
echo PATH %1\EMX\BIN;%%PATH%%>>%1\emx\bin\setgnat.cmd
echo SET ADA_INCLUDE_PATH=%1\EMX\GNATLIB>>%1\emx\bin\setgnat.cmd
echo SET ADA_OBJECTS_PATH=%1\EMX\GNATLIB>>%1\emx\bin\setgnat.cmd
echo SET C_INCLUDE_PATH=%1/EMX/INCLUDE>>%1\emx\bin\setgnat.cmd
echo SET LIBRARY_PATH=%1/EMX/LIB>>%1\emx\bin\setgnat.cmd
echo SET EMXOPT=-c -n>>%1\emx\bin\setgnat.cmd
echo REM You may modify the following line if you want to specify a different>>%1\emx\bin\setgnat.cmd
echo REM directory in which you wish temporary files to be placed, or you may>>%1\emx\bin\setgnat.cmd
echo REM comment it out.>>%1\emx\bin\setgnat.cmd
echo SET TMP=%1\EMX\TEMP>>%1\emx\bin\setgnat.cmd
echo %1\emx\bin\setgnat.cmd created
call %1\emx\bin\setgnat
echo.
echo Finish GNAT installation by modifying the LIBPATH in config.sys
cd \emx
goto END
:USAGE
echo.
echo This batch file must be invoked as follows:
echo    fly-gnat x:
echo where x: is the HPFS partition on which GNAT being installed.
goto END
:NoGcc
echo.
echo The file %1\emx\bin\gcc.exe seems to be missing indicating that
echo either %1 is not the correct drive or you have not installed the 
echo required EMX09A zipfiles.
echo.
echo Unzip EMX09A-GNAT-OS2-BIN-DISK1.ZIP and EMX09-GNAT-OS2-BIN-DISK2.ZIP
echo (or EMX09A1.ZIP and EMX09A2.ZIP if obtained from a floppy distribution)
echo and then proceed to invoke fly-gnat again
goto END
:NoGnat1
echo.
echo The file %1\emx\bin\gnat1.exe seems to be missing indicating that
echo either %1 is not the correct drive or you have not installed the
echo required GNAT zipfiles.
echo.
echo Unzip GNAT-2.xx-OS2-BIN-DISK1.ZIP and GNAT-2.xx-OS2-BIN-DISK2.ZIP
echo (or GNAT1.ZIP and GNAT2.ZIP if obtained from a floppy distribution)
echo and then proceed to invoke fly-gnat again
:END

