forked from bitcoin-core/secp256k1
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d992fdf
commit e2d3029
Showing
2 changed files
with
73 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# | ||
# Copyright (c) 2017 Bitprim developers (see AUTHORS) | ||
# | ||
# This file is part of Bitprim. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program 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 Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
|
||
function(_check_has_64bit_asm) | ||
if (DEFINED HAS_64BIT_ASM) | ||
return() | ||
endif() | ||
|
||
set(_filename "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/_has_64bit_asm.c") | ||
file(WRITE ${_filename} | ||
"#include <stdint.h> | ||
int main() { | ||
uint64_t a = 11, tmp; | ||
__asm__ __volatile__(\"movq 0x100000000,%1; mulq %%rsi\" : \"+a\"(a) : \"S\"(tmp) : \"cc\", \"%rdx\"); | ||
}") | ||
try_compile(HAS_64BIT_ASM "${CMAKE_BINARY_DIR}" ${_filename}) | ||
set(HAS_64BIT_ASM ${HAS_64BIT_ASM} PARENT_SCOPE) | ||
file(REMOVE ${_filename}) | ||
endfunction() | ||
|
||
function(_check_has_int128) | ||
if (DEFINED HAS_INT128) | ||
return() | ||
endif() | ||
|
||
set(_filename "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/_has_int128_test.c") | ||
file(WRITE ${_filename} | ||
"int main() { __int128 x = 0; }") | ||
try_compile(HAS_INT128 "${CMAKE_BINARY_DIR}" ${_filename}) | ||
set(HAS_INT128 ${HAS_INT128} PARENT_SCOPE) | ||
file(REMOVE ${_filename}) | ||
endfunction() | ||
|
||
function(_check_has_gmp) | ||
if (DEFINED HAS_GMP) | ||
return() | ||
endif() | ||
|
||
find_package(GMP) | ||
set(HAS_GMP ${GMP_FOUND} PARENT_SCOPE) | ||
endfunction() | ||
|