2011-03-31 19:57:24 -04:00
|
|
|
@echo off
|
|
|
|
:: Copyright 2009,2011 Jason Moxham
|
|
|
|
::
|
|
|
|
:: This file is part of the MPIR Library.
|
|
|
|
::
|
|
|
|
:: The MPIR Library is free software; you can redistribute it and/or modify
|
|
|
|
:: it under the terms of the GNU Lesser General Public License as published
|
|
|
|
:: by the Free Software Foundation; either version 2.1 of the License, or (at
|
|
|
|
:: your option) any later version.
|
|
|
|
::
|
|
|
|
:: The MPIR Library is distributed in the hope that it will be useful, but
|
|
|
|
:: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
:: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
:: License for more details.
|
|
|
|
::
|
|
|
|
:: You should have received a copy of the GNU Lesser General Public License
|
|
|
|
:: along with the MPIR Library; see the file COPYING.LIB. If not, write
|
|
|
|
:: to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
:: Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
|
|
:: set default lib type as static
|
|
|
|
set LIBTYPE=lib
|
|
|
|
:: set default abi to ?
|
|
|
|
set ABI=?
|
|
|
|
:: set default cpu to ?
|
|
|
|
set CPU=?
|
|
|
|
|
|
|
|
:: parse params
|
|
|
|
:lp
|
|
|
|
shift
|
|
|
|
if "%0" == "" goto :exitlp
|
|
|
|
if "%0" == "--enable-shared" ( set LIBTYPE=dll)
|
|
|
|
if "%0" == "--enable-static" ( set LIBTYPE=lib)
|
|
|
|
if "%0" == "--disable-shared" ( set LIBTYPE=lib)
|
|
|
|
if "%0" == "--disable-static" ( set LIBTYPE=dll)
|
2011-04-02 04:38:55 -04:00
|
|
|
if "%0" == "ABI" (
|
|
|
|
shift
|
|
|
|
set ABI=%1
|
|
|
|
)
|
|
|
|
if "%0" == "--cpu" (
|
|
|
|
shift
|
|
|
|
set CPU=%1
|
|
|
|
)
|
2011-03-31 19:57:24 -04:00
|
|
|
goto :lp
|
|
|
|
:exitlp
|
|
|
|
|
|
|
|
:: ARCH is native ABI
|
|
|
|
set ARCH=64
|
|
|
|
if %PROCESSOR_ARCHITECTURE% == x86 ( set ARCH=32)
|
|
|
|
set VCTARGET=
|
|
|
|
if %ARCH% == 64 (
|
|
|
|
if %ABI% == 64 (set VCTARGET=amd64)
|
|
|
|
if %ABI% == 32 (set VCTARGET=x86_amd64)
|
|
|
|
)
|
|
|
|
if %ARCH% == 32 (
|
|
|
|
if %ABI% == 64 (set VCTARGET=amd64_x86)
|
|
|
|
if %ABI% == 32 (set VCTARGET=x86)
|
|
|
|
)
|
|
|
|
|
|
|
|
:: now we have to find a compiler that matches the required abi or default=?
|
|
|
|
copy ..\build.vc10\config.guess.c . > nul 2>&1
|
|
|
|
cl /nologo config.guess.c > nul 2>&1
|
|
|
|
if errorlevel 1 goto :step1
|
|
|
|
config.guess.exe print > config.guess.bat
|
|
|
|
call config.guess.bat
|
|
|
|
if %ABI% == ? goto :gotcc
|
|
|
|
if %GBITS% == %ABI% goto :gotcc
|
|
|
|
:step1
|
|
|
|
if exist "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" (
|
|
|
|
call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCTARGET%
|
2011-03-31 23:02:17 -04:00
|
|
|
goto :checkcc
|
2011-03-31 19:57:24 -04:00
|
|
|
)
|
|
|
|
if exist "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" (
|
|
|
|
call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCTARGET%
|
2011-03-31 23:02:17 -04:00
|
|
|
goto :checkcc
|
2011-03-31 19:57:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
:nocc
|
|
|
|
echo cant find a suitible compiler
|
|
|
|
exit /b 1
|
|
|
|
|
|
|
|
:checkcc
|
|
|
|
cl /nologo config.guess.c > nul 2>&1
|
|
|
|
if errorlevel 1 goto :nocc
|
|
|
|
config.guess.exe print > config.guess.bat
|
|
|
|
call config.guess.bat
|
|
|
|
if %ABI% == ? goto :gotcc
|
|
|
|
if %GBITS% == %ABI% goto :gotcc
|
|
|
|
goto :nocc
|
|
|
|
:gotcc
|
|
|
|
if %ABI% == ? ( set ABI=%GBITS%)
|
|
|
|
if %CPU% == ? ( set CPU=%GCPU%)
|
|
|
|
|
|
|
|
:: now find yasm , not needed for C build or? 32bit build?
|
|
|
|
if %CPU% == none goto :gotyasm
|
|
|
|
set YASMEXE=yasm.exe
|
|
|
|
yasm.exe --version > nul 2>&1
|
|
|
|
if not errorlevel 1 goto :gotyasm
|
|
|
|
set YASMEXE=vsyasm.exe
|
|
|
|
vsyasm.exe --version > nul 2>&1
|
|
|
|
if not errorlevel 1 goto :gotyasm
|
2011-04-02 05:45:22 -04:00
|
|
|
if exist "%YASMPATH%\yasm.exe" (
|
2011-03-31 23:16:04 -04:00
|
|
|
set YASMEXE="%YASMPATH%\yasm.exe"
|
|
|
|
goto :gotyasm
|
|
|
|
)
|
2011-04-02 05:45:22 -04:00
|
|
|
if exist "%YASMPATH%\vsyasm.exe" (
|
2011-03-31 23:16:04 -04:00
|
|
|
set YASMEXE="%YASMPATH%\vsyasm.exe"
|
2011-03-31 19:57:24 -04:00
|
|
|
goto :gotyasm
|
|
|
|
)
|
|
|
|
if exist "%VS100COMNTOOLS%\..\..\VC\bin\vsyasm.exe" (
|
2011-03-31 23:16:04 -04:00
|
|
|
set YASMEXE="%VS100COMNTOOLS%\..\..\VC\bin\vsyasm.exe"
|
2011-03-31 19:57:24 -04:00
|
|
|
goto :gotyasm
|
|
|
|
)
|
|
|
|
if exist "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\vsyasm.exe" (
|
2011-03-31 23:16:04 -04:00
|
|
|
set YASMEXE="c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\vsyasm.exe"
|
2011-03-31 19:57:24 -04:00
|
|
|
goto :gotyasm
|
|
|
|
)
|
2011-03-31 23:02:17 -04:00
|
|
|
if exist "%VS90COMNTOOLS%\..\..\VC\bin\yasm.exe" (
|
2011-03-31 23:16:04 -04:00
|
|
|
set YASMEXE="%VS90COMNTOOLS%\..\..\VC\bin\yasm.exe"
|
2011-03-31 19:57:24 -04:00
|
|
|
goto :gotyasm
|
|
|
|
)
|
|
|
|
echo cant find yasm
|
|
|
|
exit /b 1
|
|
|
|
:gotyasm
|
|
|
|
|
|
|
|
:: set config.params.bat to the settings needed by make etc
|
|
|
|
echo (set LIBTYPE=%LIBTYPE%) > config.params.bat
|
2011-04-02 05:27:06 -04:00
|
|
|
echo (set FLAGS=/Ox /Ot /D "NDEBUG" /D "HAVE_CONFIG_H" /nologo /D "_MBCS" /GS-) >> config.params.bat
|
2011-03-31 21:36:08 -04:00
|
|
|
if %LIBTYPE% == lib (set FLAGS1=/Oi /D "_LIB" /D "PIC" /MT)
|
2011-04-02 05:27:06 -04:00
|
|
|
if %LIBTYPE% == dll (set FLAGS1=/D "__GMP_LIBGMP_DLL" /D "__GMP_WITHIN_GMP" /D "__GMP_WITHIN_GMPXX" /D "_WINDLL" /GF /EHsc /MD)
|
2011-03-31 21:36:08 -04:00
|
|
|
echo (set FLAGS1=%FLAGS1%) >> config.params.bat
|
2011-03-31 22:27:32 -04:00
|
|
|
set MPNPATH=.
|
2011-03-31 19:57:24 -04:00
|
|
|
if %ABI% == 32 (
|
2011-04-09 07:34:10 -04:00
|
|
|
if %CPU% == x86 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == i386 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == i486 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == i586 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == pentium (set MPNPATH=x86w)
|
|
|
|
if %CPU% == pentiummmx (set MPNPATH=x86w)
|
|
|
|
if %CPU% == pentiumpro (set MPNPATH=x86w x86w\p6)
|
|
|
|
if %CPU% == i686 (set MPNPATH=x86w x86w\p6)
|
|
|
|
if %CPU% == pentium2 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx)
|
|
|
|
if %CPU% == pentium3 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == k6 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == k62 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == k63 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == k7 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == athlon (set MPNPATH=x86w)
|
|
|
|
if %CPU% == pentium4 (set MPNPATH=x86w x86w\pentium4 x86w\pentium4\mmx x86w\pentium4\sse2)
|
|
|
|
if %CPU% == prescott (set MPNPATH=x86w x86w\pentium4 x86w\pentium4\mmx x86w\pentium4\sse2)
|
|
|
|
if %CPU% == core (set MPNPATH=x86w x86w\pentium4 x86w\pentium4\mmx x86w\pentium4\sse2)
|
|
|
|
if %CPU% == viac3 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == viac32 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == x86_64 (set MPNPATH=x86w)
|
|
|
|
if %CPU% == netburst (set MPNPATH=x86w x86w\pentium4 x86w\pentium4\mmx x86w\pentium4\sse2)
|
|
|
|
if %CPU% == netburstlahf (set MPNPATH=x86w x86w\pentium4 x86w\pentium4\mmx x86w\pentium4\sse2)
|
|
|
|
if %CPU% == k8 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == k10 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == k102 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == k103 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
2011-04-27 06:45:57 -04:00
|
|
|
if %CPU% == bulldozer (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
2011-04-09 07:34:10 -04:00
|
|
|
if %CPU% == bobcat (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == core2 (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == penryn (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == nehalem (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == westmere (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == sandybridge (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == atom (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
|
|
|
if %CPU% == nano (set MPNPATH=x86w x86w\p6 x86w\p6\mmx x86w\p6\p3mmx)
|
2011-03-31 19:57:24 -04:00
|
|
|
)
|
|
|
|
if %ABI% == 64 (
|
2011-04-01 05:43:00 -04:00
|
|
|
if %CPU% == x86_64 (set MPNPATH=x86_64w)
|
|
|
|
if %CPU% == netburst (set MPNPATH=x86_64w x86_64w\netburst)
|
2011-04-03 11:59:49 -04:00
|
|
|
if %CPU% == netburstlahf (set MPNPATH=x86_64w x86_64w\netburst)
|
2011-04-01 05:43:00 -04:00
|
|
|
if %CPU% == k8 (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k8only)
|
|
|
|
if %CPU% == k10 (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k10)
|
|
|
|
if %CPU% == k102 (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k10 x86_64w\k8\k10\k102)
|
2011-04-03 11:22:36 -04:00
|
|
|
if %CPU% == k103 (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k10 x86_64w\k8\k10\k102)
|
2011-04-27 06:45:57 -04:00
|
|
|
if %CPU% == bulldozer (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k10 x86_64w\k8\k10\k102)
|
2011-04-01 05:43:00 -04:00
|
|
|
if %CPU% == bobcat (set MPNPATH=x86_64w x86_64w\bobcat)
|
|
|
|
if %CPU% == core2 (set MPNPATH=x86_64w x86_64w\core2)
|
|
|
|
if %CPU% == penryn (set MPNPATH=x86_64w x86_64w\core2 x86_64w\core2\penryn)
|
|
|
|
if %CPU% == nehalem (set MPNPATH=x86_64w x86_64w\nehalem)
|
|
|
|
if %CPU% == westmere (set MPNPATH=x86_64w x86_64w\nehalem x86_64w\nehalem\westmere)
|
2011-04-26 17:18:12 -04:00
|
|
|
if %CPU% == sandybridge (set MPNPATH=x86_64w x86_64w\sandybridge)
|
2011-04-01 05:43:00 -04:00
|
|
|
if %CPU% == atom (set MPNPATH=x86_64w x86_64w\atom)
|
2011-04-03 11:54:22 -04:00
|
|
|
if %CPU% == nano (set MPNPATH=x86_64w x86_64w\k8 x86_64w\k8\k8only)
|
2011-03-31 19:57:24 -04:00
|
|
|
)
|
|
|
|
echo (set MPNPATH=%MPNPATH%) >> config.params.bat
|
|
|
|
echo (set ABI=%ABI%) >> config.params.bat
|
|
|
|
echo setting params to
|
|
|
|
type config.params.bat
|
|
|
|
exit /b 0
|