diff --git a/rin/miner/build-windows.md b/rin/miner/build-windows.md new file mode 100644 index 0000000..78cc602 --- /dev/null +++ b/rin/miner/build-windows.md @@ -0,0 +1,38 @@ +# Building cpuminer-opt-rinhash on Windows + +## Prerequisites + +1. Install MSYS2 from https://www.msys2.org/ +2. Open MSYS2 terminal and install build dependencies: + +```bash +# Update package database +pacman -Syu + +# Install build tools and dependencies +pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-curl mingw-w64-x86_64-jansson mingw-w64-x86_64-openssl mingw-w64-x86_64-gmp mingw-w64-x86_64-zlib mingw-w64-x86_64-autotools mingw-w64-x86_64-pkg-config +``` + +## Build Process + +1. Open MSYS2 MinGW 64-bit terminal (not the regular MSYS2 terminal) +2. Navigate to the cpuminer directory +3. Run the build commands: + +```bash +cd /f/projects/mines/rin/miner/cpuminer +./autogen.sh +./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer" +make -j$(nproc) +``` + +## Alternative: Use Pre-built Binary + +Since the repository already contains Windows DLLs and object files, you might be able to complete the build with just the linking step. + +## Test the Miner + +Once built, test with: +```bash +./cpuminer.exe -a rinhash -o stratum+tcp://your-pool:port -u your-username -p x -t 4 +``` \ No newline at end of file diff --git a/rin/miner/cpuminer/.gitattributes b/rin/miner/cpuminer/.gitattributes new file mode 100644 index 0000000..eba1110 --- /dev/null +++ b/rin/miner/cpuminer/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto \ No newline at end of file diff --git a/rin/miner/cpuminer/.gitignore b/rin/miner/cpuminer/.gitignore new file mode 100644 index 0000000..52c4827 --- /dev/null +++ b/rin/miner/cpuminer/.gitignore @@ -0,0 +1,52 @@ +minerd* +cpuminer +*.exe +*.o +*.d +gmon.out + +autom4te.cache +.deps + +Makefile +Makefile.in +INSTALL +configure.lineno +depcomp +missing +install-sh +stamp-h1 +cpuminer-config.h* +compile +config.log +config.status +config.status.lineno +config.guess +config.sub + +mingw32-config.cache + +*/.dirstamp +*/*/.dirstamp +*/*/*/.dirstamp +*.iml + +*.vcxproj.user +*.opensdf +*.sdf +*.suo +Release/ +Debug/ +x64/Release/ +x64/Debug/ +*.pdb/ + +installer/ +res/cpuminer.aps +res/RC* +sign/ +sign.sh + +compat/curl-for-windows/ + +.vscode/ diff --git a/rin/miner/cpuminer/.travis.yml b/rin/miner/cpuminer/.travis.yml new file mode 100644 index 0000000..1f9f349 --- /dev/null +++ b/rin/miner/cpuminer/.travis.yml @@ -0,0 +1,16 @@ +language: c + +compiler: + - gcc + +before_install: + - sudo apt-get update -qq + - sudo apt-get install libcurl4-openssl-dev + +before_script: + - ./autogen.sh + +script: + - ./configure --with-crypto --with-curl + - make + - ./cpuminer --cputest diff --git a/rin/miner/cpuminer/AUTHORS b/rin/miner/cpuminer/AUTHORS new file mode 100644 index 0000000..1f807b5 --- /dev/null +++ b/rin/miner/cpuminer/AUTHORS @@ -0,0 +1,38 @@ +Jeff Garzik + +ArtForz + +pooler + +BlueDragon747 + +1gh + +Neisklar + +prettyhatemachine + +LucasJones + +tpruvot@github + +elmad + +djm34 + +palmd + +ig0tik3d + +Wolf0 + +Optiminer + +Jay D Dee + +xcouiz@gmail.com + +Cryply + +Colin Percival +Alexander Peslyak diff --git a/rin/miner/cpuminer/COPYING b/rin/miner/cpuminer/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/rin/miner/cpuminer/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/rin/miner/cpuminer/ChangeLog b/rin/miner/cpuminer/ChangeLog new file mode 100644 index 0000000..326703b --- /dev/null +++ b/rin/miner/cpuminer/ChangeLog @@ -0,0 +1 @@ +See git repository ('git log') for full changelog. diff --git a/rin/miner/cpuminer/Dockerfile b/rin/miner/cpuminer/Dockerfile new file mode 100644 index 0000000..c191bd3 --- /dev/null +++ b/rin/miner/cpuminer/Dockerfile @@ -0,0 +1,35 @@ +# +# Dockerfile for cpuminer-opt +# usage: docker build -t cpuminer-opt:latest . +# run: docker run -it --rm cpuminer-opt:latest [ARGS] +# ex: docker run -it --rm cpuminer-opt:latest -a cryptonight -o cryptonight.eu.nicehash.com:3355 -u 1MiningDW2GKzf4VQfmp4q2XoUvR6iy6PD.worker1 -p x -t 3 +# + +# Build +FROM ubuntu:16.04 as builder + +RUN apt-get update \ + && apt-get install -y \ + build-essential \ + libssl-dev \ + libgmp-dev \ + libcurl4-openssl-dev \ + libjansson-dev \ + automake \ + && rm -rf /var/lib/apt/lists/* + +COPY . /app/ +RUN cd /app/ && ./build.sh + +# App +FROM ubuntu:16.04 + +RUN apt-get update \ + && apt-get install -y \ + libcurl3 \ + libjansson4 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/cpuminer . +ENTRYPOINT ["./cpuminer"] +CMD ["-h"] diff --git a/rin/miner/cpuminer/INSTALL_LINUX b/rin/miner/cpuminer/INSTALL_LINUX new file mode 100644 index 0000000..be9173b --- /dev/null +++ b/rin/miner/cpuminer/INSTALL_LINUX @@ -0,0 +1,164 @@ + +These instructions may be out of date, see the Wiki for the latest... +https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source + +1. Requirements: +--------------- + +Intel Core2 or newer, or AMD Steamroller or newer CPU. ARM CPUs are not +supported. +64 bit Linux operating system. Apple is not supported. + +2. Building on linux prerequisites: +----------------------------------- + +It is assumed users know how to install packages on their system and +be able to compile standard source packages. This is basic Linux and +beyond the scope of cpuminer-opt. Regardless compiling is trivial if you +follow the instructions. + +Make sure you have the basic development packages installed. +Here is a good start: + +http://askubuntu.com/questions/457526/how-to-install-cpuminer-in-ubuntu + +Install any additional dependencies needed by cpuminer-opt. The list below +are some of the ones that may not be in the default install and need to +be installed manually. There may be others, read the compiler error messages, +they will give a clue as to the missing package. + +The following command should install everything you need on Debian based +distributions such as Ubuntu. Fedora and other distributions may have similar +but different package names. + +$ sudo apt-get install build-essential automake libssl-dev libcurl4-openssl-dev libjansson-dev libgmp-dev zlib1g-dev git + +SHA support on AMD Ryzen CPUs requires gcc version 5 or higher and +openssl 1.1.0e or higher. + +znver1 and znver2 should be recognized on most recent version of GCC and +znver3 is available with GCC 11. GCC 11 also includes rocketlake support. +In the meantime here are some suggestions to compile with new CPUs: + +"-march=native" is usually the best choice, used by build.sh. + +"-march=znver2 -mvaes" can be used for Ryzen 5000 if znver3 is not recongized. + +"-mcascadelake -msha" or +"-mcometlake -mavx512 -msha" can be used for Rocket Lake. + +Features can also be added individually: + +"-msha" adds support for HW accelerated sha256. + +"-mavx512" adds support for 512 bit vectors + +"-mvaes" add support for parallel AES + +Additional instructions for static compilalation can be found here: +https://lxadm.com/Static_compilation_of_cpuminer +Static builds should only considered in a homogeneous HW and SW environment. +Local builds will always have the best performance and compatibility. + +3. Download cpuminer-opt +------------------------ + +Download the source code for the latest realease from the official repository. + +https://github.com/JayDDee/cpuminer-opt/releases + +Extract the source code. + +$ tar xvzf cpuminer-opt-x.y.z.tar.gz + + +Alternatively it can be cloned from git. + +$ git clone https://github.com/JayDDee/cpuminer-opt.git + +4. Build cpuminer-opt +--------------------- + +It is recomended to Build with default options, this will usuallly +produce the best results. + +$ ./build.sh to build on Linux or execute the following commands. + +or + +$ ./autogen.sh +$ CFLAGS="-O3 -march=native -Wall" ./configure --with-curl +$ make -j n + +n is the number of threads. + +5. Start mining. +---------------- + +$ ./cpuminer -a algo -o url -u username -p password + + +Windows +------- + +See also INSTAL_WINDOWS + +The following procedure is obsolete and uses an old compiler. + +Precompiled Windows binaries are built on a Linux host using Mingw +with a more recent compiler than the following Windows hosted procedure. + +Building on Windows prerequisites: + +msys +mingw_w64 +Visual C++ redistributable 2008 X64 +openssl + +Install msys and mingw_w64, only needed once. + +Unpack msys into C:\msys or your preferred directory. + +Install mingw_w64 from win-builds. +Follow instructions, check "msys or cygwin" and "x86_64" and accept default +existing msys instalation. + +Open a msys shell by double clicking on msys.bat. +Note that msys shell uses linux syntax for file specifications, "C:\" is +mounted at "/c/". + +Add mingw bin directory to PATH variable +PATH="/c/msys/opt/windows_64/bin/:$PATH" + +Instalation complete, compile cpuminer-opt. + +Unpack cpuminer-opt source files using tar from msys shell, or using 7zip +or similar Windows program. + +In msys shell cd to miner directory. +cd /c/path/to/cpuminer-opt + +Run build.sh to build on Windows or execute the following commands. + +./autogen.sh +CFLAGS="-O3 -march=native -Wall" ./configure --with-curl +make + +Start mining + +cpuminer.exe -a algo -o url -u user -p password + +The following tips may be useful for older AMD CPUs. + +AMD CPUs older than Steamroller, including Athlon x2 and Phenom II x4, are +not supported by cpuminer-opt due to an incompatible implementation of SSE2 +on these CPUs. Some algos may crash the miner with an invalid instruction. +Users are recommended to use an unoptimized miner such as cpuminer-multi. + +Some users with AMD CPUs without AES_NI have reported problems compiling +with build.sh or "-march=native". Problems have included compile errors +and poor performance. These users are recommended to compile manually +specifying "-march=btver1" on the configure command line. + +Support for even older x86_64 without AES_NI or SSE2 is not availble. + diff --git a/rin/miner/cpuminer/INSTALL_WINDOWS b/rin/miner/cpuminer/INSTALL_WINDOWS new file mode 100644 index 0000000..dc169ac --- /dev/null +++ b/rin/miner/cpuminer/INSTALL_WINDOWS @@ -0,0 +1,4 @@ +Please consult the wiki for Windows compile instructions. + +https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source + diff --git a/rin/miner/cpuminer/LICENSE b/rin/miner/cpuminer/LICENSE new file mode 100644 index 0000000..c43e8b0 --- /dev/null +++ b/rin/miner/cpuminer/LICENSE @@ -0,0 +1,3 @@ +cpuminer is available under the terms of the GNU Public License version 2. + +See COPYING for details. diff --git a/rin/miner/cpuminer/Makefile.am b/rin/miner/cpuminer/Makefile.am new file mode 100644 index 0000000..b15fc6a --- /dev/null +++ b/rin/miner/cpuminer/Makefile.am @@ -0,0 +1,343 @@ + +if HAVE_APPLE +# MacOS uses Homebrew to install needed packages but they aren't linked for +# the jansson test in configure. Ignore the failed test & link them now, +# different path for different CPU arch. + +if ARCH_ARM64 + EXTRA_INCLUDES = -I/opt/homebrew/include + EXTRA_LIBS = -L/opt/homebrew/lib +else + EXTRA_INCLUDES = -I/usr/local/include + EXTRA_LIBS = -L/usr/local/lib +endif + +else + +if WANT_JANSSON +# Can't find jansson libraries, compile the included source code. + EXTRA_INCLUDES = -I$(top_srcdir)/compat/jansson + EXTRA_LIBS = -L$(top_srcdir)/compat/jansson +else + EXTRA_INCLUDES = + EXTRA_LIBS = +endif + +endif + +EXTRA_DIST = example-cfg.json nomacro.pl + +SUBDIRS = compat + +ALL_INCLUDES = @PTHREAD_FLAGS@ -fno-strict-aliasing $(EXTRA_INCLUDES) -I. + +bin_PROGRAMS = cpuminer + +dist_man_MANS = cpuminer.1 + +cpuminer_SOURCES = \ + dummy.cpp \ + cpu-miner.c \ + util.c \ + api.c \ + sysinfos.c \ + algo-gate-api.c\ + malloc-huge.c \ + algo/argon2d/argon2d-gate.c \ + algo/argon2d/blake2/blake2b.c \ + algo/argon2d/argon2d/argon2.c \ + algo/argon2d/argon2d/core.c \ + algo/argon2d/argon2d/opt.c \ + algo/argon2d/argon2d/argon2d_thread.c \ + algo/argon2d/argon2d/encoding.c \ + algo/blake/sph_blake.c \ + algo/blake/blake256-hash.c \ + algo/blake/blake512-hash.c \ + algo/blake/blake-gate.c \ + algo/blake/blake.c \ + algo/blake/blake-4way.c \ + algo/blake/sph_blake2b.c \ + algo/blake/sph-blake2s.c \ + algo/blake/blake2s-hash.c \ + algo/blake/blake2s.c \ + algo/blake/blake2b-hash.c \ + algo/blake/blake2b.c \ + algo/blake/blakecoin-gate.c \ + algo/blake/mod_blakecoin.c \ + algo/blake/blakecoin.c \ + algo/blake/blakecoin-4way.c \ + algo/blake/pentablake-gate.c \ + algo/blake/pentablake-4way.c \ + algo/blake/pentablake.c \ + algo/bmw/sph_bmw.c \ + algo/bmw/bmw256-hash-4way.c \ + algo/bmw/bmw512-hash-4way.c \ + algo/bmw/bmw256.c \ + algo/bmw/bmw512-gate.c \ + algo/bmw/bmw512.c \ + algo/bmw/bmw512-4way.c \ + algo/cubehash/cubehash_sse2.c\ + algo/cubehash/cube-hash-2way.c \ + algo/cubehash/sph_cubehash.c \ + algo/echo/sph_echo.c \ + algo/echo/echo-hash-4way.c \ + algo/echo/aes_ni/hash.c\ + algo/gost/sph_gost.c \ + algo/groestl/groestl-gate.c \ + algo/groestl/groestl512-hash-4way.c \ + algo/groestl/groestl256-hash-4way.c \ + algo/groestl/sph_groestl.c \ + algo/groestl/groestl.c \ + algo/groestl/groestl-4way.c \ + algo/groestl/myrgr-gate.c \ + algo/groestl/myrgr-4way.c \ + algo/groestl/myr-groestl.c \ + algo/groestl/aes_ni/hash-groestl.c \ + algo/groestl/aes_ni/hash-groestl256.c \ + algo/fugue/sph_fugue.c \ + algo/fugue/fugue-aesni.c \ + algo/hamsi/sph_hamsi.c \ + algo/hamsi/hamsi-hash-4way.c \ + algo/haval/haval.c \ + algo/haval/haval-hash-4way.c \ + algo/jh/sph_jh.c \ + algo/jh/jh-hash-4way.c \ + algo/jh/jha-gate.c \ + algo/jh/jha-4way.c \ + algo/jh/jha.c \ + algo/keccak/sph_keccak.c \ + algo/keccak/keccak.c\ + algo/keccak/keccak-hash-4way.c \ + algo/keccak/keccak-4way.c\ + algo/keccak/keccak-gate.c \ + algo/keccak/sha3d-4way.c \ + algo/keccak/sha3d.c \ + algo/lanehash/lane.c \ + algo/luffa/luffa_for_sse2.c \ + algo/luffa/luffa-hash-2way.c \ + algo/luffa/sph_luffa.c \ + algo/lyra2/lyra2.c \ + algo/lyra2/sponge.c \ + algo/lyra2/sponge-2way.c \ + algo/lyra2/lyra2-hash-2way.c \ + algo/lyra2/lyra2-gate.c \ + algo/lyra2/lyra2rev2.c \ + algo/lyra2/lyra2rev2-4way.c \ + algo/lyra2/lyra2rev3.c \ + algo/lyra2/lyra2rev3-4way.c \ + algo/lyra2/lyra2re.c \ + algo/lyra2/lyra2z-4way.c \ + algo/lyra2/lyra2z330.c \ + algo/lyra2/lyra2h.c \ + algo/lyra2/lyra2h-4way.c \ + algo/lyra2/allium-4way.c \ + algo/lyra2/phi2-4way.c \ + algo/lyra2/phi2.c \ + algo/m7m/m7m.c \ + algo/nist5/nist5-gate.c \ + algo/nist5/nist5-4way.c \ + algo/nist5/nist5.c \ + algo/nist5/zr5.c \ + algo/panama/panama-hash-4way.c \ + algo/panama/sph_panama.c \ + algo/quark/quark-gate.c \ + algo/quark/quark.c \ + algo/quark/quark-4way.c \ + algo/quark/anime-gate.c \ + algo/quark/anime.c \ + algo/quark/anime-4way.c \ + algo/quark/hmq1725-gate.c \ + algo/quark/hmq1725-4way.c \ + algo/quark/hmq1725.c \ + algo/qubit/qubit-gate.c \ + algo/qubit/qubit.c \ + algo/qubit/qubit-2way.c \ + algo/qubit/deep-gate.c \ + algo/qubit/deep-2way.c \ + algo/qubit/deep.c \ + algo/ripemd/sph_ripemd.c \ + algo/ripemd/ripemd-hash-4way.c \ + algo/ripemd/lbry-gate.c \ + algo/ripemd/lbry.c \ + algo/ripemd/lbry-4way.c \ + algo/scrypt/scrypt.c \ + algo/scrypt/scrypt-core-4way.c \ + algo/scrypt/neoscrypt.c \ + algo/sha/sha1.c \ + algo/sha/sha1-hash.c \ + algo/sha/sha256-hash.c \ + algo/sha/sph_sha2.c \ + algo/sha/sph_sha2big.c \ + algo/sha/sha256-hash-4way.c \ + algo/sha/sha512-hash-4way.c \ + algo/sha/hmac-sha256-hash.c \ + algo/sha/hmac-sha256-hash-4way.c \ + algo/sha/sha256d.c \ + algo/sha/sha256d-4way.c \ + algo/sha/sha256t-gate.c \ + algo/sha/sha256t-4way.c \ + algo/sha/sha256q-4way.c \ + algo/sha/sha256q.c \ + algo/sha/sha512256d-4way.c \ + algo/sha/sha256dt.c \ + algo/shabal/sph_shabal.c \ + algo/shabal/shabal-hash-4way.c \ + algo/shavite/sph_shavite.c \ + algo/shavite/sph-shavite-aesni.c \ + algo/shavite/shavite-hash-2way.c \ + algo/shavite/shavite-hash-4way.c \ + algo/simd/sph_simd.c \ + algo/simd/simd-hash-2way.c \ + algo/skein/sph_skein.c \ + algo/skein/skein-hash-4way.c \ + algo/skein/skein.c \ + algo/skein/skein-4way.c \ + algo/skein/skein-gate.c \ + algo/skein/skein2.c \ + algo/skein/skein2-4way.c \ + algo/sm3/sm3.c \ + algo/sm3/sm3-hash-4way.c \ + algo/swifftx/swifftx.c \ + algo/tiger/sph_tiger.c \ + algo/verthash/verthash-gate.c \ + algo/verthash/Verthash.c \ + algo/verthash/fopen_utf8.c \ + algo/verthash/tiny_sha3/sha3.c \ + algo/verthash/tiny_sha3/sha3-4way.c \ + algo/whirlpool/sph_whirlpool.c \ + algo/whirlpool/whirlpool-gate.c \ + algo/whirlpool/whirlpool.c \ + algo/whirlpool/whirlpoolx.c \ + algo/x11/x11-gate.c \ + algo/x11/x11.c \ + algo/x11/x11-4way.c \ + algo/x11/x11gost-gate.c \ + algo/x11/x11gost.c \ + algo/x11/x11gost-4way.c \ + algo/x11/c11-gate.c \ + algo/x11/c11.c \ + algo/x11/c11-4way.c \ + algo/x11/tribus-gate.c \ + algo/x11/tribus.c \ + algo/x11/tribus-4way.c \ + algo/x11/timetravel-gate.c \ + algo/x11/timetravel.c \ + algo/x11/timetravel-4way.c \ + algo/x11/timetravel10-gate.c \ + algo/x11/timetravel10.c \ + algo/x11/timetravel10-4way.c \ + algo/x11/x11evo.c \ + algo/x11/x11evo-4way.c \ + algo/x11/x11evo-gate.c \ + algo/x12/x12-gate.c \ + algo/x12/x12.c \ + algo/x12/x12-4way.c \ + algo/x13/x13-gate.c \ + algo/x13/x13.c \ + algo/x13/x13-4way.c \ + algo/x13/x13sm3-gate.c \ + algo/x13/x13sm3.c \ + algo/x13/x13sm3-4way.c \ + algo/x13/phi1612-gate.c \ + algo/x13/phi1612.c \ + algo/x13/phi1612-4way.c \ + algo/x13/skunk-gate.c \ + algo/x13/skunk-4way.c \ + algo/x13/skunk.c \ + algo/x13/x13bcd-4way.c \ + algo/x13/x13bcd.c \ + algo/x14/x14-gate.c \ + algo/x14/x14.c \ + algo/x14/x14-4way.c \ + algo/x14/veltor-gate.c \ + algo/x14/veltor.c \ + algo/x14/veltor-4way.c \ + algo/x14/polytimos-gate.c \ + algo/x14/polytimos.c \ + algo/x14/polytimos-4way.c \ + algo/x14/axiom.c \ + algo/x15/x15-gate.c \ + algo/x15/x15.c \ + algo/x15/x15-4way.c \ + algo/x16/x16r-gate.c \ + algo/x16/x16r.c \ + algo/x16/x16r-4way.c \ + algo/x16/x16rv2.c \ + algo/x16/x16rv2-4way.c \ + algo/x16/x16rt.c \ + algo/x16/x16rt-4way.c \ + algo/x16/hex.c \ + algo/x16/x20r.c \ + algo/x16/x21s-4way.c \ + algo/x16/x21s.c \ + algo/x16/minotaur.c \ + algo/x17/x17-gate.c \ + algo/x17/x17.c \ + algo/x17/x17-4way.c \ + algo/x17/xevan-gate.c \ + algo/x17/xevan.c \ + algo/x17/xevan-4way.c \ + algo/x17/sonoa-gate.c \ + algo/x17/sonoa-4way.c \ + algo/x17/sonoa.c \ + algo/x22/x22i-4way.c \ + algo/x22/x22i.c \ + algo/x22/x22i-gate.c \ + algo/x22/x25x.c \ + algo/x22/x25x-4way.c \ + algo/yespower/yespower-gate.c \ + algo/yespower/yespower-blake2b.c \ + algo/yespower/crypto/hmac-blake2b.c \ + algo/yespower/yescrypt-r8g.c \ + algo/yespower/yespower-opt.c \ + algo/yespower/yespower-ref.c \ + algo/yespower/yespower-blake2b-ref.c \ + algo/rinhash/rinhash.c \ + algo/rinhash/blake3/blake3.c \ + algo/rinhash/blake3/blake3_dispatch.c \ + algo/rinhash/blake3/blake3_portable.c \ + algo/rinhash/blake3/blake3_sse2_x86-64_unix.S \ + algo/rinhash/blake3/blake3_sse41_x86-64_unix.S \ + algo/rinhash/blake3/blake3_avx2_x86-64_unix.S \ + algo/rinhash/blake3/blake3_avx512_x86-64_unix.S \ + algo/rinhash/sha3/SimpleFIPS202.c \ + algo/rinhash/sha3/KeccakSponge.c \ + algo/rinhash/sha3/KeccakP-1600-reference.c + + +if HAVE_WINDOWS + cpuminer_SOURCES += compat/winansi.c +endif + +if USE_ASM + disable_flags = + cpuminer_SOURCES += asm/neoscrypt_asm.S +else + disable_flags = -DNOASM +endif + +cpuminer_LDFLAGS = @LDFLAGS@ +cpuminer_LDADD = $(EXTRA_LIBS) @LIBCURL@ -ljansson @PTHREAD_LIBS@ @WS2_LIBS@ -lgmp +cpuminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ $(ALL_INCLUDES) -DXKCP_has_KeccakP1600 +cpuminer_CFLAGS = -Wno-pointer-sign -Wno-pointer-to-int-cast -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 $(disable_flags) + +if ARCH_ARM64 + cpuminer_CFLAGS += -flax-vector-conversions +endif + +if HAVE_WINDOWS + +# use to profile an object +# gprof_cflags = -pg -g3 +# cpuminer_LDFLAGS += -pg +# cpuminer_CFLAGS += -fno-inline-functions -static + +# copy/paste from generated Makefile +common_ccflags = $(DEFS) $(ALL_INCLUDES) $(cpuminer_CPPFLAGS) $(CPPFLAGS) $(cpuminer_CFLAGS) $(CFLAGS) + +# special CFLAGS (if you find a simpler way to do that tell me ;) +cpuminer-neoscrypt.o: neoscrypt.c + @echo "CUSTOM ${@}: ${filter %.o,${^}} ${filter %.c,${^}}" + $(CC) $(common_ccflags) -g -O3 $(gprof_cflags) -MT $@ -MD -MP -c -o $@ $< + +endif diff --git a/rin/miner/cpuminer/README.md b/rin/miner/cpuminer/README.md new file mode 100644 index 0000000..e9f6e4d --- /dev/null +++ b/rin/miner/cpuminer/README.md @@ -0,0 +1,213 @@ +cpuminer-opt is a fork of cpuminer-multi by TPruvot with optimizations +imported from other miners developped by lucas Jones, djm34, Wolf0, pooler, +Jeff garzik, ig0tik3d, elmad, palmd, and Optiminer, with additional +optimizations by Jay D Dee. + +All of the code is believed to be open and free. If anyone has a +claim to any of it post your case in the cpuminer-opt Bitcoin Talk forum +or by email. + +Miner programs are often flagged as malware by antivirus programs. This is +a false positive, they are flagged simply because they are cryptocurrency +miners. The source code is open for anyone to inspect. If you don't trust +the software, don't use it. + + +New thread: + +https://bitcointalk.org/index.php?topic=5226770.msg53865575#msg53865575 + +Old thread: + +https://bitcointalk.org/index.php?topic=1326803.0 + +mailto://jayddee246@gmail.com + +This note is to confirm that bitcointalk users JayDDee and joblo are the +same person. + +I created a new BCT user JayDDee to match my github user id. +The old thread has been locked but still contains useful information for +reading. + +See file RELEASE_NOTES for change log and INSTALL_LINUX or INSTALL_WINDOWS +for compile instructions. + +Requirements +------------ + +1. A 64 bit CPU supporting x86_64 (Intel or AMD) or aarch64 (ARM). +x86_64 requires SSE2, aarch64 requires armv8 & NEON. + +Mobile CPUs like laptop computers are not recommended because they aren't +designed for extreme heat of operating at full load for extended periods of +time. + +2. 64 bit operating system including Linux, Windows, MacOS, or BSD. +Android, IOS and alt OSs like Haiku & ReactOS are not supported. + +3. Stratum pool supporting stratum+tcp:// or stratum+ssl:// protocols or +RPC getblockte,plate using http:// or https://. + +Supported Algorithms +-------------------- + + allium Garlicoin + anime Animecoin + argon2 Argon2 coin (AR2) + argon2d250 + argon2d500 + argon2d4096 + blake Blake-256 + blake2b Blake2-512 + blake2s Blake2-256 + blakecoin blake256r8 + bmw BMW 256 + bmw512 BMW 512 + c11 + decred + deep Deepcoin (DCN) + dmd-gr Diamond-Groestl + groestl Groestl coin + hex x16r-hex + hmq1725 + jha Jackpotcoin + keccak Maxcoin + keccakc Creative coin + lbry LBC, LBRY Credits + lyra2h + lyra2re lyra2 + lyra2rev2 lyra2v2 + lyra2rev3 lyrav2v3 + lyra2z + lyra2z330 + m7m + minotaur + minotaurx + myr-gr Myriad-Groestl + neoscrypt NeoScrypt(128, 2, 1) + nist5 Nist5 + pentablake Pentablake + phi1612 phi + phi2 + polytimos Ninja + power2b MicroBitcoin (MBC) + quark Quark + qubit Qubit + scrypt scrypt(1024, 1, 1) (default) + scrypt:N scrypt(N, 1, 1) + scryptn2 scrypt(1048576, 1, 1) + sha256d Double SHA-256 + sha256dt + sha256q Quad SHA-256 + sha256t Triple SHA-256 + sha3d Double keccak256 (BSHA3) + sha512256d + skein Skein+Sha (Skeincoin) + skein2 Double Skein (Woodcoin) + skunk Signatum (SIGT) + sonoa Sono + timetravel Machinecoin (MAC) + timetravel10 Bitcore + tribus Denarius (DNR) + vanilla blake256r8vnl (VCash) + veltor (VLT) + verthash Vertcoin + whirlpool + whirlpoolx + x11 Dash + x11evo Revolvercoin + x11gost sib (SibCoin) + x12 + x13 + x13bcd bcd + x13sm3 hsr (Hshare) + x14 + x15 + x16r + x16rv2 + x16rt + x16rt-veil veil + x16s + x17 + x20r + x21s + x22i + x25x + xevan Bitsend (BSD) + yescrypt Globalboost-Y (BSTY) + yescryptr8 BitZeny (ZNY) + yescryptr8g Koto (KOTO) + yescryptr16 Eli + yescryptr32 WAVI + yespower Cryply + yespowerr16 Yenten (YTN) + yespower-b2b generic yespower + blake2b + zr5 Ziftr + rinhash RinHash + +Many variations of scrypt based algos can be mine by specifying their +parameters: + +scryptn2: --algo scrypt --param-n 1048576 + +cpupower: --algo yespower --param-key "CPUpower: The number of CPU working or available for proof-of-work mining" + +power2b: --algo yespower-b2b --param-n 2048 --param-r 32 --param-key "Now I am become Death, the destroyer of worlds" + +sugarchain: --algo yespower --param-n 2048 -param-r 32 --param-key "Satoshi Nakamoto 31/Oct/2008 Proof-of-work is essentially one-CPU-one-vote" + +yespoweriots: --algo yespower --param-n 2048 --param-key "Iots is committed to the development of IOT" + +yespowerlitb: --algo yespower --param-n 2048 --param-r 32 --param-key "LITBpower: The number of LITB working or available for proof-of-work mini" + +yespoweric: --algo yespower --param-n 2048 --param-r 32 --param-key "IsotopeC" + +yespowerurx: --algo yespower --param-n 2048 --param-r 32 --param-key "UraniumX" + +yespowerltncg: --algo yespower --param-n 2048 --param-r 32 --param-key "LTNCGYES" + +Errata +------ + +Old algorithms that are no longer used frequently will not have the latest +optimizations. + +Cryptonight and variants are no longer supported, use another miner. + +Neoscrypt crashes on Windows, use legacy version. + +AMD CPUs older than Piledriver, including Athlon x2 and Phenom II x4, are not +supported by cpuminer-opt due to an incompatible implementation of SSE2 on +these CPUs. Some algos may crash the miner with an invalid instruction. +Users are recommended to use an unoptimized miner such as cpuminer-multi. + +cpuminer-opt does not work mining Decred algo at Nicehash and produces +only "invalid extranonce2 size" rejects. + +Benchmark testing does not work for x11evo. + +Bugs +---- + +Users are encouraged to post their bug reports using git issues or on the +Bitcoin Talk forum or opening an issue in git: + +https://bitcointalk.org/index.php?topic=1326803.0 + +https://github.com/JayDDee/cpuminer-opt/issues + +All problem reports must be accompanied by a proper problem definition. +This should include how the problem occurred, the command line and +output from the miner showing the startup messages and any errors. +A history is also useful, ie did it work before. + +Donations +--------- + +cpuminer-opt has no fees of any kind but donations are accepted. + + BTC: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT + +Happy mining! + diff --git a/rin/miner/cpuminer/README.txt b/rin/miner/cpuminer/README.txt new file mode 100644 index 0000000..5527f40 --- /dev/null +++ b/rin/miner/cpuminer/README.txt @@ -0,0 +1,80 @@ +This file is included in the Windows binary package. Compile instructions +for Linux and Windows can be found in RELEASE_NOTES. + +cpuminer-opt is open source and free of any fees. Many forks exist that are +closed source and contain usage fees. support open source free software. + +This package is officially avalaible only from: + + https://github.com/JayDDee/cpuminer-opt + +No other sources should be trusted. + +cpuminer is a console program that is executed from a DOS or Powershell +command prompt. There is no GUI and no mouse support. + +New users are encouraged to consult the cpuminer-opt Wiki for detailed +information on usage: + +https://github.com/JayDDee/cpuminer-opt/wiki + +Miner programs are often flagged as malware by antivirus programs. This is +a false positive, they are flagged simply because they are cryptocurrency +miners. The source code is open for anyone to inspect. If you don't trust +the software, don't use it. + +Choose the exe that best matches you CPU's features or use trial and +error to find the fastest one that works. Pay attention to +the features listed at cpuminer startup to ensure you are mining at +optimum speed using the best available features. + +Architecture names and compile options used are only provided for +mainstream desktop CPUs. Budget CPUs like Pentium and Celeron are often +missing some features. Check your CPU. + +Support for AMD CPUs older than Ryzen is incomplete and without specific +recommendations. Find the best fit. CPUs older than Piledriver, including +Athlon x2 and Phenom II x4, are not supported by cpuminer-opt due to an +incompatible implementation of SSE2 on these CPUs. + +More information for Intel and AMD CPU architectures and their features +can be found on Wikipedia. + +https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures + +https://en.wikipedia.org/wiki/List_of_AMD_CPU_microarchitectures + +File name Architecture name + +cpuminer-sse2.exe Core2, Nehalem, generic x86_64 with SSE2 +cpuminer-aes-sse42.exe Westmere +cpuminer-avx.exe Sandybridge, Ivybridge +cpuminer-avx2.exe Haswell, Skylake, Kabylake, Coffeelake, Cometlake +cpuminer-avx2-sha.exe AMD Zen1, Zen2 +cpuminer-avx2-sha-vaes.exe Intel Alderlake*, AMD Zen3 +cpuminer-avx512.exe Intel HEDT Skylake-X, Cascadelake +cpuminer-avx512-sha-vaes.exe AMD Zen4, Intel Rocketlake, Icelake + +* Alderlake is a hybrid architecture with a mix of E-cores & P-cores. Although + the P-cores can support AVX512 the E-cores can't so Intel decided to disable + AVX512 on the the P-cores. + +Notes about included DLL files: + +Downloading DLL files from alternative sources presents an inherent +security risk if their source is unknown. All DLL files included have +been copied from the Ubuntu-20.04 installation or compiled by me from +source code obtained from the author's official repository. The exact +procedure is documented in the build instructions for Windows: +https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source + +Some included DLL files may already be installed on the system by Windows or +third party packages. They often will work and may be used instead of the +included version of the files. + + +If you like this software feel free to donate: + +BTC: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT + + diff --git a/rin/miner/cpuminer/RELEASE_NOTES b/rin/miner/cpuminer/RELEASE_NOTES new file mode 100644 index 0000000..283ed43 --- /dev/null +++ b/rin/miner/cpuminer/RELEASE_NOTES @@ -0,0 +1,1744 @@ +cpuminer-opt is a console program run from the command line using the +keyboard, not the mouse. + +See also README.md for list of supported algorithms, + +Security warning +---------------- + +Miner programs are often flagged as malware by antivirus programs. This is +usually a false positive, they are flagged simply because they are +cryptocurrency miners. However, some malware masquerading as a miner has +been spread using the cover that miners are known to be subject to false +positives ans users will dismiss the AV alert. Always be on alert. +The source code of cpuminer-opt is open for anyone to inspect. +If you don't trust the software don't download it. + +The cryptographic hashing code has been taken from trusted sources but has been +modified for speed at the expense of accepted security practices. This +code should not be imported into applications where secure cryptography is +required. + +Compile Instructions +-------------------- + +See INSTALL_LINUX or INSTALL_WINDOWS for compile instructions + +Requirements +------------ + +- A x86_64 architecture CPU with a minimum of SSE2 support. This includes Intel Core2 and newer and AMD equivalents. +- Arm CPU supporting AArch64 and NEON. + +32 bit CPUs are not supported. + +Older CPUs are supported by open source cpuminer-multi by TPruvot but at reduced performance. + +Mining on mobile devices that meet the requirements is not recommended due to the risk of +overheating and damaging the battery. Mining has unlimited demand, it will push any device +to or beyond its limits. There is also a fire risk with overheated lithium batteries. + +Beware of apps claiming "mobile only mining". There is no such thing, they aren't miners. +If a mobile CPU can mine it any CPU can. + +See wiki for details. + +Reporting bugs +-------------- + +Bugs can be reported by sending am email to JayDDee246@gmail.com or opening +an issue in git: https://github.com/JayDDee/cpuminer-opt/issues + +Please include the following information: + +1. CPU model, operating system, cpuminer-opt version (must be latest), + binary file for Windows, changes to default build procedure for Linux. + +2. Exact command line (except user and pw) and intial output showing + the above requested info. + +3. Additional program output showing any error messages or other + pertinent data. + +4. A clear description of the problem including history, scope, + persistence or intermittance, and reproduceability. + +In simpler terms: + +What is it doing? +What should it be doing instead? +Did it work in a previous release? +Does it happen for all algos? All pools? All options? Solo? +Does it happen all the time? +If not what makes it happen or not happen? + +Change Log +---------- + +v25.3 + +#442, #443: Fixed a regression in Makefile.am. +Updated dockerfile. +Removed algo features log display. +Some code cleanup. + +v25.2 + +ARM: Fixed regression from v25.1 that could cause build fail. +BSD: FreeBSD is now supported. Other BSDs may also work. +MacOS: build with installed jansson library instead of compiling the included source code. +Windows: remove "_WIN32_WINNT=0x0601" which is a downgrade on Win11. +Changed build.sh shell from bash to sh. + +v25.1 + +MacOS ARM64: m7m algo is now working. +MacOS ARM64: can now be compiled with GCC. +MacOS x86_64: is now working compiled with GCC. +Fixed some minor bugs & removed some obsolete code. + +v24.8 + +ARM: Apple MacOS on M series CPU is now supported compiled from source +code, see Wiki for details. +ARM: Fix incorrect compiler version display when using clang. +build.sh can now be used to compile all targets, arm_build.sh & build_msys2.sh +have been removed. +Windows: MSys2 build now enables CPU groups by default, prebuilt binaries +continue to be compiled with CPU groups disabled. + +v24.7 + +ARM: compile works for Windows using MSys2 & MingW, see wiki for details. + +v24.6 + +ARM: Fixed scryptn2, x16*, broken in v24.2. +ARM: Small improvement to interleaving. +Eliminated some potential compile errors in code that was dependent on +compiler optimisations. +x86_64: improved support for AVX10 compilation, needs GCC-14 or higher. + +v24.5 + +Fix MinGW compile error after MSys2 upgrade to GCC-14.2. +#427: GBT: Improved handling of new work. +Removed shavite3 algo. + +v24.4 + +x86_64: fixed a bug in ornot macro for AVX2 which broke some algos in v24.2. +x86_64: fixed a bug in alignr macros for SSE2. +ARM: CPU feature reporting enhancements. +Some code cleanup. + +v24.3 + +ARM: CPU feature detection and reporting is now working. +ARM: Verthash is now working. +ARM: Small speedup for yescrypt, yespower & argon2d. +Code cleanup. + +v24.2 + +x86_64: Fixed blakes2s for AVX2 & AVX512, x25x for AVX512, broken in v3.23.4. +x86_64: Initial support for CPUs with AVX10, needs GCC-14. +ARM NEON: Various code optimisations. + +v24.1 + +#414: fix bug in merkle error handling. +#416: change $nproc to $(nproc) in build scripts. +#420: change some inline function definitions to static inline. +#413: Fix formatting error for share result log when using no-color. +Faster 2 way interleaving. +Cleanup sha256 architecture targetting. + +v23.15 + +Fixed x11gost (sib) algo for all architectures, broken in v3.23.4. +ARM: Fugue AES optimizations enabled. +ARM: quark, qubit, x11gost algos optimized with NEON & AES. + +v23.14 + +ARM: Groestl AES optimizations enabled. +All: Small optimization to Shabal 4way. +x86_64: Extend Shabal 4way support to SSE2 from SSE4.1. +All: deleted some unused files. + +v23.13 + +Added x20r algo. +Eliminated redundant hash order calculations for x16r family. + +v23.12 + +Several bugs fixes and speed improvements for x16r family for all CPU architectures. + +v23.11 + +This is a release candidate for full AArch64 support, marking the end of the Beta phase. +Fixed hmq1725 & x25x algos, SSE2 & NEON, broken in v3.23.4. +Most CPU-mineable SHA3 algos (X*) upgraded to 2-way SSE2 & NEON. + +v23.10 + +x86_64: Fixed scrypt, scryptn2 algos SSE2. +Fixed sha512256d algo AVX2, SSE2, NEON. +Fixed a bug in Skein N-way that reduced performance. +ARM: Skein optimized for NEON, SHA2 & SSE2. +Skein2 algo 2-way optimized for NEON & SSE2. + +v23.9 + +x86_64: fixed minotaurx crash, broken in 23.7. +ARM: #407 fix compile error due to incorrect type casting for vrev instruction argument. + +v23.8 + +Cpuminer-opt is no longer dependant on OpenSSL. +Removed Hodl algo. +Removed legacy Sha256 & Scrypt ASM code. +ARM: Echo AES is working and enabled for x17. + +v23.7 + +Fixed blakes2s, broken in v3.23.4. +ARM: SHA2 extension tested and working. +ARM: sha512256d fully optimized. +ARM: X17 more optimizations. +ARM: AES extension working for Shavite. +ARM errata: CPU features AES & SHA256 are not reported when available. + +v23.6 + +ARM: Sha256dt, Sha256t, Sha256d 4-way now working and fully optimized for NEON, SHA also enabled but untested. +x86: Sha256dt, Sha256t, Sha256d faster SSE2 4-way. +ARM: Scrypt, Scryptn2 fully optimized for NEON, SHA also enabled but untested. +Linux: added a log when miner is started as root to discourage doing so. + +v23.5 + +New version numbering drops the leading 3, the major version will now be the calendar year, the minor version identifies planned releases during the year. + +BETA: 64 bit ARM support +- ARM 64 bit CPUs are now supported with source code for Linux. Windows is not supported. +- NEON, AES & SHA2 are supported. +- This the first public release and is early Beta quality. +- Some algorithms do not work on ARM or work at reduced performance. +See wiki for details: https://github.com/JayDDee/cpuminer-opt/wiki/Support-for-AArch64. + +- CPU archtecture and OS detection and logging now support ARM features. +- New 2way parallel hash for ARM also helps x86_64 CPUs without AVX2 on supported algorithms. +- Enhanced startup feature logs to support ARM. +- Removed startup logs for incompatible CPU/SW architectures. +- Added CPU architecture & OS type to RPC user agent string. +- Added share reject controls, a warning log is displayed at 10% reject rate, the miner exits with an error log at 50%. +- Removed argon2 algorithm. +- New CLI option "--bell" adds an ASCII bell code in the output string of error, warning, & rejected share logs. The option is disabled by default. + +v3.23.4 + +Source code only. + +Initial experimental support for ARM AArch64 with NEON, SHA2 & AES. +Arm support is considered alpha quality, use at your own risk. +x86_64 is unaffected. + +v3.23.3 + +#402: Windows binaries package rebuilt with openssl v1.1.1w (libcrypto-1_1-x64.dll). + +#400: Removed excessive thread restarts when mining solo. +Fixed build_msys2.sh for gcc-13 by removing unsupported option "--param=evrp-mode=legacy" from CFLAGS. +Added CPUID detection and reporting of CPUs and SW builds supporting SHA512 extension. +Added prototype of sha-512 using SHA512 intrinsics, untested. +Other improvements and code cleanup. + +v3.23.2 + +sha256dt, sha256t & sha256d +10% with SHA, small improvement with AVX2. +Other small improvements and code cleanup. + +v3.23.1 + +#349: Fix sha256t low difficulty shares and low effective hash rate. +Faster sha256dt: AVX512 +7%, SHA +200%, AVX2 +5%. +Faster blakecoin & vanilla: AVX2 +30%, AVX512 +110%. +Other small improvements and code cleanup. + +v3.23.0 + +#398: Prevent GBT fallback to Getwork on network error. +#398: Prevent excessive logs when conditional mining is paused when mining solo. +Fix a false start if stratum doesn't immediately send a new job after connecting. +Tweak diagonal shuffle in Blake2b & Blake256 1-way SIMD to reduce latency. +CPUID support for AVX10. +Initial changes to AVX2 targeted code in preparation for AVX10. +Code cleanup and miscellaneous small improvements. + +v3.22.3 + +Data interleaving and byte swap optimizations with AVX2, AVX512 & AVX512VBMI. +Faster Luffa with AVX2 & AVX512. +Other small optimizations. +Some code cleanup. + +v3.22.2 + +Added sha512256d & sha256dt algos. +Fixed intermittant invalid shares lyra2v2 AVX512. +Removed application limits on the number of CPUs and threads, HW and OS limits still apply. +Added a log warning if more threads are defined than active CPUs in affinity mask. +Improved merkle tree memory management for stratum. +Added transaction count to New Work log. +Other small improvements. + +v3.22.1 + +#393 fixed segfault in GBT, regression from v3.22.0. +More efficient 32 bit data interleaving. + +v3.22.0 + +Stratum: faster netdiff calculation. +Merged a few updates from Pooler/cpuminer: + Use CURLOPT_POSTFIELDS in json_rpc_call, + Use CURLINFO_ACTIVESOCKET when supported, + JSONRPC speedup, + Speed up hex2bin function. +Small log improvements, notably more frequent hash rate reports. +Removed decred algo. + +v3.21.5 + +All issues with v3.21.3 & v3.21.4 should be resolved. +Changes since v3.21.2: +#392 #379 #389 Fixed misaligned address segfault solo mining. +#392 Fixed stats for myr-gr algo, and a few others, for CPUs without AVX2. +#392 Fixed conditional mining. +#392 Fixed cpu affinity on Ryzen CPUs using Windows binaries, + Windows binaries no longer support CPU groups, + Windows binaries support CPUs with up to 64 threads. +Small optimizations to serialized vectoring. + +v3.21.4 CANCELLED + +Reapply selected changes from v3.21.3. +#392 #379 #389 Fixed misaligned address segfault solo mining. +#392 Fixed conditional mining. +#392 Fixed cpu affinity on Ryzen CPUs using Windows binaries, + Windows binaries no longer support CPU groups, + Windows binaries support CPUs with up to 64 threads. + +v3.21.3.1 UNRELEASED + +Revert to 3.21.2 + +v3.21.3 CANCELLED + +#392 #379 #389 Fixed misaligned address segfault solo mining. +#392 Fixed stats for myr-gr algo, and a few others, for CPUs without AVX2. +#392 Fixed conditional mining. +#392 Fixed cpu affinity on Ryzen CPUs using Windows binaries, + Windows binaries no longer support CPU groups, + Windows binaries support CPUs with up to 64 threads. +Midstate prehash is now centralized, done only once instead of by every thread +for selected algos. +Small optimizations to serialized vectoring. + +v3.21.2 + +Faster SALSA SIMD shuffle for yespower, yescrypt & scryptn2. +Fixed a couple of compiler warnings with gcc-12. + +v3.21.1 + +Fixed a segfault in some obsolete algos. +Small optimizations to Hamsi & Shabal AVX2 & AVX512. + +v3.21.0 + +Added minotaurx algo for stratum only. +Blake256 & sha256 prehash optimized to ignore zero-padded data for AVX2 & AVX512. +Other small improvements. + +v3.20.3 + +Faster c11 algo: AVX512 6%, AVX2 4%, AVX2+VAES 15%. +Faster AVX2+VAES for anime 14%, hmq1725 6%. +Small optimizations to Luffa AVX2 & AVX512. + +v3.20.2 + +Bit rotation optimizations to Blake256, Blake512, Blake2b, Blake2s & Lyra2-blake2b for SSE2 & AVX2. +Removed old unused yescrypt library and other unused code. + +v3.20.1 + +sph_blake2b optimized 1-way SSSE3 & AVX2. +Removed duplicate Blake2b used by Power2b algo, will now use optimized sph_blake2b. +Removed imprecise hash & target display from rejected share log. +Share and target difficulty is now displayed only for low difficulty shares. +Updated configure.ac to check for AVX512 asm support. +Small optimization to Lyra2 SSE2. + +v3.20.0 + +#375 Fixed segfault in algos using Groestl VAES due to use of uninitialized data. + +v3.19.9 + +More Blake256, Blake512, Luffa & Cubehash prehash optimizations. +Relaxed some excessively strict data alignment that was negatively affecting performance. + +v3.19.8 + +#370 "stratum+ssl", in addition to "stratum+tcps", is now recognized as a valid +url protocol specifier for requesting a secure stratum connection. +The full url, including the protocol, is now displayed in the stratum connect +log and the periodic summary log. +Small optimizations to Cubehash, AVX2 & AVX512. +Byte order and prehash optimizations for Blake256 & Blake512, AVX2 & AVX512. + +v3.19.7 + +#369 Fixed time limited mining, --time-limit. +Fixed a potential compile error when using optimization below -O3. + +v3.19.6 + +#363 Fixed a stratum bug where the first job may be ignored delaying start of hashing +Fixed handling of nonce exhaust when hashing a fast algo with extranonce disabled +Small optimization to Shavite. + +v3.19.5 + +Enhanced stratum-keepalive preemptively resets the stratum connection +before the server to avoid lost shares. +Added build-msys2.sh shell script for easier compiling on Windows, see Wiki for details. +X16RT: eliminate unnecessary recalculations of the hash order. +Fix a few compiler warnings. +Fixed log colour error when a block is solved. + +v3.19.4 + +#359: Fix verthash memory allocation for non-hugepages, broken in v3.19.3. +New option stratum-keepalive prevents stratum timeouts when no shares are +submitted for several minutes due to high difficulty. +Fixed a bug displaying optimizations for some algos. + +v3.19.3 + +Linux: Faster verthash (+25%), scryptn2 (+2%) when huge pages are available. +Small speed up for Hamsi AVX2 & AVX512, Keccak AVX512. + +v3.19.2 + +Fixed log displaying incorrect memory usage for scrypt, broken in v3.19.1. +Reduce log noise when replies to submitted shares are lost due to stratum errors. +Fugue prehash optimization for X16r family AVX2 & AVX512. +Small speed improvement for Hamsi AVX2 & AVX512. +Win: With CPU groups enabled the number of CPUs displayed in the ASCII art +affinity map is the number of CPUs in a CPU group, was number of CPUs up to 64. + +v3.19.1 + +Changes to Windows binaries package: + - builds for CPUs with AVX or lower have CPU groups disabled, + - zen3 build renamed to avx2-sha-vaes to support Alderlake as well as Zen3, + - zen build renamed to avx2-sha, supports Zen1 & Zen2, + - avx512-sha build removed, Rocketlake CPUs can use avx512-sha-vaes, + - see README.txt for compatibility details. +Fixed a few compiler warnings that are new in GCC 11. +Other minor fixes. + +v3.19.0 + +Windows binaries now built with support for CPU groups, requires Windows 7. + +Changes to cpu-affinity: + - PR#346: Fixed incorrect CPU affinity on Windows built for CPU groups, + - added support for CPU affinity for up to 256 threads or CPUs, + - streamlined code for more efficient initialization of miner threads, + - precise affining of each miner thread to a specific CPU, + - added an option to disable CPU affinity with "--cpu-affinity 0" +Faster sha256t with AVX512 & AVX2. +Added stratum error count to stats log, reported only when non-zero. + +v3.18.2 + +Issue #342, fixed Groestl AES on Windows, broken in v3.18.0. +AVX512 for sha256d. +SSE42 and AVX may now be displayed as mining features at startup. +This is hard coded for each algo, and is only implemented for scrypt +at this time as it is the only algo with significant performance differences +with those features. +Fixed an issue where a high hashrate algo could cause excessive invalid hash +rate log reports when starting up in benchmark mode. + +v3.18.1 + +More speed for scrypt: + - additional scryptn2 optimizations for all CPU architectures, + - AVX2 is now used by default on CPUS with SHA but not AVX512, + - scrypt:1024 performance lost in v3.18.0 is restored, + - AVX512 & AVX2 improvements to scrypt:1024. +Big speedup for SwiFFTx AVX2 & SSE4.1: x22i +55%, x25x +22%. +Issue #337: fixed a problem that could display negative stats values in the +first summary report if the report was forced prematurely due to a stratum +diff change. The stats will still be invalid but should display zeros. + +v3.18.0 + +Complete rewrite of Scrypt code, optimized for large N factor (scryptn2): + - AVX512 & SHA support for sha256, AVX512 has priority, + - up to 50% increase in hashrate, + - memory requirements reduced 30-60% depending on CPU architecture, + - memory usage displayed at startup, + - scrypt, default N=1024 (LTC), will likely perform slower. +Improved stale share detection and handling for Scrypt with large N factor: + - abort and discard partially computed hash when new work is detected, + - quicker response to new job, less time wasted mining stale job. +Improved stale share handling for all algorithms: + - report possible stale share when new work received with a previously + submitted share still pending, + - when new work is detected report the submission of an already completed, + otherwise valid, but likely stale, share, + - fixed incorrect block height in stale share log. +Small performance improvements to sha, bmw, cube & hamsi for AVX512 & AVX2. +When stratum disconnects miner threads go to idle until reconnected. +Colour changes to some logs. +Some low level function name changes for clarity and consistency. +The reference hashrate in the summary log and the benchmark total hashrate +are now the mean hashrate for the session. + +v3.17.1 + +Fixed Windows build for AES+SSE4.2 (Westmere), was missing AES. +More ternary logic optimizations for AVX512, AVX512+VAES, and AVX512+AES. +Fixed my-gr algo for VAES. + +v3.17.0 + +AVX512 optimized using ternary logic instructions. +Faster sha256t on all CPU architectures: AVX512 +30%, SHA +30%, AVX2 +9%. +Use SHA on supported CPUs to produce merkle hash. +Fixed byte order in Extranonce2 log & replaced Block height with Job ID. + +v3.16.5 + +#329: Fixed GBT incorrect target diff in stats, second attempt. +Fixed formatting error in share result log when --no-color option is used. + +v3.16.4 + +Faster sha512 and sha256 when not using SHA CPU extension. +#329: Fixed GBT incorrect target diff in stats. + +v3.16.3 + +#313 Fix compile error with GCC 11. +Incremental improvements to verthash. + +v3.16.2 + +Verthash: midstate prehash optimization for all architectures. +Verthash: AVX2 optimization. +GBT: added support for Bech32 addresses. +Linux: added CPU frequency to benchmark log. +Fixed integer overflow in time calculations. + +v3.16.1 + +New options for verthash: + --data-file to specify the name, and optionally the path, of the verthash + data file, default is "verthash.dat" in the current directory. + --verify to perform the data file integrity check at startup, default is + not to verify data file integrity. +Support for creation of default verthash data file if: + 1) --data-file option is not used, + 2) no default data file is found in the current directory, and, + 3) --verify option is used. +More detailed logs related to verthash data file. +Small verthash performance improvement. +Fixed detection of corrupt stats caused by networking issues. + +v3.16.0 + +Added verthash algo. + +v3.15.7 + +Added accepted/stale/rejected percentage to summary log report. +Added warning if share counters mismatch which could corrupt stats. +Linux: CPU temperature reporting is more responsive to rising temperature. +A few AVX2 & AVX512 tweaks. +Removed some dead code and other cleanup. + +v3.15.6 + +Implement keccak pre-hash optimization for x16* algos. +Move conditional mining test to before get_new_work in miner thread. +Add test for share reject reason when solo mining. +Add support for floating point, as well as integer, "networkhasps" in +RPC getmininginfo method. + +v3.15.5 + +Fix stratum jobs lost if 2 jobs received in less than one second. + +v3.15.4 + +Fixed yescryptr16 broken in v3.15.3. + +v3.15.3 + +Yescrypt algos now use yespower v0.5, a little faster. +New implementation of sha256 using SHA CPU extension. +Replace Openssl with SPH for sha256 & sha512. +AVX512 optimization for sha256t & sha256q. +Faster sha256t, sha256q, x21s, x22i & x25x on CPUs with SHA without AVX512. +AVX512+SHA build for Intel Rocketlake added to Windows binary package. + +v3.15.2 + +Zen3 AVX2+VAES optimization for x16*, x17, sonoa, xevan, x21s, x22i, x25x, +allium. +Zen3 (AVX2+SHA+VAES) build added to Windows binary package. + +v3.15.1 + +Fix compile on AMD Zen3 CPUs with VAES. +Force new work immediately after solving a block solo. + + +v3.15.0 + +Fugue optimized with AES, improves many sha3 algos. +Minotaur algo optimized for all architectures. +Fixed neoscrypt BUG log. + +v3.14.3 + +#265: more mutex changes to reduce blocking with high thread count. +#267: fixed hodl algo potential memory alignment issue, + add warning when thread count is not valid for mining hodl algo. + +v3.14.2 + +The second line of the Share Accepted log is no longer displayed, +new Xnonce log is added and other small log tweaks. + +#265: Cleanup use of mutex. + +v3.14.1 + +GBT and getwork log changes: + fixed missing TTF in New Block log, + ntime no longer byte-swapped for display in New Work log, + fixed zero effective hash rate in Periodic Report log, + deleted "Current block is..." log. + +Renamed stratum "New Job" log to "New Work" to be consistent with the solo +version of the log. Added more data to both versions. + +v3.14.0 + +Changes to solo mining: + - segwit is supported by getblocktemplate, + - longpolling is not working and is disabled, + - Periodic Report log is output, + - New Block log includes TTF estimates, + - Stratum thread no longer created when using getwork or GBT. + +Fixed BUG log mining sha256d. + +v3.13.1.1 + +Fixed Windows crash mining minotaur algo. + +Fixed GCC 10 compile again. +Added -fno-common to testing to be consistent with GCC 10 default. + +v3.13.1 + +Added minotaur algo for Ringcoin. + +v3.13.0.1 + +Issue #262: Fixed xevan AVX2 invalid shares. + +v3.13.0 + +Updated Windows binaries compiled with GCC 9. Included DLLs also updated. +Icelake build (cpuminer-avx512-sha-vaes.exe) now included in Windows +binaries package. + +No source code changes. + +v3.12.8.2 + +Fixed x12 AVX2 rejects. +Fixed phi AVX2 crash. + +v3.12.8.1 + +Issue #261: Fixed yescryptr8g invalid shares. + +v3.12.8 + +Yespower sha256 prehash made thread safe. + +Rewrote diff conversion functions from scratch to be simpler and use +long double (float80) and int128 arithmetic for improved accuracy and +precision. + +Some code cleanup and assorted small changes. + +v3.12.7 + +Issue #257: fixed a file descriptor leak which caused the CPU temperature +and frequency query to report zeros after mining for a couple of hours. + +Issue #253: stale share reduction for yescrypt, sonoa. + +v3.12.6.1 + +Issue #252: Fixed SSL mining (stratum+tcps://) + +Issue #254 Fixed benchmark. + +Issue #253: Implemented stale share reduction for yespower, x25x, x22i, x21s, +x16*, scryptn2, more to come. + +v3.12.6 + +Issue #246: improved stale share detection for getwork. + +Improved precision of target_to_diff conversion from 4 digits to 20+. + +Display hash and target debug data for all rejected shares. + +A graphical representation of CPU affinity is displayed when using --threads. + +Added highest and lowest accepted share to summary log. + +Other small changes to logs to improve consistency and clarity. + +v3.12.5 + +Issues #246 & #251: fixed incorrect share diff for stratum and getwork, +fixed incorrect target diff for getwork. Stats should now be correct for +getwork as well as stratum. + +Issue #252: Fixed stratum+tcps not using curl ssl. + +Getwork: reduce stale blocks, faster response to new work. + +Added ntime to new job/work logs. + +README.md now lists the parameters for yespower variations that don't have +a specific algo name. + +v3.12.4.6 + +Issue #246: fixed getwork repeated new block logs with same height. New work +for the same block is now reported as "New work" instead of "New block". +Also added a check that work is new before generating "New work" log. + +Added target diff to getwork new block log. + +Changed share ratio in share result log to simple fraction, no longer %. + +Added debug log to display mininginfo, use -D. + +v3.12.4.5 + +Issue #246: better stale share detection for getwork, and enhanced logging +of stale shares for stratum & getwork. + +Issue #251: fixed incorrect share difficulty and share ratio in share +result log. + +Changed submit log to include share diff and block height. + +Small cosmetic changes to logs. + +v3.12.4.4 + +Issue #246: Fixed net hashrate in getwork block log, + removed duplicate getwork block log, + other small tweaks to stats logs for getwork. + +Issue #248: Fixed chronic stale shares with scrypt:1048576 (scryptn2). + +v3.12.4.3 + +Fixed segfault in new block log for getwork. + +Disabled silent discarding of stale work after the submit is logged. + +v3.12.4.2 + +Issue #245: fixed getwork stale shares, solo mining with getwork now works. + +Issue #246: implemented block and summary logs for getwork. + +v3.12.4.1 + +Issue #245: fix scantime when mining solo with getwork. + +Added debug logs for creation of stratum and longpoll threads, use -D to +enable. + +v3.12.4 + +Issue #244: Change longpoll to ignore job id. + +Lyra2rev2 AVX2 +3%, AVX512 +6%. + +v3.12.3.1 + +Issue #241: Fixed regression that broke coinbase address in v3.11.7. + +v3.12.3 + +Issue #238: Fixed skunk AVX2. + +Issue #239: Faster AVX2 & AVX512 for skein +44%, skein2 +30%, plus marginal +increases for skunk, x16r, x16rv2, x16rt, x16rt-veil, x16s, x21s. + +Faster anime VAES +57%, AVX512 +21%, AVX2 +3%. + +Redesigned code reponsible for #236. + +v3.12.2 + +Fixed xevan, skein, skein2 AVX2, #238. + +Reversed polarity of AVX2 vector bit test utilities, and all users, to be +logically and semantically correct. Follow up to issue #236. + +v3.12.1 + +Fixed anime AVX2 low difficulty shares, git issue #236. + +Periodic summary now reports lost hash rate due to rejected and stale shares, +displayed only when non-zero. + +v3.12.0.1 + +Fixed hodl rejects, git issue #237. + +Fixed debug code added in v3.12.0 to work with AVX2 to be enabled only +after low difficulty share have been seen to avoid unnecessarily excessive +log outout. + +Added more digits of precision to diff in log output to help diagnose +low difficulty shares. + +v3.12.0 + +Faster phi2 AVX2 +62%, AVX512 +150% on Intel CPUs. AMD Ryzen AVX2 is +YMMV due to its inferiour AVX2 implementation. + +Fixed Hodl stats, rejects are still an issue since v3.9.5, git issue #237. + +API can now be enabled with "-b port" or "--api-bind port". +It will use the default address 127.0.0.1. + +Editorial: Short form options should only be used on the command line to save +typing. Configuration files and scripts should always use the long form +"--api-bind addr:port" without relying on any defaults. This is a general +recommendation that applies to all options for any application. + +Removed obsolete cryptonight, all variants, and supporting code for more +size reduction and faster compiling. + +Tweaked the timing of the CPU temperature and frequency log (Linux only). + +Added some debug code to collect more info aboout low difficulty rejects, +git issue #236. + +v3.11.9 + +Fixed x16r invalid shares when Luffa was first in hash order. + +API is disabled by default. + +New startup message for status of stratum connection, API & extranonce. + +New log report for CPU temperature, frequency of fastest and slowest cores. + +Compile time is a little shorter and binary file size a little smaller +using conditional compilation.. + +Removed code for Bastion, Drop, Heavy, Luffa an Pluck algos and other unused +code. + +v3.11.8 + +Fixed network hashrate showing incorrect data, should be close now. + +Fixed compile errors when using GCC 10 with default flag -fno-common. + +Faster x16r, x16rv2, x16rt, x16s, x21s, veil, hex with midstate prehash. + +Decoupled sapling usage from block version 5 in yescryptr8g. + +More detailed data reporting for low difficulty rejected shares. + +v3.11.7 + +Added yescryptr8g algo for KOTO, including support for block version 5. + +Added sha3d algo for BSHA3. + +Removed memcmp and clean_job checks from get_new_work, now only check job_id. + +Small improvement to sha512 and sha256 parallel implementations that don't +use SHA. + +v3.11.6 + +Fixed CPU temperature regression from v3.11.5. + +More improvements to share log. More compact, highlight incremented counter, +block height when solved, job id when stale. + +v3.11.5 + +Fixed AVX512 detection that could cause compilation errors on CPUs +without AVX512. + +Fixed "BLOCK SOLVED" log incorrectly displaying "Accepted" when a block +is solved. +Added share counter to share submitited & accepted logs +Added job id to share submitted log. +Share submitted log is no longer highlighted blue, there was too much blue. + +Another CPU temperature fix for Linux. + +Added bug reporting tips to RELEASE NOTES. + +v3.11.4 + +Fixed scrypt segfault since v3.9.9.1. + +Stale shares counted and reported seperately from other rejected shares. + +Display of counters for solved blocks, rejects, stale shares suppressed in +periodic summary when zero. + +v3.11.3 + +Fixed x12 AVX2 again. + +More speed for allium: AVX2 +4%, AVX512 +6%, VAES +14%. + +Restored lost speed for x22i & x25x. + +v3.11.2 + +Fixed x11gost (sib) AVX2 invalid shares. + +Fixed x16r, x16rv2, x16s, x16rt, x16rt-veil (veil), x21s. +No shares were submitted when cube, shavite or echo were the first function +in the hash order. + +Fixed all algos reporting stats problems when mining with SSE2. + +Faster Lyra2 AVX512: lyra2z +47%, lyra2rev3 +11%, allium +13%, x21s +6% + +Other minor performance improvements. + +Known issue: + +Lyra2 AVX512 improvements paradoxically reduced performance on x22i and x25x. +https://github.com/JayDDee/cpuminer-opt/issues/225 + +v3.11.1 + +Faster panama for x25x AVX2 & AVX512. + +Fixed echo VAES for Xevan. + +Removed support for scryptjane algo. + +Reverted macro implemtations of hash functions to SPH reference code +for SSE2 versions of algos. + +v3.11.0 + +Fixed x25x AVX512 lane 4 invalid shares. + +AVX512 for hex, phi2. + +VAES optimzation for Intel Icelake CPUs for most algos recently optimized +with AVX512, source code only. + +v3.10.7 + +AVX512 for x25x, lbry, x13bcd (bcd). + +v3.10.6 + +Added support for SSL stratum: stratum+tcps:// + +Added job id reporting again, but leaner, suppressed with --quiet. + +AVX512 for x21s, x22i, lyra2z, allium. + +Fixed share overflow warnings mining lbry with Ryzen (SHA). + +v3.10.5 + +AVX512 for x17, sonoa, xevan, hmq1725, lyra2rev3, lyra2rev2. +Faster hmq1725 AVX2. + +v3.10.4 + +AVX512 for x16r, x16rv2, x16rt, x16s, x16rt-veil (veil). + +v3.10.3 + +AVX512 for x12, x13, x14, x15. +Fixed x12 AVX2 invalid shares. + +v.10.2 + +AVX512 added for bmw512, c11, phi1612 (phi), qubit, skunk, x11, x11gost (sib). +Fixed c11 AVX2 invalid shares. + +v3.10.1 + +AVX512 for blake2b, nist5, quark, tribus. + +More broken lane fixes, fixed buffer overflow in skein AVX512, fixed +quark invalid shares AVX2. + +Only the highest ranking feature in a class is listed at startup, lower ranking +features are available but no longer listed. + +v3.10.0 + +AVX512 is now supported on selected algos, Windows binary is now available. +AVX512 optimizations are available for argon2d, blake2s, keccak, keccakc, +skein & skein2. + +Fixed CPU temperature for some CPU models (Linux only). + +Fixed a bug that caused some lanes not to submit shares. + +Fixed some previously undetected buffer overflows. + +Lyra2rev2 3% faster SSE2 and AVX2. + +Added "-fno-asynchronous-unwind-tables" to AVX512 build script for Windows +to fix known mingw issue. + +Changed AVX2 build script to explicitly add AES to address change in +behaviour in GCC 9. + +v3.9.11 + +Added x22i & x25x algos. +Blake2s 2% faster AVX2 with Intel CPU, slower with Ryzen v1, v2 ? + +v3.9.10 + +Faster X* algos with AVX2. +Small improvements to summary stats report. + +v3.9.9.1 + +Fixed a day1 bug that could cause the miner to idle for up to 2 minutes +under certain circumstances. + +Redesigned summary stats report now includes session statistics. + +More robust handling of statistics to reduce corruption. + +Removed --hide-diff option. + +Better handling of cpu-affinity with more than 64 CPUs. + +v3.9.9 + +Added power2b algo for MicroBitcoin. +Added generic yespower-b2b (yespower + blake2b) algo to be used with +the parameters introduced in v3.9.7 for yespower & yescrypt. +Display additional info when a share is rejected. +Some low level enhancements and minor tweaking of log output. +RELEASE_NOTES (this file) and README.md added to Windows release package. + +v3.9.8.1 + +Summary log report will be generated on stratum diff change or after 5 minutes, +whichever comes first, to prevent incorrect data in the report. + +Removed phi2-lux alias (introduced in v3.9.8) due to Luxcoin's planned fork +to a new algo. The new Luxcoin algo is not supported by cpuminer-opt. +Until the fork Luxcoin can be mined using phi2 algo. + +--hide-diff option is deprecated and has no effect. It will be removed in a +future release. + +v3.9.8 + +Changes to log output to provide data more relevant to actual mining +performance. +phi2 can now handle pools with a mix of coins that use and don't use roots. +phi2-lux added as an alias for phi2 as they are identical except for roots. +Add x16rv2 algo for Ravencoin fork. + +v3.9.7 + +Command line option changes: + +"-R" is no longer used as a shortcut for "--retry-pause", users must +use the long option. + +New options: + +-N, --param-n: set the N parameter for yescrypt, yespower or scrypt algos +-R, --param-r: set the R parameter for yescrypt or yespower algos, scrypt is + hardcoded with R=1 +-K, --param-key: set the client key/pers parameter for yescrypt/yespower algos. + +These options can be used to mine yescrypt or yespower variations using +the generic yescrypt or yespower algo name and specifying the parameters +manually. They can even be used to mine variations that aren't formally +supported by a unique algo name. Existing algos can continue to to be mined +using their original name without parameters. + +v3.9.6.2 + +New algo blake2b. +Faster myr-gr on Ryzen using SHA. +Faster blake2s SSE2. +Small speedup of around 1% for several other algos. + +v3.9.6.1 + +New algos: x21s, hex (alias x16r-hex). + +v3.9.6 + +New algos: bmw512, x16rt, x16rt-veil (alias veil), x13bcd (alias bcd). + +v3.9.5.4 + +Fixed sha256q AVX2 poor performance. +Fixed skein2 buffer overflow and restored bswap-interleave optimization. +More restructuring. + +v3.9.5.3 + +Fix crash mining hodl with aes-sse42. +More restructuring and share report tweaks. + +v3.9.5.2 + +Revert bswap-interleave optimization for causing crashes on Windows. + +v3.9.5.1 + +Fixed skein2 crash on Windows. + +Fixed CPU temperature reading on Ubuntu 19.04. + +Realigned log message colours, blue is used to report normal activity and +yellow is only used to report abnormal activity. + +Changed stats colours, yellow now means below average, white is average +range. Tweaked colour thresholds. + +Changed colour of stratum difficulty change messages to blue to match other +normal protocol messages. Blue messages (block, stratum, submit) will no +longer be displayed when using -q option. + +Added job id to new block, share submit, and share result messages and added +new nessage when a new job is received for an existing block. This will for +better troubleshooting of invalid job id rejects seen at zergpool. + +Some more restructuring. + +v3.9.5 + +New share reporting information includes calculation of equivalent hashrate +based on share difficulty, network latency, 5 minute summary. +Per-thread hash rate reports are disabled by default. +New command line option --hash-meter added to enable per-thread hash rates. + + +v3.9.4 + +Faster AVX2 for lyra2v3, quark, anime. +Fixed skein AVX2 regression (invalid shares since v3.9.0) and faster. +Faster skein2 with 4way AVX2 enabled. +Automatic SHA override on Ryzen CPUs, no need for -DRYZEN compile flag. +Ongoing restructuring. + +v3.9.3.1 + +Skipped v3.9.3 due to misidentification of v3.9.2.5 as v3.9.3. +Fixed x16r algo 25% invalid share reject rate. The bug may have also +affected other algos. + +v3.9.2.5 + +Fixed 2 regressions: hodl AES detection, x16r invalid shares with AVX2. +More restructuring. + +v3.9.2.4 + +Yet another affinity fix. Hopefully the last one. + +v3.9.2.3 + +Another cpu-affinity fix. +Disabled test code that fails to compile on some CPUs with limited +AVX512 capabilities. + +v3.9.2.2 + +Fixed some day one cpu-affinity issues. + +v3.9.2 + +Added sha256q algo. +Yespower now uses openssl SHA256, but no observable hash rate increase +on Ryzen. +Ongoing rearchitecting. +Lyra2z now hashes 8-way on CPUs with AVX2. +Lyra2 (all including phi2) now runs optimized code with SSE2. + +v3.9.1.1 + +Fixed lyra2v3 AVX and below. + +Compiling on Windows using Cygwin now works. Simply use "./build.sh" +just like on Linux. It isn't portable therefore the binaries package will +continue to use the existing procedure. +The Cygwin procedure will be documented in more detail later and will +include a list of packages that need to be installed. + +v3.9.1 + +Fixed AVX2 version of anime algo. + +Added sonoa algo. + +Added "-DRYZEN_" compile option for Ryzen to override 4-way hashing when algo +contains sha256 and use SHA instead. This is due to a combination of +the introduction of HW SHA support combined with the poor performance +of AVX2 on Ryzen. The Windows binaries package replaces cpuminer-avx2-sha +with cpuminer-zen compiled with the override. Refer to the build instructions +for more information. + +Ongoing restructuring to streamline the process, reduce latency, +reduce memory usage and unnecessary copying of data. Most of these +will not result in a notoceably higher reported hashrate as the +change simply reduces the time wasted that wasn't factored into the +hash rate reported by the miner. In short, less dead time resulting in +a higher net hashrate. + +One of these measures to reduce latency also results in an enhanced +share submission message including the share number*, the CPU thread, +and the vector lane that found the solution. The time difference between +the share submission and acceptance (or rejection) response indicates +network ltatency. One other effect of this change is a reduction in hash +meter messages because the scan function no longer exits when a share is +found. Scan cycles will go longer and submit multiple shares per cycle. +*the share number is antcipated and includes both accepted and rejected +shares. Because the share is antipated and not synchronized it may be +incorrect in time of very rapid share submission. Under most conditions +it should be easy to match the submission with the corresponding response. + +Removed "-DUSE_SPH_SHA" option, all users should have a recent version of +openssl installed: v1.0.2 (Ubuntu 16.04) or better. Ryzen SHA requires +v1.1.0 or better. Ryzen SHA is not used when hashing multi-way parallel. +Ryzen SHA is available in the Windows binaries release package. + +Improved compile instructions, now in seperate files: INSTALL_LINUX and +INSTALL_WINDOWS. The Windows instructions are used to build the binaries +release package. It's built on a Linux system either running as a virtual +machine or a seperate computer. At this time there is no known way to +build natively on a Windows system. + +v3.9.0.1 + +Isolate Windows CPU groups code when CPU groups support not explicitly defined. + +v3.9.0 + +Added support for Windows CPU groups. +Fixed BIP34 coinbase height. +Prep work for AVX512. +Added lyra2rev3 for the vertcoin algo change. +Added yespower, yespowerr16 (Yenten) +Added phi2 algo for LUX +Discontinued support for cryptonight and variants. + +v3.8.8.1 + +Fixed x16r. +Removed cryptonight variant check due to false positives. +API displays hashrate before shares are submitted. + +v3.8.8 + +Added cryptonightv7 for Monero. + +v3.8.7.2 + +Fixed argon2d-dyn regression in v3.8.7.1. +Changed compile options for aes-sse42 Windows build to -march=westmere + +v3.8.7.1 + +Fixed argon2d-uis low difficulty rejects. +Fixed argon2d aliases. + +v3.8.7 + +Added argon2d4096 (alias argon2d-uis) for Unitus (UIS). +argon2d-crds and argon2d-dyn renamed to argon2d250 and argon2d500 respectively. + The old names are recognized as aliases. +AVX512 is now supported for argon2d algos, Linux only. +AVX is no longer a reported feature and an AVX Windows binary is no longer + provided. Use AES-SSE42 build instead. + +v3.8.6.1 + +Faster argon2d* AVX2. +Untested AVX-512 for argon2d*, YMMV. + +v3.8.6 + +Fixed argon2 regression in v3.8.5. +Added x16s algo for Pigeoncoin. +Some code cleanup. + +v3.8.5 + +Added argon2d-crds and argon2d-dyn algos. +sha256t 8 way AVX2 & 4 way SSE4.2 optimized. +CPUs with SSE4.2 get optimizations previously reserved for AVX. + +v3.8.4.1 + +Fixed sha256t low difficulty rejects. +Fixed compile error on CPUs with AVX512. + +v3.8.4 + +Added yescryptr32 algo for WAVI coin. +Added URL to API data. +Improved detection of __int128 support (linux only) +Compile support for CPUs without SSSE3 (no binary support) + +v3.8.3.3 + +Integrated getblocktemplate with algo_gate. +Added support for hodl gbt (untested). +Reworked some recent quick fixes. + +v3.8.3.2 + +Reverted gbt changes from v3.8.0 that broke getwork. +Reverted scaled hash rate for API, added HS term in addition to KHS. +Added blocks solved to console display and API. + +v3.8.3.1 + +Fixed regression in v3.8.3 that broke several algos. + +v3.8.3 + +More restoration of lost lyra2 hash. +8 way AVX2 and 4way AVX optimization for blakecoin, vanilla & blake2s. +8 way AVX2 for lbry. +Scaled hashrate for API output. +A couple of GBT fixes. + +v3.8.2.1 + +Fixed low difficulty rejects with allium. +Fixed qubit AVX2. +Restored lyra2z lost hash. +Fixed build.sh + +v3.8.2 + +Fixed and faster myr-gr. +Added x12 algo (Galaxie Cash), allium algo (Garlicoin). +Faster lyra2rev2, lbry, skein. +Large reduction in compiler warnings. + +v3.8.1.1 + +Fixed Windows AVX2 crash. + +v3.8.1 + +Fixes x16r on CPUs with only SSE2. +More Optimizations for X algos, qubit & deep. +Corrected algo optimizations for scrypt and yescrypt, no new optimizations. + +v3.8.0.1 + +Fixed x16r AVX2 low hash rate. + +v3.8.0 + +4way no longer a seperate feature, included in AVX2. +Added x16r algo for Ravencoin, anime algo for Animecoin. +More 4way optimizations for X13 and up. +Tweaked CPU affinity to better support more than 64 CPUs. +Fixed compile problem on some old AMD CPUs. + +v3.7.10 + +4way optimizations for lyra2rev2, lyra2h, quark, timetravel8, timetravel10 + x11evo, blakecoin. +Faster x13sm3 (hsr). +Added share difficulty to accepted message. + +v3.7.9 + +Partial 4way optimizations for veltor, skunk, polytimos, lyra2z. +Additional 4way optimizations for X algos. +New algo yescryptr8 for BitZeny, not to be confused with original +yescrypt Globalboost-Y. + +v3.7.8 + +Partial 4way optimization for most X algos including c11, xevan, phi, hsr + +v3.7.7 + +Fixed regression caused by 64 CPU support. +Fixed lyra2h. + +v3.7.6 + +Added lyra2h algo for Hppcoin. +Added support for more than 64 CPUs. +Optimized shavite512 with AES, improves x11 etc. + +v3.7.5 + +New algo keccakc for Creative coin with 4way optimizations + +Rewrote some AVX/AVX2 code for more consistent implementation and some +optimizing. + +Enhanced capabilities check to support 4way, more precise reporting of +features (not all algos use SSE2), and better error messages when using +an incompatible pre-built version (Windows users). + +v3.7.4 + +Removed unnecessary build options. + +Added 4way support for tribus and nist5. + +v3.7.3 + +Added polytimos algo. + +Introducing 4-way AVX2 optimization giving up to 4x performance inprovement +on many compute bound algos. First supported algos: skein, skein2, blake & +keccak. This feature is only available when compiled from source. See above +for instcuctions how to enable 4-way during compilation. + +Updated Dockerfile. + +v3.7.2 + +Fixed yescryptr16 +Changed default sha256 and sha512 to openssl. This should be used when +compiling with openssl 1.0.2 or higher (Ubuntu 16.04). +This should increase the hashrate for yescrypt, yescryptr16, m7m, xevan, skein, +myr-gr & others when openssl 1.0.2 is installed. +Note: -DUSE_SPH_SHA has been removed in v3.9.1. +Users with openssl 1.0.1 (Ubuntu 14.04) may get better perforance by adding +"-DUSE_SPH_SHA" to CLAGS. +Windows binaries are compiled with -DUSE_SPH_SHA and won't get the speedup. + +v3.7.1 + +Added yescryptr16 algo for Yenten coin +Added SHA support to yescrypt and yescryptr16 +Small code cleanup + +v3.7.0 + +Fixed x14 misalignment bug. +Fixed decred stake version bug. +Getwork fixes for algos that use big endian data encoding: m7m, zr5, neoscrypt, +decred. + +v3.6.10 + +Fixed misalignment bug in hsr. + +v3.6.9 + +Added phi1612 algo for LUX coin +Added x13sm3 algo, alias hsr, for Hshare coin + +v3.6.8 + +Fixed timetravel10 on Windows. + +v3.6.7 + +Skunk algo added. +Tribus a little faster. +Minor restructuring. + +v3.6.6 + +added tribus algo for Denarius (DNR) + +configure removed from .gitignore. This should allow git clone to compile +on Windows/mingw. + +Fixed CPU temperature monitoring on some CPUs (Linux only). + +Fixed a compile error on FreeBSD (unsupported YMMV). + +v3.6.5 + +Cryptonight a little faster. +Added jha algo (Jackpotcoin) with AES optimizations. + +v3.6.4 + +Added support for Bitcore (BTX) using the timetravel10 algo, optimized for +AES and AVX2. +"-a bitcore" works as an alias and is less typing that "-a timetravel10". + +v3.6.3 + +Fixed all known issues with SHA support on AMD Ryzen CPUs, still no + Windows binaries. + +v3.6.2 + +SHA accceleration is now supported on AMD Ryzen CPUs when compiled from source, + Windows binaries not yet available. +Fixed groestl algo. +Fixed dmd-gr (Diamond) algo. +Fixed lbry compile error on Ryzen. +Added SHA support to m7m algo. +Hodl support for CPUs without AES has been removed, use legacy version. + +v3.6.1 + +Fixed data alignment issue that broke lyra2rev2 AVX2 on Windows. +Added preliminary support for HW accelerated SHA. +Solo mining most algos should now work, cryptonight confirmed exception. + +v3.6.0 + +Preliminary support for solo mining using getwork. + +v3.5.13 + +Found more speed in Cubehash, algo improvement depends on chain length, + deep +8%, timetravel +1% , xevan +1% +Fixed a getwork bug, solo mining is not yet supported but testing is encouraged + +v3.5.12 + +New algo sha256t for Onecoin (OC), 29% faster than ocminer version. +lyra2zoin algo renamed to lyra2z330, lyra2zoin and zoin still work + as aliases. + +v3.5.11 + +Fixed hmq1725 crash on Ubuntu 16.04 +Fixed compile error in hodl.cpp with gcc 6.3 +Fixed x11 crash on Windows with AVX2 + +v3.5.10 + +Some AVX2 optimizations introduced for Luffa, shorter chained algos such + as Qubit and Deep should see the biggest gains, but many other algos should + also see improvement, longer chains like xevan not so much. +Rewrite of Groestl AES, now 100% vectorized, small improvement. +build.sh and winbuild.sh initialize with distclean instead of clean. +Implemented a workaround for a compile error in hodl code when compiling + with gcc 6.3. + +V3.5.9 + +Reduced stack usage for hmq1725 and small speedup. +Added Deep algo optimized for AES and AVX2 +Rewrite of SSE2 Luffa, midstate now supported in deep, qubit & timetravel +Small changes to algo-gate. + +v3.5.8 + +Lyra2RE fixed on Windows, broken in v3.5.6. +Ported AES cryptonight optimizations from v3.5.7 to non-AES version + with little improvement. +Marginal improvements to xevan and veltor. + +v3.5.7 + +Cryptonight 5% faster + +v3.5.6 + +Updated Lyra2z algo for new zcoin algo post block 2050. +Cleaned up Lyra2 code and increased performance + - Lyra2Z (zcoin) +12% + - Lyra2REv2 +11% + - Lyra2RE +6% +Fixed x11evo algo performance on Windows. +Timetravel algo 3% to 5% faster +Whirlpool algo 15% faster. +Removed aclocal.m4 from .gitignore. + +v3.5.5 + +x11evo fixed on Windows but at reduced performance. +Changed benchmark stats collection default to false and + added proper user and password checks to enable it. + +v3.5.4 + +x11evo fixed (broken in v3.5.2) and optimized 23% faster +Small improvements of 1% to 3% on many algos including timetravel, + xevan and cryptonight. +More code cleanup and compiler warning reduction. +Improved checking for missing command line arguments. + +v3.5.3 + +More optimizations + Timetravel +16% + Xevan +3% + Qubit +12% + +V3.5.2 + +Timetravel (machinecoin) added and optimized. + +v3.5.1 + +Bastion 9% faster with AES, benchkmark still not working. +Worked around git automatically removing m4 directory. +Fixed occasional compile error in algo-gate.h. + +v3.5.0 + +Fixed blakecoin and vanilla increasing rejects with number of threads. +Removed support for SSE2 Groestl functions. SSE2 groestl remains available + in v3.4.12 and the legacy branch. +It is no longer necessary to specify stratum+tcp:// in the url, it is assumed + and is the only supported protocol. + +v3.4.12 + +lyra2z (zcoin) modified for blocks after 8192 +fixed scryptjane to support various N factors + +v3.4.11 + +groestl algo AES optimized +200% +myr-gr algo AES optimized +100% + +v3.4.10 + +xevan AES optimized +35% + +v3.4.9 + +fixed zr5, broken in v3.4.8 +added xevan algo (Bitsend, BSD) with 10% improvement +added lyra2zoin (Zoin, ZOI) fully optimized but YMMV + +v3.4.8 + +added zcoin support, optimized for AVX2 but no increase in performance +fixed API display of diff for cryptonight +--show-diff is now the default, use "--hide-diff" to disable +cleaned up some cpuminer-multi artifacts + +v3.4.7 + +fixed benchmark, except for x11evo +added CPU temperature to share submission report (Linux only) + +v3.4.6 + +For users: +- cryptolight algo is now supported with AES optimizations +- display format changed for share submissions + - colour keyed "Accepted" or "Rejected" status. + - reject count and rate displayed when share is rejected. + +For developers: + +- code restructuring for detecting new work + - cleaned up detection and handling of new work + - removed call to stratum_gen_work from niner_thread. + - eliminated gen_work_now gate function. + - renamed gate function init_nonce to get_new_work. + - renamed gate function alloc_scratchbuf to miner_thread_init, + removed all scracthbuf references from miner_thread and moved + implementation to the local algo files of those algos that need it. + - moved most gate targets from algo-gate.c to cpu-miner.c removing + most mining related code from algo-gate-api.c. + +v3.4.5 + +fixed stale share rejects mining cryptonight at Nicehash +fixed compile error on Westmere CPUs + +v3.4.4 + +fixed compile errors on Westmere CPUs, this is an interim fix that + will compile without AES on Westmere +added support for cryptonight at Nicehash, some rejects may be produced + at Nicehash only. + +v3.4.3 + +imported optimized m7m, +42% + +v3.4.2 + +added veltor algo +tweaked lyra2 AVX/AVX2 code for small improvement. + +v3.4.1 + +big AVX2 optmizations for lyra2 +35%, lyra2v2 +11%, AVX also faster +fixed hmq1725 + +v3.4.0 + +fixed Windows compile error introduced in v3.3.9 +fixed x11gost, broken in v3.3.7 +AVX2 optimizations improving many algos: + - Lyra2RE +3% + - Lyra2REv2 +19% + - x11gost (sib) +6% + - x11evo +2.4% + - c11 +6.9% + - x11 +5% + - x13 +5% + - x14 +3.6% + - x15 +2.4% + - x17 +2.8% + - qubit +8.4% + diff --git a/rin/miner/cpuminer/aclocal.m4 b/rin/miner/cpuminer/aclocal.m4 new file mode 100644 index 0000000..0fdbb06 --- /dev/null +++ b/rin/miner/cpuminer/aclocal.m4 @@ -0,0 +1,1206 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# Figure out how to run the assembler. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AS +# ---------- +AC_DEFUN([AM_PROG_AS], +[# By default we simply use the C compiler to build assembly code. +AC_REQUIRE([AC_PROG_CC]) +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS +AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) +AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/rin/miner/cpuminer/algo-gate-api.c b/rin/miner/cpuminer/algo-gate-api.c new file mode 100644 index 0000000..5bb4581 --- /dev/null +++ b/rin/miner/cpuminer/algo-gate-api.c @@ -0,0 +1,465 @@ +///////////////////////////// +//// +//// NEW FEATURE: algo_gate +//// +//// algos define targets for their common functions +//// and define a function for miner-thread to call to register +//// their targets. miner thread builds the gate, and array of structs +//// of function pointers, by calling each algo's register function. +// Functions in this file are used simultaneously by myultiple +// threads and must therefore be re-entrant. + +#include +#include +#include +#include +#include +#include +#include "algo-gate-api.h" + +// Define null and standard functions. +// +// Generic null functions do nothing except satisfy the syntax and +// can be used for optional safe gate functions. +// +// null gate functions are genarally used for mandatory and unsafe functions +// and will usually display an error massage and/or return a fail code. +// They are registered by default and are expected to be overwritten. +// +// std functions are non-null functions used by the most number of algos +// are are default. +// +// aux functions are functions used by many, but not most, algos and must +// be registered by eech algo using them. They usually have descriptive +// names. +// +// custom functions are algo spefic and are defined and registered in the +// algo's source file and are usually named [algo]_[function]. +// +// In most cases the default is a null or std function. However in some +// cases, for convenience when the null function is not the most popular, +// the std function will be defined as default and the algo must register +// an appropriate null function. +// +// similar algos may share a gate function that may be defined here or +// in a source file common to the similar algos. +// +// gate functions may call other gate functions under the following +// restrictions. Any gate function defined here or used by more than one +// algo must call other functions using the gate: algo_gate.[function]. +// custom functions may call other custom functions directly using +// [algo]_[function], howver it is recommended to alway use the gate. +// +// If, under rare circumstances, an algo with a custom gate function +// needs to call a function of another algo it must define and register +// a private gate from its rgistration function and use it to call +// forein functions: [private_gate].[function]. If the algo needs to call +// a utility function defined here it may do so directly. +// +// The algo's gate registration function is caled once from the main thread +// and can do other intialization in addition such as setting options or +// other global or local (to the algo) variables. + +// A set of predefined generic null functions that can be used as any null +// gate function with the same signature. + +void do_nothing () {} +bool return_true () { return true; } +bool return_false () { return false; } +void *return_null () { return NULL; } + +void algo_not_tested() +{ + applog( LOG_WARNING,"Algo %s has not been tested live. It may not work", + algo_names[opt_algo] ); + applog(LOG_WARNING,"and bad things may happen. Use at your own risk."); +} + +void four_way_not_tested() +{ + applog( LOG_WARNING,"Algo %s has not been tested using 4way. It may not", algo_names[opt_algo] ); + applog( LOG_WARNING,"work or may be slower. Please report your results."); +} + +void algo_not_implemented() +{ + applog(LOG_ERR,"Algo %s has not been Implemented.",algo_names[opt_algo]); +} + +// default null functions +// deprecated, use generic as default +int null_scanhash() +{ + applog(LOG_WARNING,"SWERR: undefined scanhash function in algo_gate"); + return 0; +} + +// Default generic scanhash can be used in many cases. Not to be used when +// prehashing can be done or when byte swapping the data can be avoided. +int scanhash_generic( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint32_t edata[20] __attribute__((aligned(64))); + uint32_t hash[8] __attribute__((aligned(64))); + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + const uint32_t last_nonce = max_nonce - 1; + uint32_t n = first_nonce; + const int thr_id = mythr->id; + const bool bench = opt_benchmark; + + v128_bswap32_80( edata, pdata ); + do + { + edata[19] = n; + if ( likely( algo_gate.hash( hash, edata, thr_id ) ) ) + if ( unlikely( valid_hash( hash, ptarget ) && !bench ) ) + { + pdata[19] = bswap_32( n ); + submit_solution( work, hash, mythr ); + } + n++; + } while ( n < last_nonce && !work_restart[thr_id].restart ); + *hashes_done = n - first_nonce; + pdata[19] = n; + return 0; +} + +#if defined(__AVX2__) + +//int scanhash_4way_64_64( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +//int scanhash_4way_64_640( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +int scanhash_4way_64in_32out( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint32_t hash32[8*4] __attribute__ ((aligned (64))); + uint32_t vdata[20*4] __attribute__ ((aligned (64))); + uint32_t lane_hash[8] __attribute__ ((aligned (64))); + uint32_t *hash32_d7 = &(hash32[ 7*4 ]); + uint32_t *pdata = work->data; + const uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + const uint32_t last_nonce = max_nonce - 4; + __m256i *noncev = (__m256i*)vdata + 9; + uint32_t n = first_nonce; + const int thr_id = mythr->id; + const uint32_t targ32_d7 = ptarget[7]; + const bool bench = opt_benchmark; + + mm256_bswap32_intrlv80_4x64( vdata, pdata ); + // overwrite byte swapped nonce with original byte order for proper + // incrementing. The nonce only needs to byte swapped if it is to be + // sumbitted. + *noncev = mm256_intrlv_blend_32( + _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ), *noncev ); + do + { + if ( likely( algo_gate.hash( hash32, vdata, thr_id ) ) ) + for ( int lane = 0; lane < 4; lane++ ) + if ( unlikely( hash32_d7[ lane ] <= targ32_d7 && !bench ) ) + { + extr_lane_4x32( lane_hash, hash32, lane, 256 ); + if ( valid_hash( lane_hash, ptarget ) ) + { + pdata[19] = bswap_32( n + lane ); + submit_solution( work, lane_hash, mythr ); + } + } + *noncev = _mm256_add_epi32( *noncev, + _mm256_set1_epi64x( 0x0000000400000000 ) ); + n += 4; + } while ( likely( ( n <= last_nonce ) && !work_restart[thr_id].restart ) ); + pdata[19] = n; + *hashes_done = n - first_nonce; + return 0; +} + +//int scanhash_8way_32_32( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +#endif + +#if defined(SIMD512) + +//int scanhash_8way_64_64( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +//int scanhash_8way_64_640( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +int scanhash_8way_64in_32out( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint32_t hash32[8*8] __attribute__ ((aligned (128))); + uint32_t vdata[20*8] __attribute__ ((aligned (64))); + uint32_t lane_hash[8] __attribute__ ((aligned (64))); + uint32_t *hash32_d7 = &(hash32[7*8]); + uint32_t *pdata = work->data; + const uint32_t *ptarget = work->target; + const uint32_t first_nonce = pdata[19]; + const uint32_t last_nonce = max_nonce - 8; + __m512i *noncev = (__m512i*)vdata + 9; + uint32_t n = first_nonce; + const int thr_id = mythr->id; + const uint32_t targ32_d7 = ptarget[7]; + const bool bench = opt_benchmark; + + mm512_bswap32_intrlv80_8x64( vdata, pdata ); + *noncev = mm512_intrlv_blend_32( + _mm512_set_epi32( n+7, 0, n+6, 0, n+5, 0, n+4, 0, + n+3, 0, n+2, 0, n+1, 0, n, 0 ), *noncev ); + do + { + if ( likely( algo_gate.hash( hash32, vdata, thr_id ) ) ) + for ( int lane = 0; lane < 8; lane++ ) + if ( unlikely( ( hash32_d7[ lane ] <= targ32_d7 ) && !bench ) ) + { + extr_lane_8x32( lane_hash, hash32, lane, 256 ); + if ( likely( valid_hash( lane_hash, ptarget ) ) ) + { + pdata[19] = bswap_32( n + lane ); + submit_solution( work, lane_hash, mythr ); + } + } + *noncev = _mm512_add_epi32( *noncev, + _mm512_set1_epi64( 0x0000000800000000 ) ); + n += 8; + } while ( likely( ( n < last_nonce ) && !work_restart[thr_id].restart ) ); + pdata[19] = n; + *hashes_done = n - first_nonce; + return 0; +} + +//int scanhash_16way_32_32( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ) + +#endif + + + +int null_hash() +{ + applog(LOG_WARNING,"SWERR: null_hash unsafe null function"); + return 0; +}; + +static void init_algo_gate( algo_gate_t* gate ) +{ + gate->miner_thread_init = (void*)&return_true; + gate->scanhash = (void*)&scanhash_generic; + gate->hash = (void*)&null_hash; + gate->get_new_work = (void*)&std_get_new_work; + gate->work_decode = (void*)&std_le_work_decode; + gate->decode_extra_data = (void*)&do_nothing; + gate->gen_merkle_root = (void*)&sha256d_gen_merkle_root; + gate->build_stratum_request = (void*)&std_le_build_stratum_request; + gate->malloc_txs_request = (void*)&std_malloc_txs_request; + gate->submit_getwork_result = (void*)&std_le_submit_getwork_result; + gate->build_block_header = (void*)&std_build_block_header; + gate->build_extraheader = (void*)&std_build_extraheader; + gate->set_work_data_endian = (void*)&do_nothing; +// gate->resync_threads = (void*)&do_nothing; +// gate->do_this_thread = (void*)&return_true; + gate->longpoll_rpc_call = (void*)&std_longpoll_rpc_call; + gate->get_work_data_size = (void*)&std_get_work_data_size; + gate->optimizations = EMPTY_SET; + gate->ntime_index = STD_NTIME_INDEX; + gate->nbits_index = STD_NBITS_INDEX; + gate->nonce_index = STD_NONCE_INDEX; + gate->work_cmp_size = STD_WORK_CMP_SIZE; +} + +// Ignore warnings for not yet defined register functions +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" + +// Called once by main +bool register_algo_gate( int algo, algo_gate_t *gate ) +{ + bool rc = false; + + if ( NULL == gate ) + { + applog(LOG_ERR,"FAIL: algo_gate registration failed, NULL gate\n"); + return false; + } + + init_algo_gate( gate ); + + switch ( algo ) + { + case ALGO_ALLIUM: rc = register_allium_algo ( gate ); break; + case ALGO_ANIME: rc = register_anime_algo ( gate ); break; + case ALGO_ARGON2D250: rc = register_argon2d250_algo ( gate ); break; + case ALGO_ARGON2D500: rc = register_argon2d500_algo ( gate ); break; + case ALGO_ARGON2D4096: rc = register_argon2d4096_algo ( gate ); break; + case ALGO_AXIOM: rc = register_axiom_algo ( gate ); break; + case ALGO_BLAKE: rc = register_blake_algo ( gate ); break; + case ALGO_BLAKE2B: rc = register_blake2b_algo ( gate ); break; + case ALGO_BLAKE2S: rc = register_blake2s_algo ( gate ); break; + case ALGO_BLAKECOIN: rc = register_blakecoin_algo ( gate ); break; + case ALGO_BMW512: rc = register_bmw512_algo ( gate ); break; + case ALGO_C11: rc = register_c11_algo ( gate ); break; + case ALGO_DEEP: rc = register_deep_algo ( gate ); break; + case ALGO_DMD_GR: rc = register_dmd_gr_algo ( gate ); break; + case ALGO_GROESTL: rc = register_groestl_algo ( gate ); break; + case ALGO_HEX: rc = register_hex_algo ( gate ); break; + case ALGO_HMQ1725: rc = register_hmq1725_algo ( gate ); break; + case ALGO_JHA: rc = register_jha_algo ( gate ); break; + case ALGO_KECCAK: rc = register_keccak_algo ( gate ); break; + case ALGO_KECCAKC: rc = register_keccakc_algo ( gate ); break; + case ALGO_LBRY: rc = register_lbry_algo ( gate ); break; + case ALGO_LYRA2H: rc = register_lyra2h_algo ( gate ); break; + case ALGO_LYRA2RE: rc = register_lyra2re_algo ( gate ); break; + case ALGO_LYRA2REV2: rc = register_lyra2rev2_algo ( gate ); break; + case ALGO_LYRA2REV3: rc = register_lyra2rev3_algo ( gate ); break; + case ALGO_LYRA2Z: rc = register_lyra2z_algo ( gate ); break; + case ALGO_LYRA2Z330: rc = register_lyra2z330_algo ( gate ); break; + case ALGO_M7M: rc = register_m7m_algo ( gate ); break; + case ALGO_MINOTAUR: rc = register_minotaur_algo ( gate ); break; + case ALGO_MINOTAURX: rc = register_minotaur_algo ( gate ); break; + case ALGO_MYR_GR: rc = register_myriad_algo ( gate ); break; + case ALGO_NEOSCRYPT: rc = register_neoscrypt_algo ( gate ); break; + case ALGO_NIST5: rc = register_nist5_algo ( gate ); break; + case ALGO_PENTABLAKE: rc = register_pentablake_algo ( gate ); break; + case ALGO_PHI1612: rc = register_phi1612_algo ( gate ); break; + case ALGO_PHI2: rc = register_phi2_algo ( gate ); break; + case ALGO_POLYTIMOS: rc = register_polytimos_algo ( gate ); break; + case ALGO_POWER2B: rc = register_power2b_algo ( gate ); break; + case ALGO_QUARK: rc = register_quark_algo ( gate ); break; + case ALGO_QUBIT: rc = register_qubit_algo ( gate ); break; + case ALGO_SCRYPT: rc = register_scrypt_algo ( gate ); break; + case ALGO_SHA256D: rc = register_sha256d_algo ( gate ); break; + case ALGO_SHA256DT: rc = register_sha256dt_algo ( gate ); break; + case ALGO_SHA256Q: rc = register_sha256q_algo ( gate ); break; + case ALGO_SHA256T: rc = register_sha256t_algo ( gate ); break; + case ALGO_SHA3D: rc = register_sha3d_algo ( gate ); break; + case ALGO_SHA512256D: rc = register_sha512256d_algo ( gate ); break; + case ALGO_SKEIN: rc = register_skein_algo ( gate ); break; + case ALGO_SKEIN2: rc = register_skein2_algo ( gate ); break; + case ALGO_SKUNK: rc = register_skunk_algo ( gate ); break; + case ALGO_SONOA: rc = register_sonoa_algo ( gate ); break; + case ALGO_TIMETRAVEL: rc = register_timetravel_algo ( gate ); break; + case ALGO_TIMETRAVEL10: rc = register_timetravel10_algo ( gate ); break; + case ALGO_TRIBUS: rc = register_tribus_algo ( gate ); break; + case ALGO_VANILLA: rc = register_vanilla_algo ( gate ); break; + case ALGO_VELTOR: rc = register_veltor_algo ( gate ); break; + case ALGO_VERTHASH: rc = register_verthash_algo ( gate ); break; + case ALGO_WHIRLPOOL: rc = register_whirlpool_algo ( gate ); break; + case ALGO_WHIRLPOOLX: rc = register_whirlpoolx_algo ( gate ); break; + case ALGO_X11: rc = register_x11_algo ( gate ); break; + case ALGO_X11EVO: rc = register_x11evo_algo ( gate ); break; + case ALGO_X11GOST: rc = register_x11gost_algo ( gate ); break; + case ALGO_X12: rc = register_x12_algo ( gate ); break; + case ALGO_X13: rc = register_x13_algo ( gate ); break; + case ALGO_X13BCD: rc = register_x13bcd_algo ( gate ); break; + case ALGO_X13SM3: rc = register_x13sm3_algo ( gate ); break; + case ALGO_X14: rc = register_x14_algo ( gate ); break; + case ALGO_X15: rc = register_x15_algo ( gate ); break; + case ALGO_X16R: rc = register_x16r_algo ( gate ); break; + case ALGO_X16RV2: rc = register_x16rv2_algo ( gate ); break; + case ALGO_X16RT: rc = register_x16rt_algo ( gate ); break; + case ALGO_X16RT_VEIL: rc = register_x16rt_veil_algo ( gate ); break; + case ALGO_X16S: rc = register_x16s_algo ( gate ); break; + case ALGO_X17: rc = register_x17_algo ( gate ); break; + case ALGO_X20R: rc = register_x20r_algo ( gate ); break; + case ALGO_X21S: rc = register_x21s_algo ( gate ); break; + case ALGO_X22I: rc = register_x22i_algo ( gate ); break; + case ALGO_X25X: rc = register_x25x_algo ( gate ); break; + case ALGO_XEVAN: rc = register_xevan_algo ( gate ); break; + case ALGO_YESCRYPT: rc = register_yescrypt_algo ( gate ); break; + case ALGO_YESCRYPTR8: rc = register_yescryptr8_algo ( gate ); break; + case ALGO_YESCRYPTR8G: rc = register_yescryptr8g_algo ( gate ); break; + case ALGO_YESCRYPTR16: rc = register_yescryptr16_algo ( gate ); break; + case ALGO_YESCRYPTR32: rc = register_yescryptr32_algo ( gate ); break; + case ALGO_YESPOWER: rc = register_yespower_algo ( gate ); break; + case ALGO_YESPOWERR16: rc = register_yespowerr16_algo ( gate ); break; + case ALGO_YESPOWER_B2B: rc = register_yespower_b2b_algo ( gate ); break; + case ALGO_ZR5: rc = register_zr5_algo ( gate ); break; + case ALGO_RINHASH: rc = register_rin_algo ( gate ); break; + default: + applog(LOG_ERR,"BUG: unregistered algorithm %s.\n", algo_names[opt_algo] ); + return false; + } // switch + + if ( !rc ) + { + applog(LOG_ERR, "FAIL: %s algorithm failed to initialize\n", algo_names[opt_algo] ); + return false; + } + return true; +} + +// restore warnings +#pragma GCC diagnostic pop + +void exec_hash_function( int algo, void *output, const void *pdata ) +{ + algo_gate_t gate; + gate.hash = (void*)&null_hash; + register_algo_gate( algo, &gate ); + gate.hash( output, pdata, 0 ); +} + +#define PROPER (1) +#define ALIAS (0) + +// The only difference between the alias and the proper algo name is the +// proper name is the one that is defined in ALGO_NAMES. There may be +// multiple aliases that map to the same proper name. +// New aliases can be added anywhere in the array as long as NULL is last. +// Alphabetic order of alias is recommended. +const char* const algo_alias_map[][2] = +{ +// alias proper + { "bcd", "x13bcd" }, + { "bitcore", "timetravel10" }, + { "bitzeny", "yescryptr8" }, + { "blake256r8", "blakecoin" }, + { "blake256r8vnl", "vanilla" }, + { "blake256r14", "blake" }, + { "diamond", "dmd-gr" }, + { "espers", "hmq1725" }, + { "flax", "c11" }, + { "hsr", "x13sm3" }, + { "jackpot", "jha" }, + { "lyra2", "lyra2re" }, + { "lyra2v2", "lyra2rev2" }, + { "lyra2v3", "lyra2rev3" }, + { "myrgr", "myr-gr" }, + { "myriad", "myr-gr" }, + { "neo", "neoscrypt" }, + { "phi", "phi1612" }, + { "scryptn2", "scrypt:1048576" }, + { "sib", "x11gost" }, + { "timetravel8", "timetravel" }, + { "veil", "x16rt-veil" }, + { "x16r-hex", "hex" }, + { "yenten", "yescryptr16" }, + { "ziftr", "zr5" }, + { "rinhash", "rinhash" } +}; + +// if arg is a valid alias for a known algo it is updated with the proper +// name. No validation of the algo or alias is done, It is the responsinility +// of the calling function to validate the algo after return. +void get_algo_alias( char** algo_or_alias ) +{ + int i; + for ( i=0; algo_alias_map[i][ALIAS]; i++ ) + if ( !strcasecmp( *algo_or_alias, algo_alias_map[i][ ALIAS ] ) ) + { + // found valid alias, return proper name + *algo_or_alias = (char*)( algo_alias_map[i][ PROPER ] ); + return; + } +} + +#undef ALIAS +#undef PROPER + diff --git a/rin/miner/cpuminer/algo-gate-api.h b/rin/miner/cpuminer/algo-gate-api.h new file mode 100644 index 0000000..59abc51 --- /dev/null +++ b/rin/miner/cpuminer/algo-gate-api.h @@ -0,0 +1,324 @@ +#ifndef __ALGO_GATE_API_H__ +#define __ALGO_GATE_API_H__ 1 + +#include +#include +#include +#include "miner.h" +#include "simd-utils.h" + +///////////////////////////// +//// +//// NEW FEATURE: algo_gate +//// +//// algos define targets for their common functions +//// and define a function for miner-thread to call to register +//// their targets. miner thread builds the gate, and array of structs +//// of function pointers, by calling each algo's register function. +// +// +// +// So you want to add an algo. Well it is a little easier now. +// Look at existing algos for guidance. +// +// 1. Define the algo, miner.h, previously in cpu-miner.c +// +// 2.Define custom versions of the mandatory function for the new algo. +// +// 3. Next look through the list of unsafe functions to determine +// if any apply to the new algo. If so they must also be defined. +// +// 4. Look through the list of safe functions to see if any apply +// to the new algo. If so look at the null instance of the function +// to see if it satisfies its needs. +// +// 5. If any of the default safe functions are not fit for the new algo +// a custom function will have to be defined. +// +// 6. Determine if other non existant functions are required. +// That is determined by the need to add code in cpu-miner.c +// that applies only to the new algo. That is forbidden. All +// algo specific code must be in the algo's file. +// +// 7. If new functions need to be added to the gate add the type +// to the structure, declare a null instance in this file and define +// it in algo-gate-api.c. It must be a safe optional function so the null +// instance must return a success code and otherwise do nothing. +// +// 8. When all the custom functions are defined write a registration +// function to initialze the gate's function pointers with the custom +// functions. It is not necessary to initialze safe optional null +// instances as they are defined by default, or unsafe functions that +// are not needed by the algo. +// +// 9. Add a case entry to the switch/case in function register_gate +// in file algo-gate-api.c for the new algo. +// +// 10 If a new function type was defined add an entry to init algo_gate +// to initialize the new function to its null instance described in step 7. +// +// 11. If the new algo has aliases add them to the alias array in +// algo-gate-api.c +// +// 12. Include algo-gate-api.h and miner.h inthe algo's source file. +// +// 13. Inlude any other algo source files required by the new algo. +// +// 14. Done, compile and run. + + +// declare some function pointers +// mandatory functions require a custom function specific to the algo +// be defined. +// otherwise the null instance will return a fail code. +// Optional functions may not be required for certain algos or the null +// instance provides a safe default. If the default is suitable for +// an algo it is not necessary to define a custom function. +// + +// my hack at creating a set data type using bit masks. Set inclusion, +// exclusion union and intersection operations are provided for convenience. In // some cases it may be desireable to use boolean algebra directly on the +// data to perform set operations. Sets can be represented as single +// elements, a bitwise OR of multiple elements, a bitwise OR of multiple +// set variables or constants, or combinations of the above. +// Examples: +// +// my_set = set_element; +// another_set = my_set | another_set_element; + +typedef uint32_t set_t; + +#define EMPTY_SET 0 +#define SSE2_OPT 1 // parity with NEON +#define SSSE3_OPT 1 << 1 // Intel Core2 +#define SSE41_OPT 1 << 2 +#define SSE42_OPT 1 << 3 +#define AVX_OPT 1 << 4 // Intel Sandybridge +#define AVX2_OPT 1 << 5 // Intel Haswell, AMD Zen1 +#define AVX512_OPT 1 << 6 // Skylake-X, Zen4 (AVX512[F,VL,DQ,BW]) +#define AES_OPT 1 << 7 // Intel Westmere, AArch64 +#define VAES_OPT 1 << 8 // Icelake, Zen3 +#define SHA256_OPT 1 << 9 // Zen1, Icelake, AArch64 +#define SHA512_OPT 1 << 10 // Intel Arrow Lake, AArch64 +#define NEON_OPT 1 << 11 // AArch64 +#define AVX10_256 1 << 12 +#define AVX10_512 1 << 13 + +// AVX10 does not have explicit algo features: +// AVX10_512 is compatible with AVX512 + VAES +// AVX10_256 is compatible with AVX2 + VAES + +// return set containing all elements from sets a & b +static inline set_t set_union ( set_t a, set_t b ) { return a | b; } + +// return set contained common elements from sets a & b +static inline set_t set_intsec ( set_t a, set_t b) { return a & b; } + +// all elements in set a are included in set b +static inline bool set_incl ( set_t a, set_t b ) { return (a & b) == a; } + +// no elements in set a are included in set b +static inline bool set_excl ( set_t a, set_t b ) { return (a & b) == 0; } + +typedef struct +{ +// Mandatory functions, one of these is mandatory. If a generic scanhash +// is used a custom target hash function must be registered, with a custom +// scanhash the target hash function can be called directly and doesn't need +// to be registered with the gate. +int ( *scanhash ) ( struct work*, uint32_t, uint64_t*, struct thr_info* ); + +int ( *hash ) ( void*, const void*, int ); + +//optional, safe to use default in most cases + +// Called once by each miner thread to allocate thread local buffers and +// other initialization specific to miner threads. +bool ( *miner_thread_init ) ( int ); + +// Get thread local copy of blockheader with unique nonce. +void ( *get_new_work ) ( struct work*, struct work*, int, uint32_t* ); + +// Decode getwork blockheader +bool ( *work_decode ) ( struct work* ); + +// Extra getwork data +void ( *decode_extra_data ) ( struct work*, uint64_t* ); + +bool ( *submit_getwork_result ) ( CURL*, struct work* ); + +void ( *gen_merkle_root ) ( char*, struct stratum_ctx* ); + +// Increment extranonce +void ( *build_extraheader ) ( struct work*, struct stratum_ctx* ); + +void ( *build_block_header ) ( struct work*, uint32_t, uint32_t*, + uint32_t*, uint32_t, uint32_t, + unsigned char* ); + +// Build mining.submit message +void ( *build_stratum_request ) ( char*, struct work*, struct stratum_ctx* ); + +char* ( *malloc_txs_request ) ( struct work* ); + +// Big endian or little endian +void ( *set_work_data_endian ) ( struct work* ); + +// Diverge mining threads +//bool ( *do_this_thread ) ( int ); + +// After do_this_thread +//void ( *resync_threads ) ( int, struct work* ); + +json_t* ( *longpoll_rpc_call ) ( CURL*, int*, char* ); + +set_t optimizations; +int ( *get_work_data_size ) (); +int ntime_index; +int nbits_index; +int nonce_index; // use with caution, see warning below +int work_cmp_size; +} algo_gate_t; + +extern algo_gate_t algo_gate; + +// Declare generic null targets, default for many gate functions +// Functions that use one of these generic targets do not have +// a default defined below. Some algos may override a defined default +// with a generic. +void do_nothing(); +bool return_true(); +bool return_false(); +void *return_null(); +void algo_not_tested(); +void algo_not_implemented(); +void four_way_not_tested(); + +// Warning: algo_gate.nonce_index should only be used in targetted code +// due to different behaviours by different targets. The JR2 index uses an +// 8 bit offset while all others user 32 bit offset. c/c++ pointer arithmetic +// conventions results in different behaviour for pointers with different +// target sizes requiring customized casting to make it work consistently. +// Rant mode: yet another thing I hate about c/c++. Array indexes should +// be scaled, pointer offsets should always be bytes. No confusion and no +// hidden math. + +#define STD_NTIME_INDEX 17 +#define STD_NBITS_INDEX 18 +#define STD_NONCE_INDEX 19 // 32 bit offset +#define STD_WORK_DATA_SIZE 128 +#define STD_WORK_CMP_SIZE 76 + +//#define JR2_NONCE_INDEX 39 // 8 bit offset + +// These indexes are only used with JSON RPC2 and are not gated. +//#define JR2_WORK_CMP_INDEX_2 43 +//#define JR2_WORK_CMP_SIZE_2 33 + +// deprecated, use generic instead +int null_scanhash(); + +// Default generic, may be used in many cases. +// N-way is more complicated, requires many different implementations +// depending on architecture, input format, and output format. +// Naming convention is scanhash_[N]way_[input format]in_[output format]out +// N = number of lanes +// input/output format: +// 32: 32 bit interleaved parallel lanes +// 64: 64 bit interleaved parallel lanes +// 640: input only, not interleaved, contiguous serial 640 bit lanes. +// 256: output only, not interleaved, contiguous serial 256 bit lanes. + +int scanhash_generic( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +#if defined(__AVX2__) + +//int scanhash_4way_64in_64out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +//int scanhash_4way_64in_256out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +int scanhash_4way_64in_32out( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +//int scanhash_8way_32in_32out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +#endif + +#if defined(SIMD512) + +//int scanhash_8way_64in_64out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +//int scanhash_8way_64in_256out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +int scanhash_8way_64in_32out( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +//int scanhash_16way_32in_32out( struct work *work, uint32_t max_nonce, +// uint64_t *hashes_done, struct thr_info *mythr ); + +#endif + +// displays warning +int null_hash(); + +// optional safe targets, default listed first unless noted. + +void std_get_new_work( struct work *work, struct work *g_work, int thr_id, + uint32_t* end_nonce_ptr ); + +void sha256d_gen_merkle_root( char *merkle_root, struct stratum_ctx *sctx ); +void sha256_gen_merkle_root ( char *merkle_root, struct stratum_ctx *sctx ); +// OpenSSL sha256 deprecated +//void SHA256_gen_merkle_root ( char *merkle_root, struct stratum_ctx *sctx ); + +bool std_le_work_decode( struct work *work ); +bool std_be_work_decode( struct work *work ); + +bool std_le_submit_getwork_result( CURL *curl, struct work *work ); +bool std_be_submit_getwork_result( CURL *curl, struct work *work ); + +void std_le_build_stratum_request( char *req, struct work *work ); +void std_be_build_stratum_request( char *req, struct work *work ); + +char* std_malloc_txs_request( struct work *work ); + +// Default is do_nothing, little endian is assumed +void set_work_data_big_endian( struct work *work ); + +void std_build_block_header( struct work* g_work, uint32_t version, + uint32_t *prevhash, uint32_t *merkle_root, + uint32_t ntime, uint32_t nbits, + unsigned char *final_sapling_hash ); + +void std_build_extraheader( struct work *work, struct stratum_ctx *sctx ); + +json_t* std_longpoll_rpc_call( CURL *curl, int *err, char *lp_url ); + +int std_get_work_data_size(); + +// Gate admin functions + +// Called from main to initialize all gate functions and algo-specific data +// by calling the algo's register function. +bool register_algo_gate( int algo, algo_gate_t *gate ); + +// Called by algos to verride any default gate functions that are applicable +// and do any other algo-specific initialization. +// The register functions for all the algos can be declared here to reduce +// compiler warnings but that's just more work for devs adding new algos. +bool register_algo( algo_gate_t *gate ); + +// use this to call the hash function of an algo directly, ie util.c test. +void exec_hash_function( int algo, void *output, const void *pdata ); + +// Validate a string as a known algo and alias, updates arg to proper +// algo name if valid alias, NULL if invalid alias or algo. +void get_algo_alias( char **algo_or_alias ); + +#endif diff --git a/rin/miner/cpuminer/api.c b/rin/miner/cpuminer/api.c new file mode 100644 index 0000000..43fe1ee --- /dev/null +++ b/rin/miner/cpuminer/api.c @@ -0,0 +1,732 @@ +/* + * Copyright 2014 ccminer team + * + * Implementation by tpruvot (based on cgminer) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +#define APIVERSION "1.0" + +#ifdef WIN32 +# define _WINSOCK_DEPRECATED_NO_WARNINGS +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "algo/sha/sha1-hash.h" + +#include "miner.h" +#include "sysinfos.c" +#ifndef WIN32 +# include +# include +# include +# include +# include +# define SOCKETTYPE long +# define SOCKETFAIL(a) ((a) < 0) +# define INVSOCK -1 /* INVALID_SOCKET */ +# define INVINETADDR -1 /* INADDR_NONE */ +# define CLOSESOCKET close +# define SOCKETINIT {} +# define SOCKERRMSG strerror(errno) +#else +# define SOCKETTYPE SOCKET +# define SOCKETFAIL(a) ((a) == SOCKET_ERROR) +# define INVSOCK INVALID_SOCKET +# define INVINETADDR INADDR_NONE +# define CLOSESOCKET closesocket +# define in_addr_t uint32_t +#endif + +#define GROUP(g) (toupper(g)) +#define PRIVGROUP GROUP('W') +#define NOPRIVGROUP GROUP('R') +#define ISPRIVGROUP(g) (GROUP(g) == PRIVGROUP) +#define GROUPOFFSET(g) (GROUP(g) - GROUP('A')) +#define VALIDGROUP(g) (GROUP(g) >= GROUP('A') && GROUP(g) <= GROUP('Z')) +#define COMMANDS(g) (apigroups[GROUPOFFSET(g)].commands) +#define DEFINEDGROUP(g) (ISPRIVGROUP(g) || COMMANDS(g) != NULL) +struct APIGROUPS { + // This becomes a string like: "|cmd1|cmd2|cmd3|" so it's quick to search + char *commands; +} apigroups['Z' - 'A' + 1]; // only A=0 to Z=25 (R: noprivs, W: allprivs) + +struct IP4ACCESS { + in_addr_t ip; + in_addr_t mask; + char group; +}; + +static int ips = 1; +static struct IP4ACCESS *ipaccess = NULL; + +// Socket data buffers +#define MYBUFSIZ 16384 +#define SOCK_REC_BUFSZ 1024 + +// Socket is on 127.0.0.1 +#define QUEUE 10 + +#define ALLIP4 "0.0.0.0" + +static const char *localaddr = "127.0.0.1"; +static const char *UNAVAILABLE = " - API will not be available"; +static char *buffer = NULL; +static time_t startup = 0; +static int bye = 0; + +extern char *opt_api_allow; +extern int opt_api_listen; /* port */ +extern int opt_api_remote; +extern double global_hashrate; +//extern uint32_t accepted_count; +//extern uint32_t rejected_count; +//extern uint32_t solved_count; + +#define cpu_threads opt_n_threads + +#define USE_MONITORING +extern float cpu_temp(int); +extern uint32_t cpu_clock(int); +//extern int cpu_fanpercent(void); + +/***************************************************************/ + +static void cpustatus(int thr_id) +{ + if ( thr_id >= 0 && thr_id < opt_n_threads ) + { +// struct cpu_info *cpu = &thr_info[thr_id].cpu; + char buf[512]; *buf = '\0'; + char units[4] = {0}; + double hashrate = thr_hashrates[thr_id]; + + scale_hash_for_display ( &hashrate, units ); + snprintf( buf, sizeof(buf), "CPU=%d;%sH/s=%.2f|", thr_id, units, + hashrate ); + // append to buffer + strcat( buffer, buf ); + } +} + +/*****************************************************************************/ + +/** +* Returns miner global infos +*/ +static char *getsummary( char *params ) +{ + char algo[64]; *algo = '\0'; + time_t ts = time(NULL); + double uptime = difftime(ts, startup); + double accps = (60.0 * accepted_share_count) / (uptime ? uptime : 1.0); + double diff = net_diff > 0. ? net_diff : stratum_diff; + char diff_str[16]; + double hrate = (double)global_hashrate; + struct cpu_info cpu = { 0 }; +#ifdef USE_MONITORING + cpu.has_monitoring = true; + cpu.cpu_temp = cpu_temp(0); + cpu.cpu_fan = cpu_fanpercent(); + cpu.cpu_clock = cpu_clock(0); +#endif + + get_currentalgo(algo, sizeof(algo)); + + // if diff is integer don't display decimals + if ( diff == trunc( diff ) ) + sprintf( diff_str, "%.0f", diff); + else + sprintf( diff_str, "%.6f", diff); + + *buffer = '\0'; + sprintf( buffer, + "NAME=%s;VER=%s;API=%s;" + "ALGO=%s;CPUS=%d;URL=%s;" + "HS=%.2f;KHS=%.2f;ACC=%d;REJ=%d;SOL=%d;" + "ACCMN=%.3f;DIFF=%s;TEMP=%.1f;FAN=%d;FREQ=%d;" + "UPTIME=%.0f;TS=%u|", + PACKAGE_NAME, PACKAGE_VERSION, APIVERSION, + algo, opt_n_threads, short_url, + hrate, hrate/1000.0, accepted_share_count, rejected_share_count, + solved_block_count, + accps, diff_str, cpu.cpu_temp, cpu.cpu_fan, cpu.cpu_clock, + uptime, (uint32_t) ts); + return buffer; +} + +/** + * Returns cpu/thread specific stats + */ +static char *getthreads(char *params) +{ + *buffer = '\0'; + for (int i = 0; i < opt_n_threads; i++) + cpustatus(i); + return buffer; +} + +/** + * Is remote control allowed ? + */ +static bool check_remote_access(void) +{ + return (opt_api_remote > 0); +} + +/** + * Change pool url (see --url parameter) + * seturl|stratum+tcp://XeVrkPrWB7pDbdFLfKhF1Z3xpqhsx6wkH3:X@stratum+tcp://mine.xpool.ca:1131| + * seturl|stratum+tcp://Danila.1:X@pool.ipominer.com:3335| + */ +extern bool stratum_need_reset; +static char *remote_seturl(char *params) +{ + *buffer = '\0'; + if (!check_remote_access()) + return buffer; + parse_arg('o', params); + stratum_need_reset = true; + sprintf(buffer, "%s", "ok|"); + return buffer; +} + +/*-hash* + * Ask the miner to quit + */ +static char *remote_quit(char *params) +{ + *buffer = '\0'; + if (!check_remote_access()) + return buffer; + bye = 1; + sprintf(buffer, "%s", "bye|"); + return buffer; +} + +static char *gethelp(char *params); +struct CMDS { + const char *name; + char *(*func)(char *); +} cmds[] = { + { "summary", getsummary }, + { "threads", getthreads }, + /* remote functions */ + { "seturl", remote_seturl }, + { "quit", remote_quit }, + /* keep it the last */ + { "help", gethelp }, +}; +#define CMDMAX ARRAY_SIZE(cmds) + +static char *gethelp(char *params) +{ + *buffer = '\0'; + char * p = buffer; + for (int i = 0; i < CMDMAX-1; i++) + p += sprintf(p, "%s\n", cmds[i].name); + sprintf(p, "|"); + return buffer; +} + + +static int send_result(SOCKETTYPE c, char *result) +{ + int n; + if (!result) { + n = (int) send(c, "", 1, 0); + } else { + // ignore failure - it's closed immediately anyway + n = (int) send(c, result, (int) strlen(result) + 1, 0); + } + return n; +} + +/* ---- Base64 Encoding/Decoding Table --- */ +static const char table64[]= + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static size_t base64_encode(const uchar *indata, size_t insize, char *outptr, size_t outlen) +{ + uchar ibuf[3]; + uchar obuf[4]; + int i, inputparts, inlen = (int) insize; + size_t len = 0; + char *output, *outbuf; + + memset(outptr, 0, outlen); + + outbuf = output = (char*)calloc(1, inlen * 4 / 3 + 4); + if (outbuf == NULL) { + return -1; + } + + while (inlen > 0) { + for (i = inputparts = 0; i < 3; i++) { + if (inlen > 0) { + inputparts++; + ibuf[i] = (uchar) *indata; + indata++; inlen--; + } + else + ibuf[i] = 0; + } + + obuf[0] = (uchar) ((ibuf[0] & 0xFC) >> 2); + obuf[1] = (uchar) (((ibuf[0] & 0x03) << 4) | ((ibuf[1] & 0xF0) >> 4)); + obuf[2] = (uchar) (((ibuf[1] & 0x0F) << 2) | ((ibuf[2] & 0xC0) >> 6)); + obuf[3] = (uchar) (ibuf[2] & 0x3F); + + switch(inputparts) { + case 1: /* only one byte read */ + snprintf(output, 5, "%c%c==", + table64[obuf[0]], + table64[obuf[1]]); + break; + case 2: /* two bytes read */ + snprintf(output, 5, "%c%c%c=", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]]); + break; + default: + snprintf(output, 5, "%c%c%c%c", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]], + table64[obuf[3]] ); + break; + } + if ((len+4) > outlen) + break; + output += 4; len += 4; + } + len = snprintf(outptr, len, "%s", outbuf); + // todo: seems to be missing on linux + if (strlen(outptr) == 27) + strcat(outptr, "="); + free(outbuf); + + return len; +} + +//#include "compat/curl-for-windows/openssl/openssl/crypto/sha/sha.h" + +/* websocket handshake (tested in Chrome) */ +static int websocket_handshake(SOCKETTYPE c, char *result, char *clientkey) +{ + char answer[256]; + char inpkey[128] = { 0 }; + char seckey[64]; + uchar sha1[20]; + + if (opt_protocol) + applog(LOG_DEBUG, "clientkey: %s", clientkey); + + sprintf(inpkey, "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11", clientkey); + + // SHA-1 test from rfc, returns in base64 "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" + //sprintf(inpkey, "dGhlIHNhbXBsZSBub25jZQ==258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + + sph_sha1_full( sha1, inpkey, strlen(inpkey) ); + + base64_encode(sha1, 20, seckey, sizeof(seckey)); + + sprintf(answer, + "HTTP/1.1 101 Switching Protocol\r\n" + "Upgrade: WebSocket\r\nConnection: Upgrade\r\n" + "Sec-WebSocket-Accept: %s\r\n" + "Sec-WebSocket-Protocol: text\r\n" + "\r\n", seckey); + + // data result as tcp frame + + uchar hd[10] = { 0 }; + hd[0] = 129; // 0x1 text frame (FIN + opcode) + uint64_t datalen = (uint64_t) strlen(result); + uint8_t frames = 2; + if (datalen <= 125) { + hd[1] = (uchar) (datalen); + } else if (datalen <= 65535) { + hd[1] = (uchar) 126; + hd[2] = (uchar) (datalen >> 8); + hd[3] = (uchar) (datalen); + frames = 4; + } else { + hd[1] = (uchar) 127; + hd[2] = (uchar) (datalen >> 56); + hd[3] = (uchar) (datalen >> 48); + hd[4] = (uchar) (datalen >> 40); + hd[5] = (uchar) (datalen >> 32); + hd[6] = (uchar) (datalen >> 24); + hd[7] = (uchar) (datalen >> 16); + hd[8] = (uchar) (datalen >> 8); + hd[9] = (uchar) (datalen); + frames = 10; + } + + size_t handlen = strlen(answer); + uchar *data = (uchar*) calloc(1, handlen + frames + (size_t) datalen + 1); + if (data == NULL) + return -1; + else { + uchar *p = data; + // HTTP header 101 + memcpy(p, answer, handlen); + p += handlen; + // WebSocket Frame - Header + Data + memcpy(p, hd, frames); + memcpy(p + frames, result, (size_t)datalen); + send(c, (const char*)data, (int) (strlen(answer) + frames + (size_t)datalen + 1), 0); + free(data); + } + return 0; +} + +/* + * N.B. IP4 addresses are by Definition 32bit big endian on all platforms + */ +static void setup_ipaccess() +{ + char *buf = NULL, *ptr, *comma, *slash, *dot; + int ipcount, mask, octet, i; + char group; + + buf = (char*) calloc(1, strlen(opt_api_allow) + 1); + if (unlikely(!buf)) + proper_exit(1);//, "Failed to malloc ipaccess buf"); + + strcpy(buf, opt_api_allow); + ipcount = 1; + ptr = buf; + while (*ptr) if (*(ptr++) == ',') + ipcount++; + + // possibly more than needed, but never less + ipaccess = (struct IP4ACCESS *) calloc(ipcount, sizeof(struct IP4ACCESS)); + if (unlikely(!ipaccess)) + proper_exit(1);//, "Failed to calloc ipaccess"); + + ips = 0; + ptr = buf; + while (ptr && *ptr) { + while (*ptr == ' ' || *ptr == '\t') + ptr++; + + if (*ptr == ',') { + ptr++; + continue; + } + + comma = strchr(ptr, ','); + if (comma) + *(comma++) = '\0'; + + group = NOPRIVGROUP; + + if (isalpha(*ptr) && *(ptr+1) == ':') { + if (DEFINEDGROUP(*ptr)) + group = GROUP(*ptr); + ptr += 2; + } + + ipaccess[ips].group = group; + + if (strcmp(ptr, ALLIP4) == 0) + ipaccess[ips].ip = ipaccess[ips].mask = 0; + else + { + slash = strchr(ptr, '/'); + if (!slash) + ipaccess[ips].mask = 0xffffffff; + else { + *(slash++) = '\0'; + mask = atoi(slash); + if (mask < 1 || mask > 32) + goto popipo; // skip invalid/zero + + ipaccess[ips].mask = 0; + while (mask-- >= 0) { + octet = 1 << (mask % 8); + ipaccess[ips].mask |= (octet << (24 - (8 * (mask >> 3)))); + } + } + + ipaccess[ips].ip = 0; // missing default to '.0' + for (i = 0; ptr && (i < 4); i++) { + dot = strchr(ptr, '.'); + if (dot) + *(dot++) = '\0'; + octet = atoi(ptr); + + if (octet < 0 || octet > 0xff) + goto popipo; // skip invalid + + ipaccess[ips].ip |= (octet << (24 - (i * 8))); + + ptr = dot; + } + + ipaccess[ips].ip &= ipaccess[ips].mask; + } + + ips++; +popipo: + ptr = comma; + } + + free(buf); +} + +static bool check_connect(struct sockaddr_in *cli, char **connectaddr, char *group) +{ + bool addrok = false; + + *connectaddr = inet_ntoa(cli->sin_addr); + + *group = NOPRIVGROUP; + if (opt_api_allow) { + int client_ip = htonl(cli->sin_addr.s_addr); + for (int i = 0; i < ips; i++) { + if ((client_ip & ipaccess[i].mask) == ipaccess[i].ip) { + addrok = true; + *group = ipaccess[i].group; + break; + } + } + } + else + addrok = (strcmp(*connectaddr, localaddr) == 0); + + return addrok; +} + +static void api() +{ + const char *addr = opt_api_allow; + unsigned short port = (unsigned short) opt_api_listen; // 4048 + char buf[MYBUFSIZ]; + int c, n, bound; + char *connectaddr; + char *binderror; + char group; + time_t bindstart; + struct sockaddr_in serv; + struct sockaddr_in cli; + uint32_t clisiz; + bool addrok = false; + long long counter; + char *result; + char *params; + int i; + + SOCKETTYPE *apisock; + if (!opt_api_listen && opt_debug) { + applog(LOG_DEBUG, "API disabled"); + return; + } + + if (opt_api_allow) { + setup_ipaccess(); + if (ips == 0) { + applog(LOG_WARNING, "API not running (no valid IPs specified)%s", UNAVAILABLE); + } + } + + apisock = (SOCKETTYPE*) calloc(1, sizeof(*apisock)); + *apisock = INVSOCK; + + sleep(1); + + *apisock = socket(AF_INET, SOCK_STREAM, 0); + if (*apisock == INVSOCK) { + applog(LOG_ERR, "API initialisation failed (%s)%s", strerror(errno), UNAVAILABLE); + return; + } + + memset(&serv, 0, sizeof(serv)); + serv.sin_family = AF_INET; + serv.sin_addr.s_addr = inet_addr(addr); + if (serv.sin_addr.s_addr == (in_addr_t)INVINETADDR) { + applog(LOG_ERR, "API initialisation 2 failed (%s)%s", strerror(errno), UNAVAILABLE); + return; + } + + serv.sin_port = htons(port); + +#ifndef WIN32 + // On linux with SO_REUSEADDR, bind will get the port if the previous + // socket is closed (even if it is still in TIME_WAIT) but fail if + // another program has it open - which is what we want + int optval = 1; + // If it doesn't work, we don't really care - just show a debug message + if (SOCKETFAIL(setsockopt(*apisock, SOL_SOCKET, SO_REUSEADDR, (void *)(&optval), sizeof(optval)))) + applog(LOG_DEBUG, "API setsockopt SO_REUSEADDR failed (ignored): %s", SOCKERRMSG); +#else + // On windows a 2nd program can bind to a port>1024 already in use unless + // SO_EXCLUSIVEADDRUSE is used - however then the bind to a closed port + // in TIME_WAIT will fail until the timeout - so we leave the options alone +#endif + + // try for 1 minute ... in case the old one hasn't completely gone yet + bound = 0; + bindstart = time(NULL); + while (bound == 0) { + if (bind(*apisock, (struct sockaddr *)(&serv), sizeof(serv)) < 0) { + binderror = strerror(errno); + if ((time(NULL) - bindstart) > 61) + break; + else { + if (!opt_quiet || opt_debug) + applog(LOG_WARNING, "API bind to port %d failed - trying again in 20sec", port); + sleep(20); + } + } + else + bound = 1; + } + + if (bound == 0) { + applog(LOG_WARNING, "API bind to port %d failed (%s)%s", port, binderror, UNAVAILABLE); + free(apisock); + return; + } + + if (SOCKETFAIL(listen(*apisock, QUEUE))) { + applog(LOG_ERR, "API initialisation 3 failed (%s)%s", strerror(errno), UNAVAILABLE); + CLOSESOCKET(*apisock); + free(apisock); + return; + } + + buffer = (char *) calloc(1, MYBUFSIZ + 1); + + counter = 0; + while (bye == 0) { + counter++; + + clisiz = sizeof(cli); + if (SOCKETFAIL(c = accept((SOCKETTYPE)*apisock, (struct sockaddr *)(&cli), &clisiz))) { + applog(LOG_ERR, "API failed (%s)%s", strerror(errno), UNAVAILABLE); + CLOSESOCKET(*apisock); + free(apisock); + free(buffer); + return; + } + + addrok = check_connect(&cli, &connectaddr, &group); + if (opt_debug && opt_protocol) + applog(LOG_DEBUG, "API: connection from %s - %s", + connectaddr, addrok ? "Accepted" : "Ignored"); + + if (addrok) { + bool fail; + char *wskey = NULL; + n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0); + + fail = SOCKETFAIL(n); + if (fail) + buf[0] = '\0'; + else if (n > 0 && buf[n-1] == '\n') { + /* telnet compat \r\n */ + buf[n-1] = '\0'; n--; + if (n > 0 && buf[n-1] == '\r') + buf[n-1] = '\0'; + } + if (n >= 0) + buf[n] = '\0'; + + //if (opt_debug && opt_protocol && n > 0) + // applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]); + + if (!fail) { + char *msg = NULL; + /* Websocket requests compat. */ + if ((msg = strstr(buf, "GET /")) && strlen(msg) > 5) { + char cmd[256] = { 0 }; + sscanf(&msg[5], "%s\n", cmd); + params = strchr(cmd, '/'); + if (params) + *(params++) = '|'; + params = strchr(cmd, '/'); + if (params) + *(params++) = '\0'; + wskey = strstr(msg, "Sec-WebSocket-Key"); + if (wskey) { + char *eol = strchr(wskey, '\r'); + if (eol) *eol = '\0'; + wskey = strchr(wskey, ':'); + wskey++; + while ((*wskey) == ' ') wskey++; // ltrim + } + n = sprintf(buf, "%s", cmd); + } + + params = strchr(buf, '|'); + if (params != NULL) + *(params++) = '\0'; + + if (opt_debug && opt_protocol && n > 0) + applog(LOG_DEBUG, "API: exec command %s(%s)", buf, params); + + for (i = 0; i < CMDMAX; i++) { + if (strcmp(buf, cmds[i].name) == 0) { + if (params && strlen(params)) { + // remove possible trailing | + if (params[strlen(params) - 1] == '|') + params[strlen(params) - 1] = '\0'; + } + result = (cmds[i].func)(params); + if (wskey) { + websocket_handshake(c, result, wskey); + break; + } + send_result(c, result); + break; + } + } + CLOSESOCKET(c); + } + } + } + + CLOSESOCKET(*apisock); + free(apisock); + free(buffer); +} + +/* external access */ +void *api_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info*)userdata; + + startup = time(NULL); + api(); + tq_freeze(mythr->q); + + if (bye) { + // quit command + proper_exit(1); + } + + return NULL; +} + diff --git a/rin/miner/cpuminer/armbuild-all.sh b/rin/miner/cpuminer/armbuild-all.sh new file mode 100644 index 0000000..2655dba --- /dev/null +++ b/rin/miner/cpuminer/armbuild-all.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# This script is not intended for users, it is only used for compile testing +# during develpment. However the information contained may provide compilation +# tips to users. + +rm cpuminer cpuminer-armv9-crypto-sha3 cpuminer-armv9-crypto cpuminer-armv9 cpuminer-armv8.5-crypto-sha3-sve2 cpuminer-armv8.4-crypto-sha3 cpuminer-armv8 cpuminer-armv8-crypto cpuminer-avx512-sha-vaes cpuminer-avx512 cpuminer-avx2-sha cpuminer-avx2-sha-vaes cpuminer-avx2 cpuminer-avx cpuminer-aes-sse42 cpuminer-sse42 cpuminer-ssse3 cpuminer-sse2 cpuminer-zen cpuminer-zen3 cpuminer-zen4 cpuminer-alderlake cpuminer-x64 > /dev/null + +# armv9 needs gcc-13 +# -march-armv9-a includes SVE2 but no crypto +# -march=armv9-a+crypto adds AES & SHA2 but not SHA512 + +make distclean || echo clean +rm -f config.status +./autogen.sh || echo done +CFLAGS="-O3 -march=armv9-a+crypto+sha3 -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv9-crypto-sha3 + +make clean || echo clean +CFLAGS="-O3 -march=armv9-a+crypto -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv9-crypto + +make clean || echo clean +CFLAGS="-O3 -march=armv9-a -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv9 + +# SVE2 available in armv8.5 +make clean || echo clean +CFLAGS="-O3 -march=armv8.5-a+crypto+sha3+sve2 -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv8.5-crypto-sha3-sve2 + +# SHA3 available in armv8.4 +make clean || echo clean +CFLAGS="-O3 -march=armv8.4-a+crypto+sha3 -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv8.4-crypto-sha3 + +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=armv8-a+crypto -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv8-crypto + +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=armv8-a -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) +mv cpuminer cpuminer-armv8 + +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=native -Wall -flax-vector-conversions" ./configure --with-curl +make -j $(nproc) diff --git a/rin/miner/cpuminer/autogen.sh b/rin/miner/cpuminer/autogen.sh new file mode 100644 index 0000000..0a210f0 --- /dev/null +++ b/rin/miner/cpuminer/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# You need autoconf 2.5x, preferably 2.57 or later +# You need automake 1.7 or later. 1.6 might work. + +set -e + +aclocal +autoheader +automake --foreign --add-missing --force-missing --copy +# automake --gnu --add-missing --copy +autoconf + diff --git a/rin/miner/cpuminer/bitcoin-config.h b/rin/miner/cpuminer/bitcoin-config.h new file mode 100644 index 0000000..e0dbe32 --- /dev/null +++ b/rin/miner/cpuminer/bitcoin-config.h @@ -0,0 +1,375 @@ +/* src/config/bitcoin-config.h. Generated from bitcoin-config.h.in by configure. */ +/* src/config/bitcoin-config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef BITCOIN_CONFIG_H + +#define BITCOIN_CONFIG_H + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Version Build */ +#define CLIENT_VERSION_BUILD 0 + +/* Version is release */ +#define CLIENT_VERSION_IS_RELEASE true + +/* Major version */ +#define CLIENT_VERSION_MAJOR 0 + +/* Minor version */ +#define CLIENT_VERSION_MINOR 11 + +/* Build revision */ +#define CLIENT_VERSION_REVISION 2 + +/* Version is release */ +#define COPYRIGHT_YEAR 2015 + +/* Define to 1 to enable wallet functions */ +#define ENABLE_WALLET 1 + +/* parameter and return value type for __fdelt_chk */ +/* #undef FDELT_TYPE */ + +/* define if the Boost library is available */ +#define HAVE_BOOST /**/ + +/* define if the Boost::Chrono library is available */ +#define HAVE_BOOST_CHRONO /**/ + +/* define if the Boost::Filesystem library is available */ +#define HAVE_BOOST_FILESYSTEM /**/ + +/* define if the Boost::PROGRAM_OPTIONS library is available */ +#define HAVE_BOOST_PROGRAM_OPTIONS /**/ + +/* define if the Boost::System library is available */ +#define HAVE_BOOST_SYSTEM /**/ + +/* define if the Boost::Thread library is available */ +#define HAVE_BOOST_THREAD /**/ + +/* define if the Boost::Unit_Test_Framework library is available */ +#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/ + +/* Define to 1 if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define this symbol if the consensus lib has been built */ +#define HAVE_CONSENSUS_LIB 1 + +/* Define to 1 if you have the declaration of `be16toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE16TOH 1 + +/* Define to 1 if you have the declaration of `be32toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE32TOH 1 + +/* Define to 1 if you have the declaration of `be64toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE64TOH 1 + +/* Define to 1 if you have the declaration of `bswap_16', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_16 1 + +/* Define to 1 if you have the declaration of `bswap_32', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_32 1 + +/* Define to 1 if you have the declaration of `bswap_64', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_64 1 + +/* Define to 1 if you have the declaration of `htobe16', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE16 1 + +/* Define to 1 if you have the declaration of `htobe32', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE32 1 + +/* Define to 1 if you have the declaration of `htobe64', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE64 1 + +/* Define to 1 if you have the declaration of `htole16', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE16 1 + +/* Define to 1 if you have the declaration of `htole32', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE32 1 + +/* Define to 1 if you have the declaration of `htole64', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE64 1 + +/* Define to 1 if you have the declaration of `le16toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE16TOH 1 + +/* Define to 1 if you have the declaration of `le32toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE32TOH 1 + +/* Define to 1 if you have the declaration of `le64toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE64TOH 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#define HAVE_DECL_STRNLEN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define to 1 if the system has the `dllexport' function attribute */ +/* #undef HAVE_FUNC_ATTRIBUTE_DLLEXPORT */ + +/* Define to 1 if the system has the `dllimport' function attribute */ +/* #undef HAVE_FUNC_ATTRIBUTE_DLLIMPORT */ + +/* Define to 1 if the system has the `visibility' function attribute */ +#define HAVE_FUNC_ATTRIBUTE_VISIBILITY 1 + +/* Define this symbol if you have getaddrinfo_a */ +#define HAVE_GETADDRINFO_A 1 + +/* Define this symbol if you have inet_pton */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `advapi32' library (-ladvapi32). */ +/* #undef HAVE_LIBADVAPI32 */ + +/* Define to 1 if you have the `comctl32' library (-lcomctl32). */ +/* #undef HAVE_LIBCOMCTL32 */ + +/* Define to 1 if you have the `comdlg32' library (-lcomdlg32). */ +/* #undef HAVE_LIBCOMDLG32 */ + +/* Define to 1 if you have the `crypt32' library (-lcrypt32). */ +/* #undef HAVE_LIBCRYPT32 */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `gdi32' library (-lgdi32). */ +/* #undef HAVE_LIBGDI32 */ + +/* Define to 1 if you have the `imm32' library (-limm32). */ +/* #undef HAVE_LIBIMM32 */ + +/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */ +/* #undef HAVE_LIBIPHLPAPI */ + +/* Define to 1 if you have the `jpeg ' library (-ljpeg ). */ +/* #undef HAVE_LIBJPEG_ */ + +/* Define to 1 if you have the `kernel32' library (-lkernel32). */ +/* #undef HAVE_LIBKERNEL32 */ + +/* Define to 1 if you have the `mingwthrd' library (-lmingwthrd). */ +/* #undef HAVE_LIBMINGWTHRD */ + +/* Define to 1 if you have the `mswsock' library (-lmswsock). */ +/* #undef HAVE_LIBMSWSOCK */ + +/* Define to 1 if you have the `ole32' library (-lole32). */ +/* #undef HAVE_LIBOLE32 */ + +/* Define to 1 if you have the `oleaut32' library (-loleaut32). */ +/* #undef HAVE_LIBOLEAUT32 */ + +/* Define to 1 if you have the `png ' library (-lpng ). */ +/* #undef HAVE_LIBPNG_ */ + +/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */ +/* #undef HAVE_LIBRPCRT4 */ + +/* Define to 1 if you have the `shell32' library (-lshell32). */ +/* #undef HAVE_LIBSHELL32 */ + +/* Define to 1 if you have the `shlwapi' library (-lshlwapi). */ +/* #undef HAVE_LIBSHLWAPI */ + +/* Define to 1 if you have the `ssp' library (-lssp). */ +/* #undef HAVE_LIBSSP */ + +/* Define to 1 if you have the `user32' library (-luser32). */ +/* #undef HAVE_LIBUSER32 */ + +/* Define to 1 if you have the `uuid' library (-luuid). */ +/* #undef HAVE_LIBUUID */ + +/* Define to 1 if you have the `winmm' library (-lwinmm). */ +/* #undef HAVE_LIBWINMM */ + +/* Define to 1 if you have the `winspool' library (-lwinspool). */ +/* #undef HAVE_LIBWINSPOOL */ + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +/* #undef HAVE_LIBWS2_32 */ + +/* Define to 1 if you have the `z ' library (-lz ). */ +/* #undef HAVE_LIBZ_ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_MINIUPNPC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_MINIWGET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_UPNPCOMMANDS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_UPNPERRORS_H 1 + +/* Define this symbol if you have MSG_NOSIGNAL */ +#define HAVE_MSG_NOSIGNAL 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if the visibility attribute is supported. */ +#define HAVE_VISIBILITY_ATTRIBUTE 1 + +/* Define this symbol if boost sleep works */ +/* #undef HAVE_WORKING_BOOST_SLEEP */ + +/* Define this symbol if boost sleep_for works */ +#define HAVE_WORKING_BOOST_SLEEP_FOR 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to the address where bug reports for this package should be sent. */ +//#define PACKAGE_BUGREPORT "https://github.com/FreeTrade/HOdlcoin/issues" + +/* Define to the full name of this package. */ +//#define PACKAGE_NAME "HOdlcoin Core" + +/* Define to the full name and version of this package. */ +//#define PACKAGE_STRING "HOdlcoin Core 0.11.2" + +/* Define to the one symbol short name of this package. */ +//#define PACKAGE_TARNAME "hodlcoin" + +/* Define to the home page for this package. */ +//#define PACKAGE_URL "" + +/* Define to the version of this package. */ +//#define PACKAGE_VERSION "0.11.2" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define this symbol if the qt platform is cocoa */ +/* #undef QT_QPA_PLATFORM_COCOA */ + +/* Define this symbol if the qt platform is windows */ +/* #undef QT_QPA_PLATFORM_WINDOWS */ + +/* Define this symbol if the qt platform is xcb */ +/* #undef QT_QPA_PLATFORM_XCB */ + +/* Define this symbol if qt plugins are static */ +/* #undef QT_STATICPLUGIN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +#define STRERROR_R_CHAR_P 1 + +/* Define if dbus support should be compiled in */ +/* #undef USE_DBUS */ + +/* Define if QR support should be compiled in */ +/* #undef USE_QRCODE */ + +/* UPnP support not compiled if undefined, otherwise value (0 or 1) determines + default state */ +#define USE_UPNP 0 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +#endif //BITCOIN_CONFIG_H diff --git a/rin/miner/cpuminer/build-allarch.sh b/rin/miner/cpuminer/build-allarch.sh new file mode 100644 index 0000000..9911d4f --- /dev/null +++ b/rin/miner/cpuminer/build-allarch.sh @@ -0,0 +1,181 @@ +#!/bin/bash +# +# This script is not intended for users, it is only used for compile testing +# during develpment. However the information contained may provide compilation +# tips to users. + +rm cpuminer-arrowlake* cpuminer-graniterapids* cpuminer-avx512-sha-vaes cpuminer-avx512 cpuminer-avx2 cpuminer-avx cpuminer-aes-sse42 cpuminer-sse42 cpuminer-ssse3 cpuminer-sse2 cpuminer-zen cpuminer-zen3 cpuminer-zen4 cpuminer-zen5 cpuminer-alderlake cpuminer-x64 cpuminer-armv8 cpuminer-armv8-aes cpuminer-armv8-sha2 cpuminer-armv8-aes-sha2 > /dev/null + +# AVX512 SHA VAES: Intel Core Icelake, Rocketlake +make distclean || echo clean +rm -f config.status +./autogen.sh || echo done +CFLAGS="-O3 -march=icelake-client -Wall" ./configure --with-curl +# Rocketlake needs gcc-11 +#CFLAGS="-O3 -march=rocketlake -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx512-sha-vaes + +# Intel Core Alderlake: AVX2 SHA VAES, needs gcc-12 +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=alderlake -Wall" ./configure --with-curl +#make -j 8 +#strip -s cpuminer +#mv cpuminer cpuminer-alderlake + +# Intel Core Arrowlake-s: AVX2 SHA512 VAES, needs gcc-14 +# Arrowlake-s includes SHA512, Arrowlake does not? +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=arrowlake-s -Wall" ./configure --with-curl +#make -j 8 +#strip -s cpuminer +#mv cpuminer cpuminer-arrowlake-s + +# Intel Core Graniterapids: AVX512, SHA256, VAES, needs gcc-14 +# Apparently Granitrapids will not include AVX10, SHA512 or APX, +# wait for Diamondrapids & gcc-15. +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=graniterapids -Wall" ./configure --with-curl +#make -j 8 +#strip -s cpuminer +#mv cpuminer cpuminer-graniterapids + +# Force AVX10-256 +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=arrowlake-s -mavx10.1-256 -Wall" ./configure --with-curl +#make -j 8 +#strip -s cpuminer +#mv cpuminer cpuminer-avx10-256 + +# Force SHA512 AVX10-512 +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=graniterapids -msha512 -mavx10.1-512 -Wall" ./configure --with-curl +#make -j 8 +#strip -s cpuminer +#mv cpuminer cpuminer-avx10-512 + +# Zen5: AVX512 SHA VAES, requires gcc-14. +#make clean || echo clean +#rm -f config.status +#CFLAGS="-O3 -march=znver5 -Wall" ./configure --with-curl +#make -j $(nproc) +#strip -s cpuminer +#mv cpuminer cpuminer-zen5 + +# Zen4: AVX512 SHA VAES +make clean || echo clean +rm -f config.status +# znver3 needs gcc-11, znver4 needs gcc-12.3. +#CFLAGS="-O3 -march=znver4 -Wall" ./configure --with-curl +# Inclomplete list of Zen4 AVX512 extensions but includes all extensions used by cpuminer. +CFLAGS="-O3 -march=znver3 -mavx512f -mavx512cd -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq -Wall" ./configure --with-curl +#CFLAGS="-O3 -march=znver2 -mvaes -mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-zen4 + +# Zen3 AVX2 SHA VAES +make clean || echo clean +rm -f config.status +#CFLAGS="-O3 -march=znver2 -mvaes" ./configure --with-curl +CFLAGS="-O3 -march=znver3 -fno-common " ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-zen3 + +# AVX512 AES: Intel Core HEDT Sylake-X, Cascadelake +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=skylake-avx512 -maes -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx512 + +# AVX2 SHA VAES: generic, zen3, alderlake...arrowlake +make clean || echo done +rm -f config.status +# vaes doesn't include aes +CFLAGS="-O3 -maes -mavx2 -msha -mvaes -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx2-sha-vaes + +# AVX2 SHA AES: AMD Zen1 +make clean || echo done +rm -f config.status +#CFLAGS="-O3 -march=znver1 -maes -Wall" ./configure --with-curl +CFLAGS="-O3 -maes -mavx2 -msha -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx2-sha + +# AVX2 AES: Intel Haswell..Cometlake +make clean || echo clean +rm -f config.status +# GCC 9 doesn't include AES with core-avx2 +CFLAGS="-O3 -march=core-avx2 -maes -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx2 + +# AVX AES: Intel Sandybridge, Ivybridge +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=corei7-avx -maes -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-avx + +# SSE4.2 AES: Intel Westmere, most Pentium & Celeron +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=westmere -maes -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-aes-sse42 + +# SSE4.2: Intel Nehalem +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=corei7 -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-sse42 + +# SSSE3: Intel Core2 +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=core2 -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-ssse3 + +# SSE2 +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -msse2 -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-sse2 + +# X86_64 +make clean || echo clean +rm -f config.status +CFLAGS="-O3 -march=x86-64 -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer +mv cpuminer cpuminer-x64 + +# Native to host CPU +make clean || echo done +rm -f config.status +CFLAGS="-O3 -march=native -Wall" ./configure --with-curl +make -j $(nproc) +strip -s cpuminer + diff --git a/rin/miner/cpuminer/build-armv8.sh b/rin/miner/cpuminer/build-armv8.sh new file mode 100644 index 0000000..512d72f --- /dev/null +++ b/rin/miner/cpuminer/build-armv8.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Linux build + +make distclean || echo clean + +rm -f config.status +./autogen.sh || echo done + +CFLAGS="-O2 -march=armv8-a+crypto+sha2+aes -Wall -flax-vector-conversions" ./configure --with-curl --host=aarch64-cortexa76-elf --build=x86_64-pc-linux-gnu --target=aarch64-cortexa76-elf +#CFLAGS="-O2 -march=armv8-a+crypto+sha2+aes -Wall -flax-vector-conversions" ./configure --with-curl + +make -j $(nproc) + +strip -s cpuminer diff --git a/rin/miner/cpuminer/build-avx2.sh b/rin/miner/cpuminer/build-avx2.sh new file mode 100644 index 0000000..6f93f00 --- /dev/null +++ b/rin/miner/cpuminer/build-avx2.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Linux build + +make distclean || echo clean +rm -f config.status +./autogen.sh || echo done +CFLAGS="-O3 -march=haswell -maes -Wall" ./configure --with-curl +make -j $(nproc) diff --git a/rin/miner/cpuminer/build.sh b/rin/miner/cpuminer/build.sh new file mode 100644 index 0000000..9363392 --- /dev/null +++ b/rin/miner/cpuminer/build.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +make distclean || echo clean +rm -f config.status +./autogen.sh || echo done +CFLAGS="-O3 -march=native -Wall" ./configure --with-curl +make -j $(nproc) + +#strip -s cpuminer diff --git a/rin/miner/cpuminer/clean-all.sh b/rin/miner/cpuminer/clean-all.sh new file mode 100644 index 0000000..1820aff --- /dev/null +++ b/rin/miner/cpuminer/clean-all.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# make clean and rm all the targetted executables. + +rm cpuminer-avx10* cpuminer-arrowlake* cpuminer-graniterapids* cpuminer-avx512-sha-vaes cpuminer-alderlake cpuminer-avx512 cpuminer-avx2 cpuminer-avx cpuminer-aes-sse42 cpuminer-sse2 cpuminer-avx2-sha cpuminer-sse42 cpuminer-ssse3 cpuminer-avx2-sha-vaes cpuminer-zen3 cpuminer-zen4 cpuminer-x64 cpuminer-armv9 cpuminer-armv9-crypto cpuminer-armv9-crypto-sha3 cpuminer-armv8.4-crypto-sha3 cpuminer-armv8.5-crypto-sha3-sve2 cpuminer-armv8-crypto cpuminer-armv8 > /dev/null + +rm cpuminer-avx512-sha-vaes.exe cpuminer-avx512-sha.exe cpuminer-avx512.exe cpuminer-avx2.exe cpuminer-avx.exe cpuminer-aes-sse42.exe cpuminer-sse2.exe cpuminer-avx2-sha.exe cpuminer-sse42.exe cpuminer-ssse3.exe cpuminer-avx2-sha-vaes.exe cpuminer-zen3.exe cpuminer-zen4.exe cpuminer-x64.exe > /dev/null + +make distclean > /dev/null diff --git a/rin/miner/cpuminer/compat.h b/rin/miner/cpuminer/compat.h new file mode 100644 index 0000000..80e7fc9 --- /dev/null +++ b/rin/miner/cpuminer/compat.h @@ -0,0 +1,96 @@ +#ifndef __COMPAT_H__ +#define __COMPAT_H__ + +#ifdef WIN32 + +#if _WIN32_WINNT>=0x0601 // Windows 7 + #define WINDOWS_CPU_GROUPS_ENABLED 1 +#endif + +#include +#include + +#ifndef localtime_r +#define localtime_r(src, dst) localtime_s(dst, src) +#endif + +#define sleep(secs) Sleep((secs) * 1000) + +enum { + PRIO_PROCESS = 0, +}; + +extern int opt_priority; +static __inline int setpriority(int which, int who, int prio) +{ + switch (opt_priority) { + case 5: + prio = THREAD_PRIORITY_TIME_CRITICAL; + break; + case 4: + prio = THREAD_PRIORITY_HIGHEST; + break; + case 3: + prio = THREAD_PRIORITY_ABOVE_NORMAL; + break; + case 2: + prio = THREAD_PRIORITY_NORMAL; + break; + case 1: + prio = THREAD_PRIORITY_BELOW_NORMAL; + break; + case 0: + default: + prio = THREAD_PRIORITY_IDLE; + } + return -!SetThreadPriority(GetCurrentThread(), prio); +} + +#ifdef _MSC_VER +#define snprintf(...) _snprintf(__VA_ARGS__) +#define strdup(...) _strdup(__VA_ARGS__) +#define strncasecmp(x,y,z) _strnicmp(x,y,z) +#define strcasecmp(x,y) _stricmp(x,y) +#define __func__ __FUNCTION__ +#define __thread __declspec(thread) +#define _ALIGN(x) __declspec(align(x)) +typedef int ssize_t; + +#include +// This static var is made to be compatible with linux/mingw (no free on string result) +// This is not thread safe but we only use that once on process start +static char dirname_buffer[_MAX_PATH] = { 0 }; +static __inline char * dirname(char *file) { + char drive[_MAX_DRIVE] = { 0 }; + char dir[_MAX_DIR] = { 0 }; + char fname[_MAX_FNAME], ext[_MAX_EXT]; + _splitpath_s(file, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT); + if (dir && strlen(dir) && dir[strlen(dir)-1] == '\\') { + dir[strlen(dir) - 1] = '\0'; + } + sprintf(dirname_buffer, "%s%s", drive, dir); + return &dirname_buffer[0]; +} +#endif + +#endif /* WIN32 */ + +#ifndef _MSC_VER +#define _ALIGN(x) __attribute__ ((aligned(x))) +#endif + +#undef unlikely +#undef likely +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define unlikely(expr) (__builtin_expect(!!(expr), 0)) +#define likely(expr) (__builtin_expect(!!(expr), 1)) +#else +#define unlikely(expr) (expr) +#define likely(expr) (expr) +#endif + +#ifndef WIN32 +#define MAX_PATH PATH_MAX +#endif + +#endif /* __COMPAT_H__ */ diff --git a/rin/miner/cpuminer/config-template.json b/rin/miner/cpuminer/config-template.json new file mode 100644 index 0000000..9f82214 --- /dev/null +++ b/rin/miner/cpuminer/config-template.json @@ -0,0 +1,22 @@ +{ + "_comment" : "Any long-format command line argument ", + "_comment" : "may be used in this JSON configuration file", + "_comment" : "Additional arguments may be added to the command line.", + "_comment" : "Usage: cpuminer -c myconfig.json [additional arguments]", + + "_comment" : "Required arguments, replace dummy values", + + "url" : "stratum+tcp://example.com:3333", + "user" : "read.pool.instructions", + "pass" : "x.often.works", + "algo" : "algo", + + "_comment" : "Often used optional arguments with default values selected.", + "_comment" : "Change values, add or delete arguments as desired.", + + "threads" : 0, + "cpu-affinity" : -1, + "api-bind" : "127.0.0.1:4048", + "benchmark" : false, + "quiet" : false +} diff --git a/rin/miner/cpuminer/configure b/rin/miner/cpuminer/configure new file mode 100644 index 0000000..8e953e0 --- /dev/null +++ b/rin/miner/cpuminer/configure @@ -0,0 +1,8398 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for cpuminer-opt 25.3. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='cpuminer-opt' +PACKAGE_TARNAME='cpuminer-opt' +PACKAGE_VERSION='25.3' +PACKAGE_STRING='cpuminer-opt 25.3' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="cpu-miner.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +WS2_LIBS +PTHREAD_LIBS +PTHREAD_FLAGS +JANSSON_LIBS +LIBCURL_CPPFLAGS +LIBCURL_CFLAGS +LIBCURL +HAVE_APPLE_FALSE +HAVE_APPLE_TRUE +MINGW_FALSE +MINGW_TRUE +ARCH_ARM64_FALSE +ARCH_ARM64_TRUE +ARCH_x86_64_FALSE +ARCH_x86_64_TRUE +USE_ASM_FALSE +USE_ASM_TRUE +HAVE_WINDOWS_FALSE +HAVE_WINDOWS_TRUE +WANT_JANSSON_FALSE +WANT_JANSSON_TRUE +ALLOCA +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +RANLIB +am__fastdepCCAS_FALSE +am__fastdepCCAS_TRUE +CCASDEPMODE +CCASFLAGS +CCAS +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_dependency_tracking +enable_assembly +with_curl +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CCAS +CCASFLAGS +CXX +CXXFLAGS +CCC' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures cpuminer-opt 25.3 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/cpuminer-opt] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cpuminer-opt 25.3:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-assembly disable assembly-language routines + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-curl=PATH prefix where curl is installed default=/usr + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CCAS assembler compiler command (defaults to CC) + CCASFLAGS assembler compiler flags (defaults to CFLAGS) + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +cpuminer-opt configure 25.3 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cpuminer-opt $as_me 25.3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="compile missing install-sh config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +ac_config_headers="$ac_config_headers cpuminer-config.h" + + + +am__api_version='1.16' + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='cpuminer-opt' + VERSION='25.3' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test ${enable_maintainer_mode+y} +then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else $as_nop + USE_MAINTAINER_MODE=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +if test $ac_cv_c_compiler_gnu = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +printf %s "checking whether $CC needs -traditional... " >&6; } +if test ${ac_cv_prog_gcc_traditional+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +else $as_nop + ac_cv_prog_gcc_traditional=no +fi +rm -rf conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +fi +rm -rf conftest* + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +# By default we simply use the C compiler to build assembly code. + +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + +depcc="$CCAS" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CCAS_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CCAS_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CCAS_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CCAS_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CCAS_dependencies_compiler_type" >&6; } +CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then + am__fastdepCCAS_TRUE= + am__fastdepCCAS_FALSE='#' +else + am__fastdepCCAS_TRUE='#' + am__fastdepCCAS_FALSE= +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + +ac_fn_c_check_header_compile "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_endian_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_ENDIAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h + +fi + +# sys/sysctl.h requires sys/types.h on FreeBSD +# sys/sysctl.h requires sys/param.h on OpenBSD +ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +" +if test "x$ac_cv_header_sys_sysctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "be32dec" "ac_cv_have_decl_be32dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_be32dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_BE32DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le32dec" "ac_cv_have_decl_le32dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le32dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE32DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "be32enc" "ac_cv_have_decl_be32enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_be32enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_BE32ENC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le32enc" "ac_cv_have_decl_le32enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le32enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE32ENC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le16dec" "ac_cv_have_decl_le16dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le16dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE16DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le16enc" "ac_cv_have_decl_le16enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le16enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE16ENC $ac_have_decl" >>confdefs.h + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_working_alloca_h=yes +else $as_nop + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# else +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_alloca_works=yes +else $as_nop + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } +fi + +if test $ac_cv_func_alloca_works = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_stack_direction=0 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_stack_direction=1 +else $as_nop + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h + + +fi + +ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" +if test "x$ac_cv_func_getopt_long" = xyes +then : + printf "%s\n" "#define HAVE_GETOPT_LONG 1" >>confdefs.h + +fi + + +case $target in + x86_64-*-*|amd64-*-*) + have_x86_64=true + ;; + aarch64*-*-*|arm64*-*-*) + have_arm64=true + ;; + powerpc*-*-*) + have_ppc=true + ;; +esac + +PTHREAD_FLAGS="-pthread" +WS2_LIBS="" + +case $target in + *-*-mingw*) + have_win32=true + PTHREAD_FLAGS="" + WS2_LIBS="-lws2_32" + ;; + *-apple-*) + have_apple=true + ;; +esac + +# Check whether --enable-assembly was given. +if test ${enable_assembly+y} +then : + enableval=$enable_assembly; +fi + +if test x$enable_assembly != xno; then + +printf "%s\n" "#define USE_ASM 1" >>confdefs.h + +fi + +# jansson test fails on Linux/Mingw, handled in Makefile.am. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for json_loads in -ljansson" >&5 +printf %s "checking for json_loads in -ljansson... " >&6; } +if test ${ac_cv_lib_jansson_json_loads+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ljansson $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char json_loads (void); +int +main (void) +{ +return json_loads (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_jansson_json_loads=yes +else $as_nop + ac_cv_lib_jansson_json_loads=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jansson_json_loads" >&5 +printf "%s\n" "$ac_cv_lib_jansson_json_loads" >&6; } +if test "x$ac_cv_lib_jansson_json_loads" = xyes +then : + request_jansson=false +else $as_nop + request_jansson=true +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +printf %s "checking for pthread_create in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_create=yes +else $as_nop + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthread" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC2" >&5 +printf %s "checking for pthread_create in -lpthreadGC2... " >&6; } +if test ${ac_cv_lib_pthreadGC2_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC2_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC2_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC2_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC2_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC2_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC2" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC1" >&5 +printf %s "checking for pthread_create in -lpthreadGC1... " >&6; } +if test ${ac_cv_lib_pthreadGC1_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC1 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC1_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC1_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC1_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC1_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC1_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC1" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC" >&5 +printf %s "checking for pthread_create in -lpthreadGC... " >&6; } +if test ${ac_cv_lib_pthreadGC_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC" + +fi + +fi + +fi + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __uint128_t is supported" >&5 +printf %s "checking whether __uint128_t is supported... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +static __uint128_t i = 100; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +printf "%s\n" "#define USE_INT128 1" >>confdefs.h + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# allow if in Makefile.am + if test x$request_jansson = xtrue; then + WANT_JANSSON_TRUE= + WANT_JANSSON_FALSE='#' +else + WANT_JANSSON_TRUE='#' + WANT_JANSSON_FALSE= +fi + + if test x$have_win32 = xtrue; then + HAVE_WINDOWS_TRUE= + HAVE_WINDOWS_FALSE='#' +else + HAVE_WINDOWS_TRUE='#' + HAVE_WINDOWS_FALSE= +fi + + if test x$enable_assembly != xno; then + USE_ASM_TRUE= + USE_ASM_FALSE='#' +else + USE_ASM_TRUE='#' + USE_ASM_FALSE= +fi + + if test x$have_x86_64 = xtrue; then + ARCH_x86_64_TRUE= + ARCH_x86_64_FALSE='#' +else + ARCH_x86_64_TRUE='#' + ARCH_x86_64_FALSE= +fi + + if test x$have_arm64 = xtrue; then + ARCH_ARM64_TRUE= + ARCH_ARM64_FALSE='#' +else + ARCH_ARM64_TRUE='#' + ARCH_ARM64_FALSE= +fi + + if test "x$OS" = "xWindows_NT"; then + MINGW_TRUE= + MINGW_FALSE='#' +else + MINGW_TRUE='#' + MINGW_FALSE= +fi + + if test x$have_apple = xtrue; then + HAVE_APPLE_TRUE= + HAVE_APPLE_FALSE='#' +else + HAVE_APPLE_TRUE='#' + HAVE_APPLE_FALSE= +fi + + +# libcurl install path (for mingw : --with-curl=/usr/local) + +# Check whether --with-curl was given. +if test ${with_curl+y} +then : + withval=$with_curl; +fi + + +if test -n "$with_curl" ; then + LIBCURL_CFLAGS="$LIBCURL_CFLAGS -I$with_curl/include" + LIBCURL_CPPFLAGS="$LIBCURL_CPPFLAGS -I$with_curl/include" + LIBCURL_LDFLAGS="-L$with_curl/lib $LIBCURL_LDFLAGS" + LIBCURL="-lcurl -lz" +fi + +CFLAGS="$CFLAGS $LIBCURL_CFLAGS" +CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" + +# AC_CHECK_LIB([curl], [curl_multi_timeout], +# have_libcurl=yes, +# have_libcurl=no AC_MSG_ERROR([curl library required]) +# ) + +# LIBCURL_CHECK_CONFIG([yes], 7.15, curlconfig=yes, curlconfig=no) + + + + +# AC_SUBST(LIBCURL_LDFLAGS) + + + + + + +ac_config_files="$ac_config_files Makefile compat/Makefile compat/jansson/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WANT_JANSSON_TRUE}" && test -z "${WANT_JANSSON_FALSE}"; then + as_fn_error $? "conditional \"WANT_JANSSON\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_WINDOWS_TRUE}" && test -z "${HAVE_WINDOWS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_WINDOWS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_ASM_TRUE}" && test -z "${USE_ASM_FALSE}"; then + as_fn_error $? "conditional \"USE_ASM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ARCH_x86_64_TRUE}" && test -z "${ARCH_x86_64_FALSE}"; then + as_fn_error $? "conditional \"ARCH_x86_64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ARCH_ARM64_TRUE}" && test -z "${ARCH_ARM64_FALSE}"; then + as_fn_error $? "conditional \"ARCH_ARM64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MINGW_TRUE}" && test -z "${MINGW_FALSE}"; then + as_fn_error $? "conditional \"MINGW\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_APPLE_TRUE}" && test -z "${HAVE_APPLE_FALSE}"; then + as_fn_error $? "conditional \"HAVE_APPLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cpuminer-opt $as_me 25.3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +cpuminer-opt config.status 25.3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "cpuminer-config.h") CONFIG_HEADERS="$CONFIG_HEADERS cpuminer-config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "compat/Makefile") CONFIG_FILES="$CONFIG_FILES compat/Makefile" ;; + "compat/jansson/Makefile") CONFIG_FILES="$CONFIG_FILES compat/jansson/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + diff --git a/rin/miner/cpuminer/configure.ac b/rin/miner/cpuminer/configure.ac new file mode 100644 index 0000000..859da80 --- /dev/null +++ b/rin/miner/cpuminer/configure.ac @@ -0,0 +1,139 @@ +AC_INIT([cpuminer-opt], [25.3]) + +AC_PREREQ([2.59c]) +AC_CANONICAL_SYSTEM +AC_CONFIG_SRCDIR([cpu-miner.c]) +AC_CONFIG_HEADERS([cpuminer-config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([foreign subdir-objects]) + +dnl Make sure anyone changing configure.ac/Makefile.am has a clue +AM_MAINTAINER_MODE + +dnl Checks for programs +AC_PROG_CC_C99 +AC_PROG_GCC_TRADITIONAL +AM_PROG_CC_C_O +AM_PROG_AS +AC_PROG_RANLIB +AC_PROG_CXX + +dnl Checks for header files +AC_HEADER_STDC +AC_CHECK_HEADERS([sys/endian.h sys/param.h syslog.h]) +# sys/sysctl.h requires sys/types.h on FreeBSD +# sys/sysctl.h requires sys/param.h on OpenBSD +AC_CHECK_HEADERS([sys/sysctl.h], [], [], +[#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +]) + +AC_CHECK_DECLS([be32dec, le32dec, be32enc, le32enc, le16dec, le16enc], [], [], +[AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif +]) + +AC_FUNC_ALLOCA +AC_CHECK_FUNCS([getopt_long]) + +case $target in + x86_64-*-*|amd64-*-*) + have_x86_64=true + ;; + aarch64*-*-*|arm64*-*-*) + have_arm64=true + ;; + powerpc*-*-*) + have_ppc=true + ;; +esac + +PTHREAD_FLAGS="-pthread" +WS2_LIBS="" + +case $target in + *-*-mingw*) + have_win32=true + PTHREAD_FLAGS="" + WS2_LIBS="-lws2_32" + ;; + *-apple-*) + have_apple=true + ;; +esac + +AC_ARG_ENABLE([assembly], + AS_HELP_STRING([--disable-assembly], [disable assembly-language routines])) +if test x$enable_assembly != xno; then + AC_DEFINE([USE_ASM], [1], [Define to 1 if assembly routines are wanted.]) +fi + +# jansson test fails on Linux/Mingw, handled in Makefile.am. +AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true) + +AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS="-lpthread", + AC_CHECK_LIB([pthreadGC2], [pthread_create], PTHREAD_LIBS="-lpthreadGC2", + AC_CHECK_LIB([pthreadGC1], [pthread_create], PTHREAD_LIBS="-lpthreadGC1", + AC_CHECK_LIB([pthreadGC], [pthread_create], PTHREAD_LIBS="-lpthreadGC" +)))) + +AC_MSG_CHECKING(whether __uint128_t is supported) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([static __uint128_t i = 100;])], + AC_DEFINE(USE_INT128, 1, [Define if __uint128_t is available]) + AC_MSG_RESULT(yes) + , + AC_MSG_RESULT(no) +) + +# allow if in Makefile.am +AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue]) +AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue]) +AM_CONDITIONAL([USE_ASM], [test x$enable_assembly != xno]) +AM_CONDITIONAL([ARCH_x86_64], [test x$have_x86_64 = xtrue]) +AM_CONDITIONAL([ARCH_ARM64], [test x$have_arm64 = xtrue]) +AM_CONDITIONAL([MINGW], [test "x$OS" = "xWindows_NT"]) +AM_CONDITIONAL([HAVE_APPLE], [test x$have_apple = xtrue]) + +# libcurl install path (for mingw : --with-curl=/usr/local) +AC_ARG_WITH([curl], + [ --with-curl=PATH prefix where curl is installed [default=/usr]]) + +if test -n "$with_curl" ; then + LIBCURL_CFLAGS="$LIBCURL_CFLAGS -I$with_curl/include" + LIBCURL_CPPFLAGS="$LIBCURL_CPPFLAGS -I$with_curl/include" + LIBCURL_LDFLAGS="-L$with_curl/lib $LIBCURL_LDFLAGS" + LIBCURL="-lcurl -lz" +fi + +CFLAGS="$CFLAGS $LIBCURL_CFLAGS" +CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" + +# AC_CHECK_LIB([curl], [curl_multi_timeout], +# have_libcurl=yes, +# have_libcurl=no AC_MSG_ERROR([curl library required]) +# ) + +# LIBCURL_CHECK_CONFIG([yes], 7.15, curlconfig=yes, curlconfig=no) + +AC_SUBST(LIBCURL) +AC_SUBST(LIBCURL_CFLAGS) +AC_SUBST(LIBCURL_CPPFLAGS) +# AC_SUBST(LIBCURL_LDFLAGS) + +AC_SUBST(JANSSON_LIBS) +AC_SUBST(PTHREAD_FLAGS) +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(WS2_LIBS) + +AC_CONFIG_FILES([ + Makefile + compat/Makefile + compat/jansson/Makefile + ]) +AC_OUTPUT diff --git a/rin/miner/cpuminer/configure~ b/rin/miner/cpuminer/configure~ new file mode 100644 index 0000000..56d7e61 --- /dev/null +++ b/rin/miner/cpuminer/configure~ @@ -0,0 +1,8399 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for cpuminer-opt 25.3. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='cpuminer-opt' +PACKAGE_TARNAME='cpuminer-opt' +PACKAGE_VERSION='25.3' +PACKAGE_STRING='cpuminer-opt 25.3' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="cpu-miner.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +WS2_LIBS +PTHREAD_LIBS +PTHREAD_FLAGS +JANSSON_LIBS +LIBCURL_CPPFLAGS +LIBCURL_CFLAGS +LIBCURL +HAVE_APPLE_FALSE +HAVE_APPLE_TRUE +MINGW_FALSE +MINGW_TRUE +ARCH_ARM64_FALSE +ARCH_ARM64_TRUE +ARCH_x86_64_FALSE +ARCH_x86_64_TRUE +USE_ASM_FALSE +USE_ASM_TRUE +HAVE_WINDOWS_FALSE +HAVE_WINDOWS_TRUE +WANT_JANSSON_FALSE +WANT_JANSSON_TRUE +ALLOCA +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +RANLIB +am__fastdepCCAS_FALSE +am__fastdepCCAS_TRUE +CCASDEPMODE +CCASFLAGS +CCAS +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_maintainer_mode +enable_dependency_tracking +enable_assembly +with_curl +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CCAS +CCASFLAGS +CXX +CXXFLAGS +CCC' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures cpuminer-opt 25.3 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/cpuminer-opt] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cpuminer-opt 25.3:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-maintainer-mode + enable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-assembly disable assembly-language routines + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-curl=PATH prefix where curl is installed default=/usr + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CCAS assembler compiler command (defaults to CC) + CCASFLAGS assembler compiler flags (defaults to CFLAGS) + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +cpuminer-opt configure 25.3 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cpuminer-opt $as_me 25.3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="compile missing install-sh config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +ac_config_headers="$ac_config_headers cpuminer-config.h" + + + +am__api_version='1.16' + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='cpuminer-opt' + VERSION='25.3' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test ${enable_maintainer_mode+y} +then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else $as_nop + USE_MAINTAINER_MODE=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +if test $ac_cv_c_compiler_gnu = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +printf %s "checking whether $CC needs -traditional... " >&6; } +if test ${ac_cv_prog_gcc_traditional+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +else $as_nop + ac_cv_prog_gcc_traditional=no +fi +rm -rf conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +fi +rm -rf conftest* + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +# By default we simply use the C compiler to build assembly code. + +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + +depcc="$CCAS" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CCAS_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CCAS_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CCAS_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CCAS_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CCAS_dependencies_compiler_type" >&6; } +CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then + am__fastdepCCAS_TRUE= + am__fastdepCCAS_FALSE='#' +else + am__fastdepCCAS_TRUE='#' + am__fastdepCCAS_FALSE= +fi + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + +ac_fn_c_check_header_compile "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_endian_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_ENDIAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h + +fi + +# sys/sysctl.h requires sys/types.h on FreeBSD +# sys/sysctl.h requires sys/param.h on OpenBSD +ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +" +if test "x$ac_cv_header_sys_sysctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "be32dec" "ac_cv_have_decl_be32dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_be32dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_BE32DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le32dec" "ac_cv_have_decl_le32dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le32dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE32DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "be32enc" "ac_cv_have_decl_be32enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_be32enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_BE32ENC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le32enc" "ac_cv_have_decl_le32enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le32enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE32ENC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le16dec" "ac_cv_have_decl_le16dec" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le16dec" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE16DEC $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "le16enc" "ac_cv_have_decl_le16enc" "$ac_includes_default +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_le16enc" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_LE16ENC $ac_have_decl" >>confdefs.h + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_working_alloca_h=yes +else $as_nop + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# else +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_alloca_works=yes +else $as_nop + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } +fi + +if test $ac_cv_func_alloca_works = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_stack_direction=0 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_stack_direction=1 +else $as_nop + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h + + +fi + +ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" +if test "x$ac_cv_func_getopt_long" = xyes +then : + printf "%s\n" "#define HAVE_GETOPT_LONG 1" >>confdefs.h + +fi + + +case $target in + x86_64-*-*|amd64-*-*) + have_x86_64=true + ;; + aarch64*-*-*|arm64*-*-*) + have_arm64=true + ;; + powerpc*-*-*) + have_ppc=true + ;; +esac + +PTHREAD_FLAGS="-pthread" +WS2_LIBS="" + +case $target in + *-*-mingw*) + have_win32=true + PTHREAD_FLAGS="" + WS2_LIBS="-lws2_32" + ;; + *-apple-*) + have_apple=true + ;; +esac + +# Check whether --enable-assembly was given. +if test ${enable_assembly+y} +then : + enableval=$enable_assembly; +fi + +if test x$enable_assembly != xno; then + +printf "%s\n" "#define USE_ASM 1" >>confdefs.h + +fi + +# jansson test fails on Linux/Mingw, handled in Makefile.am. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for json_loads in -ljansson" >&5 +printf %s "checking for json_loads in -ljansson... " >&6; } +if test ${ac_cv_lib_jansson_json_loads+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ljansson $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char json_loads (void); +int +main (void) +{ +return json_loads (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_jansson_json_loads=yes +else $as_nop + ac_cv_lib_jansson_json_loads=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jansson_json_loads" >&5 +printf "%s\n" "$ac_cv_lib_jansson_json_loads" >&6; } +if test "x$ac_cv_lib_jansson_json_loads" = xyes +then : + request_jansson=false +else $as_nop + request_jansson=true +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +printf %s "checking for pthread_create in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_create=yes +else $as_nop + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthread" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC2" >&5 +printf %s "checking for pthread_create in -lpthreadGC2... " >&6; } +if test ${ac_cv_lib_pthreadGC2_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC2_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC2_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC2_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC2_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC2_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC2" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC1" >&5 +printf %s "checking for pthread_create in -lpthreadGC1... " >&6; } +if test ${ac_cv_lib_pthreadGC1_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC1 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC1_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC1_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC1_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC1_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC1_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC1" +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreadGC" >&5 +printf %s "checking for pthread_create in -lpthreadGC... " >&6; } +if test ${ac_cv_lib_pthreadGC_pthread_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthreadGC $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthreadGC_pthread_create=yes +else $as_nop + ac_cv_lib_pthreadGC_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreadGC_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthreadGC_pthread_create" >&6; } +if test "x$ac_cv_lib_pthreadGC_pthread_create" = xyes +then : + PTHREAD_LIBS="-lpthreadGC" + +fi + +fi + +fi + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __uint128_t is supported" >&5 +printf %s "checking whether __uint128_t is supported... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +static __uint128_t i = 100; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +printf "%s\n" "#define USE_INT128 1" >>confdefs.h + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# allow if in Makefile.am + if test x$request_jansson = xtrue; then + WANT_JANSSON_TRUE= + WANT_JANSSON_FALSE='#' +else + WANT_JANSSON_TRUE='#' + WANT_JANSSON_FALSE= +fi + + if test x$have_win32 = xtrue; then + HAVE_WINDOWS_TRUE= + HAVE_WINDOWS_FALSE='#' +else + HAVE_WINDOWS_TRUE='#' + HAVE_WINDOWS_FALSE= +fi + + if test x$enable_assembly != xno; then + USE_ASM_TRUE= + USE_ASM_FALSE='#' +else + USE_ASM_TRUE='#' + USE_ASM_FALSE= +fi + + if test x$have_x86_64 = xtrue; then + ARCH_x86_64_TRUE= + ARCH_x86_64_FALSE='#' +else + ARCH_x86_64_TRUE='#' + ARCH_x86_64_FALSE= +fi + + if test x$have_arm64 = xtrue; then + ARCH_ARM64_TRUE= + ARCH_ARM64_FALSE='#' +else + ARCH_ARM64_TRUE='#' + ARCH_ARM64_FALSE= +fi + + if test "x$OS" = "xWindows_NT"; then + MINGW_TRUE= + MINGW_FALSE='#' +else + MINGW_TRUE='#' + MINGW_FALSE= +fi + + if test x$have_apple = xtrue; then + HAVE_APPLE_TRUE= + HAVE_APPLE_FALSE='#' +else + HAVE_APPLE_TRUE='#' + HAVE_APPLE_FALSE= +fi + + +# libcurl install path (for mingw : --with-curl=/usr/local) + +# Check whether --with-curl was given. +if test ${with_curl+y} +then : + withval=$with_curl; +fi + + +if test -n "$with_curl" ; then + LIBCURL_CFLAGS="$LIBCURL_CFLAGS -I$with_curl/include" + LIBCURL_CPPFLAGS="$LIBCURL_CPPFLAGS -I$with_curl/include" + LIBCURL_LDFLAGS="-L$with_curl/lib $LIBCURL_LDFLAGS" + LIBCURL="-lcurl -lz" +fi + +CFLAGS="$CFLAGS $LIBCURL_CFLAGS" +CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" + +# AC_CHECK_LIB([curl], [curl_multi_timeout], +# have_libcurl=yes, +# have_libcurl=no AC_MSG_ERROR([curl library required]) +# ) + +# LIBCURL_CHECK_CONFIG([yes], 7.15, curlconfig=yes, curlconfig=no) + + + + +# AC_SUBST(LIBCURL_LDFLAGS) + + + + + + +ac_config_files="$ac_config_files Makefile compat/Makefile compat/jansson/Makefile " + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WANT_JANSSON_TRUE}" && test -z "${WANT_JANSSON_FALSE}"; then + as_fn_error $? "conditional \"WANT_JANSSON\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_WINDOWS_TRUE}" && test -z "${HAVE_WINDOWS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_WINDOWS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_ASM_TRUE}" && test -z "${USE_ASM_FALSE}"; then + as_fn_error $? "conditional \"USE_ASM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ARCH_x86_64_TRUE}" && test -z "${ARCH_x86_64_FALSE}"; then + as_fn_error $? "conditional \"ARCH_x86_64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ARCH_ARM64_TRUE}" && test -z "${ARCH_ARM64_FALSE}"; then + as_fn_error $? "conditional \"ARCH_ARM64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MINGW_TRUE}" && test -z "${MINGW_FALSE}"; then + as_fn_error $? "conditional \"MINGW\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_APPLE_TRUE}" && test -z "${HAVE_APPLE_FALSE}"; then + as_fn_error $? "conditional \"HAVE_APPLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cpuminer-opt $as_me 25.3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +cpuminer-opt config.status 25.3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "cpuminer-config.h") CONFIG_HEADERS="$CONFIG_HEADERS cpuminer-config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + " ") CONFIG_FILES="$CONFIG_FILES " ;; + "Makefile ") CONFIG_FILES="$CONFIG_FILES Makefile " ;; + "compat/Makefile ") CONFIG_FILES="$CONFIG_FILES compat/Makefile " ;; + "compat/jansson/Makefile ") CONFIG_FILES="$CONFIG_FILES compat/jansson/Makefile " ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + diff --git a/rin/miner/cpuminer/cpu-miner.c b/rin/miner/cpuminer/cpu-miner.c new file mode 100644 index 0000000..46b0ffe --- /dev/null +++ b/rin/miner/cpuminer/cpu-miner.c @@ -0,0 +1,4115 @@ +/* + * Copyright 2010 Jeff Garzik + * Copyright 2012-2014 pooler + * Copyright 2014 Lucas Jones + * Copyright 2014-2016 Tanguy Pruvot + * Copyright 2016-2023 Jay D Dee + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +/* + * Change log + * + * 2016-01-14: v 1.9-RC inititial limited release combining + * cpuminer-multi 1.2-prev, darkcoin-cpu-miner 1.3, + * and cp3u 2.3.2 plus some performance optimizations. + * + * 2016-02-04: v3.1 algo_gate implemntation + */ + +#include +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +//#include +#include "sysinfos.c" +#include "algo/sha/sha256d.h" +#ifdef WIN32 +#include +#include +#endif + +#ifdef _MSC_VER +#include +#else +#include +#if HAVE_SYS_SYSCTL_H +#include +#if HAVE_SYS_PARAM_H +#include +#endif + + + + +// GCC 9 warning sysctl.h is deprecated +#if ( __GNUC__ < 9 ) +#include +#endif + +#endif // HAVE_SYS_SYSCTL_H +#endif // _MSC_VER ELSE + +#ifndef WIN32 +#include +#endif + +#include "miner.h" +#include "algo-gate-api.h" +#include "algo/sha/sha256-hash.h" + +#ifdef WIN32 +#include "compat/winansi.h" +//BOOL WINAPI ConsoleHandler(DWORD); +#endif +#ifdef _MSC_VER +#include +#pragma comment(lib, "winmm.lib") +#endif +#if defined(_WIN32) || defined(_WIN64) + // Windows (MinGWなど) 向け:LEなので変換が必要な場合は bswap を使う + static inline uint32_t htole32(uint32_t x) { + return ((x >> 24) & 0x000000FF) | + ((x >> 8) & 0x0000FF00) | + ((x << 8) & 0x00FF0000) | + ((x << 24) & 0xFF000000); + } + static inline uint32_t htobe32(uint32_t x) { + return ((x >> 24) & 0x000000FF) | + ((x >> 8) & 0x0000FF00) | + ((x << 8) & 0x00FF0000) | + ((x << 24) & 0xFF000000); + } +#else + // Linux/Unix:標準の htole32 を使う + #include +#endif + +#define LP_SCANTIME 60 + +algo_gate_t algo_gate; + +bool opt_debug = false; +bool opt_debug_diff = false; +bool opt_protocol = false; +bool opt_benchmark = false; +bool opt_redirect = true; +bool opt_extranonce = true; +bool want_longpoll = false; +bool have_longpoll = false; +bool have_gbt = true; +bool allow_getwork = true; +bool want_stratum = true; // pretty useless +bool have_stratum = false; +bool stratum_down = true; +bool allow_mininginfo = true; +bool use_syslog = false; +bool use_colors = true; +static bool opt_background = false; +bool opt_quiet = false; +bool opt_randomize = false; +static int opt_retries = -1; +static int opt_fail_pause = 10; +static int opt_time_limit = 0; +static unsigned int time_limit_stop = 0; +int opt_timeout = 300; +static int opt_scantime = 0; +const int min_scantime = 1; +//static const bool opt_time = true; +enum algos opt_algo = ALGO_NULL; +char* opt_param_key = NULL; +int opt_param_n = 0; +int opt_param_r = 0; +int opt_n_threads = 0; +bool opt_sapling = false; +bool opt_mweb = false; // add mweb option definition +static uint64_t opt_affinity = 0xFFFFFFFFFFFFFFFFULL; // default, use all cores +int opt_priority = 0; // deprecated +int num_cpus = 1; +int num_cpugroups = 1; // For Windows +char *rpc_url = NULL; +char *rpc_userpass = NULL; +char *rpc_user, *rpc_pass; +char *short_url = NULL; +char *coinbase_address; +char *opt_data_file = NULL; +bool opt_verify = false; +static bool opt_stratum_keepalive = false; +static struct timeval stratum_keepalive_timer; +// Stratum typically times out in 5 minutes or 300 seconds +#define stratum_keepalive_timeout 150 // 2.5 minutes +static struct timeval stratum_reset_time; + +// pk_buffer_size is used as a version selector by b58 code, therefore +// it must be set correctly to work. +const int pk_buffer_size_max = 26; +int pk_buffer_size = 25; +static unsigned char pk_script[ 26 ] = { 0 }; +static size_t pk_script_size = 0; +static char coinbase_sig[101] = { 0 }; +char *opt_cert; +char *opt_proxy; +long opt_proxy_type; +struct thr_info *thr_info; +int work_thr_id; +int longpoll_thr_id = -1; +int stratum_thr_id = -1; +int api_thr_id = -1; +bool stratum_need_reset = false; +struct work_restart *work_restart = NULL; +struct stratum_ctx stratum; +double opt_diff_factor = 1.0; +double opt_target_factor = 1.0; +uint32_t zr5_pok = 0; +bool opt_stratum_stats = false; +bool opt_hash_meter = false; +uint32_t submitted_share_count= 0; +uint32_t accepted_share_count = 0; +uint32_t rejected_share_count = 0; +uint32_t stale_share_count = 0; +uint32_t solved_block_count = 0; +uint32_t stratum_errors = 0; +double *thr_hashrates; +double global_hashrate = 0.; +double total_hashes = 0.; +struct timeval total_hashes_time = {0,0}; +double stratum_diff = 0.; +double net_diff = 0.; +double net_hashrate = 0.; +uint64_t net_blocks = 0; +uint32_t opt_work_size = 0; +bool opt_bell = false; + +// conditional mining +bool *conditional_state = NULL; +//bool conditional_state[MAX_CPUS] = { 0 }; +double opt_max_temp = 0.0; +double opt_max_diff = 0.0; +double opt_max_rate = 0.0; + +// API +static bool opt_api_enabled = false; +char *opt_api_allow = NULL; +int opt_api_listen = 0; +int opt_api_remote = 0; +char *default_api_allow = "127.0.0.1"; +int default_api_listen = 4048; + + pthread_mutex_t applog_lock; + pthread_mutex_t stats_lock; + +static struct timeval session_start; +static struct timeval five_min_start; +static uint64_t session_first_block = 0; +static uint64_t submit_sum = 0; +static uint64_t accept_sum = 0; +static uint64_t stale_sum = 0; +static uint64_t reject_sum = 0; +static uint64_t solved_sum = 0; +static double norm_diff_sum = 0.; +static uint32_t last_block_height = 0; +static double highest_share = 0; // highest accepted share diff +static double lowest_share = 9e99; // lowest accepted share diff +static double last_targetdiff = 0.; +#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32) || defined(__APPLE__)) +static uint32_t hi_temp = 0; +static uint32_t prev_temp = 0; +#endif + + +static char const short_options[] = +#ifdef HAVE_SYSLOG_H + "S" +#endif + "a:b:Bc:CDf:hK:m:n:N:p:Px:qr:R:s:t:T:o:u:O:V"; + +static struct work g_work __attribute__ ((aligned (64))) = {{ 0 }}; +time_t g_work_time = 0; +pthread_rwlock_t g_work_lock; +static bool submit_old = false; +char* lp_id; + +static void workio_cmd_free(struct workio_cmd *wc); + +static int *thread_affinity_map; + +// display affinity mask graphically +static void format_affinity_mask( char *mask_str, uint64_t mask ) +{ +#if defined(WINDOWS_CPU_GROUPS_ENABLED) + int n = num_cpus / num_cpugroups; +#else + int n = num_cpus < 64 ? num_cpus : 64; +#endif + int i; + for ( i = 0; i < n; i++ ) + { + if ( mask & 1 ) mask_str[i] = '!'; + else mask_str[i] = '.'; + mask >>= 1; + } + memset( &mask_str[i], 0, 64 - i ); +} + +#ifdef __linux /* Linux specific policy and affinity management */ +#include + +static inline void drop_policy(void) +{ + struct sched_param param; + param.sched_priority = 0; +#ifdef SCHED_IDLE + if (unlikely(sched_setscheduler(0, SCHED_IDLE, ¶m) == -1)) +#endif +#ifdef SCHED_BATCH + sched_setscheduler(0, SCHED_BATCH, ¶m); +#endif +} + +#ifdef __BIONIC__ +#define pthread_setaffinity_np(tid,sz,s) {} /* only do process affinity */ +#endif + +static void affine_to_cpu( struct thr_info *thr ) +{ + int thread = thr->id; + cpu_set_t set; + CPU_ZERO( &set ); + CPU_SET( thread_affinity_map[ thread ], &set ); + if ( opt_debug ) + applog( LOG_INFO, "Binding thread %d to cpu %d", + thread, thread_affinity_map[ thread ] ); + pthread_setaffinity_np( thr->pth, sizeof(set), &set ); +} + +#elif defined(WIN32) /* Windows */ + +static inline void drop_policy(void) { } + +// Windows CPU groups to manage more than 64 CPUs. +// mask arg is ignored +static void affine_to_cpu( struct thr_info *thr ) +{ + int thread = thr->id; + unsigned long last_error = 0; + bool ok = true; + +#if defined(WINDOWS_CPU_GROUPS_ENABLED) + unsigned long group_size = GetActiveProcessorCount( 0 ); + unsigned long group = thread / group_size; + unsigned long cpu = thread_affinity_map[ thread % group_size ]; + + GROUP_AFFINITY affinity = {0}; + affinity.Group = group; + affinity.Mask = 1ULL << cpu; + + if ( opt_debug ) + applog( LOG_INFO, "Binding thread %d to cpu %d in cpu group %d", + thread, cpu, group ); + + ok = SetThreadGroupAffinity( GetCurrentThread(), &affinity, NULL ); + +#else + + unsigned long cpu = thread_affinity_map[ thread ]; + uint64_t mask = 1ULL << cpu; + + if ( opt_debug ) + applog( LOG_INFO, "Binding thread %d to cpu %d", thread, cpu ); + + ok = SetThreadAffinityMask( GetCurrentThread(), mask ); + +#endif + + if ( !ok ) + { + last_error = GetLastError(); + if ( !thread ) + applog( LOG_WARNING, "Set affinity returned error 0x%x", last_error ); + } +} + +#else + +static inline void drop_policy(void) { } +static void affine_to_cpu( struct thr_info *thr ) { } + +#endif + +// not very useful, just index the arrray directly. +// but declaring this function in miner.h eliminates +// an annoying compiler warning for not using a static. +const char* algo_name( enum algos a ) {return algo_names[a];} + +void get_currentalgo(char* buf, int sz) +{ + snprintf(buf, sz, "%s", algo_names[opt_algo]); +} + +void proper_exit(int reason) +{ + if (opt_debug) applog(LOG_INFO,"Program exit"); +#ifdef WIN32 + if (opt_background) { + HWND hcon = GetConsoleWindow(); + if (hcon) { + // unhide parent command line windows + ShowWindow(hcon, SW_SHOWMINNOACTIVE); + } + } +#endif + exit(reason); +} + +uint32_t* get_stratum_job_ntime() +{ + return (uint32_t*)stratum.job.ntime; +} + +void work_free(struct work *w) +{ + if (w->txs) free(w->txs); + if (w->workid) free(w->workid); + if (w->job_id) free(w->job_id); + if (w->xnonce2) free(w->xnonce2); +} + +void work_copy(struct work *dest, const struct work *src) +{ + memcpy(dest, src, sizeof(struct work)); + if (src->txs) + dest->txs = strdup(src->txs); + if (src->workid) + dest->workid = strdup(src->workid); + if (src->job_id) + dest->job_id = strdup(src->job_id); + if (src->xnonce2) { + dest->xnonce2 = (uchar*) malloc(src->xnonce2_len); + memcpy(dest->xnonce2, src->xnonce2, src->xnonce2_len); + } +} + +int std_get_work_data_size() { return STD_WORK_DATA_SIZE; } + +// Default +bool std_le_work_decode( struct work *work ) +{ + int i; + const int adata_sz = algo_gate.get_work_data_size() / 4; +// const int atarget_sz = ARRAY_SIZE(work->target); + + for ( i = 0; i < adata_sz; i++ ) + work->data[i] = le32dec( work->data + i ); + for ( i = 0; i < 8; i++ ) + work->target[i] = le32dec( work->target + i ); + return true; +} + +bool std_be_work_decode( struct work *work ) +{ + int i; + const int adata_sz = algo_gate.get_work_data_size() / 4; +// const int atarget_sz = ARRAY_SIZE(work->target); + + for ( i = 0; i < adata_sz; i++ ) + work->data[i] = be32dec( work->data + i ); + for ( i = 0; i < 8; i++ ) + work->target[i] = le32dec( work->target + i ); + return true; +} + +static bool work_decode( const json_t *val, struct work *work ) +{ + const int data_size = algo_gate.get_work_data_size(); + const int target_size = sizeof(work->target); + + if (unlikely( !jobj_binary(val, "data", work->data, data_size) )) + { + applog(LOG_ERR, "JSON invalid data"); + return false; + } + if (unlikely( !jobj_binary(val, "target", work->target, target_size) )) + { + applog(LOG_ERR, "JSON invalid target"); + return false; + } + + if ( unlikely( !algo_gate.work_decode( work ) ) ) + return false; + + // many of these aren't used solo. + net_diff = + work->targetdiff = + stratum_diff = + last_targetdiff = hash_to_diff( work->target ); + work->sharediff = 0; + algo_gate.decode_extra_data( work, &net_blocks ); + + return true; +} + +// Only used for net_hashrate with GBT/getwork, data is from previous block. +static const char *info_req = +"{\"method\": \"getmininginfo\", \"params\": [], \"id\":8}\r\n"; + +static bool get_mininginfo( CURL *curl, struct work *work ) +{ + if ( have_stratum || !allow_mininginfo ) + return false; + + int curl_err = 0; + json_t *val = json_rpc_call( curl, rpc_url, rpc_userpass, info_req, + &curl_err, 0 ); + + if ( !val && curl_err == -1 ) + { + allow_mininginfo = false; + applog( LOG_NOTICE, "\"getmininginfo\" not supported, some stats not available" ); + return false; + } + + json_t *res = json_object_get( val, "result" ); + // "blocks": 491493 (= current work height - 1) + // "difficulty": 0.99607860999999998 + // "networkhashps": 56475980 + if ( res ) + { + double difficulty = 0.; + json_t *key = json_object_get( res, "difficulty" ); + if ( key ) + { + if ( json_is_object( key ) ) + key = json_object_get( key, "proof-of-work" ); + if ( json_is_real( key ) ) + difficulty = json_real_value( key ); + } + + key = json_object_get( res, "networkhashps" ); + if ( key ) + { + if ( json_is_integer( key ) ) + net_hashrate = (double) json_integer_value( key ); + else if ( json_is_real( key ) ) + net_hashrate = (double) json_real_value( key ); + } + + key = json_object_get( res, "blocks" ); + if ( key && json_is_integer( key ) ) + net_blocks = json_integer_value( key ); + + if ( opt_debug ) + applog( LOG_INFO,"getmininginfo: difficulty %.5g, networkhashps %.5g, blocks %d", difficulty, net_hashrate, net_blocks ); + + if ( !work->height ) + { + // complete missing data from getwork + if ( opt_debug ) + applog( LOG_DEBUG, "work height set by getmininginfo" ); + work->height = (uint32_t) net_blocks + 1; + if ( work->height > g_work.height ) + restart_threads(); + } // res + } + json_decref( val ); + return true; +} + +// hodl needs 4 but leave it at 3 until gbt better understood +//#define BLOCK_VERSION_CURRENT 3 +#define BLOCK_VERSION_CURRENT 4 + +static bool gbt_work_decode( const json_t *val, struct work *work ) +{ + uint32_t prevhash[8] __attribute__ ((aligned (32))); + uint32_t target[8] __attribute__ ((aligned (32))); + unsigned char final_sapling_hash[32] __attribute__ ((aligned (32))); + uint32_t version, curtime, bits; + int cbtx_size; + uchar *cbtx = NULL; + int tx_count, tx_size; + uchar txc_vi[9]; + uchar(*merkle_tree)[32] = NULL; + bool coinbase_append = false; + bool submit_coinbase = false; + bool version_force = false; + bool version_reduce = false; + json_t *tmp, *txa; + bool rc = false; + int i, n; + bool segwit = false; + + tmp = json_object_get( val, "rules" ); + if ( tmp && json_is_array( tmp ) ) + { + n = json_array_size( tmp ); + for ( i = 0; i < n; i++ ) + { + const char *s = json_string_value( json_array_get( tmp, i ) ); + if ( !s ) + continue; + if ( !strcmp( s, "segwit" ) || !strcmp( s, "!segwit" ) ) + { + segwit = true; + if ( opt_debug ) + applog( LOG_INFO, "GBT: SegWit is enabled" ); + } + } + } + + tmp = json_object_get( val, "mutable" ); + if ( tmp && json_is_array( tmp ) ) + { + n = (int) json_array_size( tmp ); + for ( i = 0; i < n; i++ ) + { + const char *s = json_string_value( json_array_get( tmp, i ) ); + if ( !s ) + continue; + if ( !strcmp( s, "coinbase/append" ) ) coinbase_append = true; + else if ( !strcmp( s, "submit/coinbase" ) ) submit_coinbase = true; + else if ( !strcmp( s, "version/force" ) ) version_force = true; + else if ( !strcmp( s, "version/reduce" ) ) version_reduce = true; + } + } + + tmp = json_object_get( val, "height" ); + if ( !tmp || !json_is_integer( tmp ) ) + { + applog( LOG_ERR, "JSON invalid height" ); + goto out; + } + work->height = (int) json_integer_value( tmp ); + + tmp = json_object_get(val, "version"); + if ( !tmp || !json_is_integer( tmp ) ) + { + applog( LOG_ERR, "JSON invalid version" ); + goto out; + } + version = (uint32_t) json_integer_value( tmp ); + // yescryptr8g uses block version 5 and sapling. + if ( opt_sapling ) + work->sapling = true; + if ( (version & 0xffU) > BLOCK_VERSION_CURRENT ) + { + if ( version_reduce ) + version = ( version & ~0xffU ) | BLOCK_VERSION_CURRENT; + else if ( have_gbt && allow_getwork && !version_force ) + { + applog( LOG_DEBUG, "Switching to getwork, gbt version %d", version ); + have_gbt = false; + goto out; + } + else if ( !version_force ) + { + applog(LOG_ERR, "Unrecognized block version: %u", version); + goto out; + } + } + + if ( unlikely( !jobj_binary(val, "previousblockhash", prevhash, + sizeof(prevhash)) ) ) + { + applog( LOG_ERR, "JSON invalid previousblockhash" ); + goto out; + } + + tmp = json_object_get( val, "curtime" ); + if ( !tmp || !json_is_integer( tmp ) ) + { + applog( LOG_ERR, "JSON invalid curtime" ); + goto out; + } + curtime = (uint32_t) json_integer_value(tmp); + + uint32_t bits_be; + if ( unlikely( !jobj_binary( val, "bits", &bits_be, sizeof(bits_be) ) ) ) + { + applog(LOG_ERR, "JSON invalid bits"); + goto out; + } + bits = be32dec(&bits_be); + + if ( work->sapling ) + { + if ( unlikely( !jobj_binary( val, "finalsaplingroothash", + final_sapling_hash, sizeof(final_sapling_hash) ) ) ) + { + applog( LOG_ERR, "JSON invalid finalsaplingroothash" ); + goto out; + } + } + + /* find count and size of transactions */ + txa = json_object_get(val, "transactions" ); + if ( !txa || !json_is_array( txa ) ) + { + applog( LOG_ERR, "JSON invalid transactions" ); + goto out; + } + tx_count = (int) json_array_size( txa ); + tx_size = 0; + for ( i = 0; i < tx_count; i++ ) + { + const json_t *tx = json_array_get( txa, i ); + const char *tx_hex = json_string_value( json_object_get( tx, "data" ) ); + if ( !tx_hex ) + { + applog( LOG_ERR, "JSON invalid transactions" ); + goto out; + } + tx_size += (int) ( strlen( tx_hex ) / 2 ); + } + + /* build coinbase transaction */ + tmp = json_object_get( val, "coinbasetxn" ); + if ( tmp ) + { + const char *cbtx_hex = json_string_value( json_object_get( tmp, "data" )); + cbtx_size = cbtx_hex ? (int) strlen( cbtx_hex ) / 2 : 0; + cbtx = (uchar*) malloc( cbtx_size + 100 ); + if ( cbtx_size < 60 || !hex2bin( cbtx, cbtx_hex, cbtx_size ) ) + { + applog( LOG_ERR, "JSON invalid coinbasetxn" ); + goto out; + } + } + else + { + int64_t cbvalue; + if ( !pk_script_size ) + { + if ( allow_getwork ) + { + applog( LOG_INFO, "No payout address provided, switching to getwork"); + have_gbt = false; + } + else + applog( LOG_ERR, "No payout address provided" ); + goto out; + } + tmp = json_object_get( val, "coinbasevalue" ); + if ( !tmp || !json_is_number( tmp ) ) + { + applog( LOG_ERR, "JSON invalid coinbasevalue" ); + goto out; + } + cbvalue = (int64_t) ( json_is_integer( tmp ) ? json_integer_value( tmp ) + : json_number_value( tmp ) ); + cbtx = (uchar*) malloc(256); + le32enc( (uint32_t *)cbtx, 1 ); /* version */ + cbtx[4] = 1; /* in-counter */ + memset( cbtx+5, 0x00, 32 ); /* prev txout hash */ + le32enc( (uint32_t *)(cbtx+37), 0xffffffff ); /* prev txout index */ + cbtx_size = 43; + /* BIP 34: height in coinbase */ + for ( n = work->height; n; n >>= 8 ) + cbtx[cbtx_size++] = n & 0xff; + /* If the last byte pushed is >= 0x80, then we need to add + another zero byte to signal that the block height is a + positive number. */ + if (cbtx[cbtx_size - 1] & 0x80) + cbtx[cbtx_size++] = 0; + cbtx[42] = cbtx_size - 43; + cbtx[41] = cbtx_size - 42; /* scriptsig length */ + le32enc( (uint32_t *)( cbtx+cbtx_size ), 0xffffffff ); /* sequence */ + cbtx_size += 4; + cbtx[cbtx_size++] = segwit ? 2 : 1; /* out-counter */ + le32enc( (uint32_t *)( cbtx+cbtx_size) , (uint32_t)cbvalue ); /* value */ + le32enc( (uint32_t *)( cbtx+cbtx_size+4 ), cbvalue >> 32 ); + cbtx_size += 8; + cbtx[ cbtx_size++ ] = (uint8_t) pk_script_size; /* txout-script length */ + memcpy( cbtx+cbtx_size, pk_script, pk_script_size ); + cbtx_size += (int) pk_script_size; + + if ( segwit ) + { + unsigned char (*wtree)[32] = calloc(tx_count + 2, 32); + memset(cbtx+cbtx_size, 0, 8); /* value */ + cbtx_size += 8; + cbtx[cbtx_size++] = 38; /* txout-script length */ + cbtx[cbtx_size++] = 0x6a; /* txout-script */ + cbtx[cbtx_size++] = 0x24; + cbtx[cbtx_size++] = 0xaa; + cbtx[cbtx_size++] = 0x21; + cbtx[cbtx_size++] = 0xa9; + cbtx[cbtx_size++] = 0xed; + for ( i = 0; i < tx_count; i++ ) + { + const json_t *tx = json_array_get( txa, i ); + const json_t *hash = json_object_get(tx, "hash" ); + if ( !hash || !hex2bin( wtree[1+i], + json_string_value( hash ), 32 ) ) + { + applog(LOG_ERR, "JSON invalid transaction hash"); + free(wtree); + goto out; + } + memrev( wtree[1+i], 32 ); + } + n = tx_count + 1; + while ( n > 1 ) + { + if ( n % 2 ) + memcpy( wtree[n], wtree[n-1], 32 ); + n = ( n + 1 ) / 2; + for ( i = 0; i < n; i++ ) + sha256d( wtree[i], wtree[2*i], 64 ); + } + memset( wtree[1], 0, 32 ); // witness reserved value = 0 + sha256d( cbtx+cbtx_size, wtree[0], 64 ); + cbtx_size += 32; + free( wtree ); + } + + le32enc( (uint32_t *)( cbtx+cbtx_size ), 0 ); /* lock time */ + cbtx_size += 4; + coinbase_append = true; + } + if ( coinbase_append ) + { + unsigned char xsig[100]; + int xsig_len = 0; + if ( *coinbase_sig ) + { + n = (int) strlen( coinbase_sig ); + if ( cbtx[41] + xsig_len + n <= 100 ) + { + memcpy( xsig+xsig_len, coinbase_sig, n ); + xsig_len += n; + } + else + applog( LOG_WARNING, + "Signature does not fit in coinbase, skipping" ); + } + tmp = json_object_get( val, "coinbaseaux" ); + if ( tmp && json_is_object( tmp ) ) + { + void *iter = json_object_iter( tmp ); + while ( iter ) + { + unsigned char buf[100]; + const char *s = json_string_value( json_object_iter_value( iter ) ); + n = s ? (int) ( strlen(s) / 2 ) : 0; + if ( !s || n > 100 || !hex2bin( buf, s, n ) ) + { + applog(LOG_ERR, "JSON invalid coinbaseaux"); + break; + } + if ( cbtx[41] + xsig_len + n <= 100 ) + { + memcpy( xsig+xsig_len, buf, n ); + xsig_len += n; + } + iter = json_object_iter_next( tmp, iter ); + } + } + if ( xsig_len ) + { + unsigned char *ssig_end = cbtx + 42 + cbtx[41]; + int push_len = cbtx[41] + xsig_len < 76 + ? 1 : cbtx[41] + 2 + xsig_len > 100 ? 0 : 2; + n = xsig_len + push_len; + memmove( ssig_end + n, ssig_end, cbtx_size - 42 - cbtx[41] ); + cbtx[41] += n; + if ( push_len == 2 ) + *(ssig_end++) = 0x4c; /* OP_PUSHDATA1 */ + if ( push_len ) + *(ssig_end++) = xsig_len; + memcpy( ssig_end, xsig, xsig_len ); + cbtx_size += n; + } + } + + n = varint_encode( txc_vi, 1 + tx_count ); + work->txs = (char*) malloc( 2 * ( n + cbtx_size + tx_size ) + 1 ); + bin2hex( work->txs, txc_vi, n ); + bin2hex( work->txs + 2*n, cbtx, cbtx_size ); + + /* generate merkle root */ + merkle_tree = (uchar(*)[32]) calloc( ( (1 + tx_count + 1) & ~1 ), 32 ); + sha256d( merkle_tree[0], cbtx, cbtx_size ); + for ( i = 0; i < tx_count; i++ ) + { + tmp = json_array_get( txa, i ); + const char *tx_hex = json_string_value( json_object_get( tmp, "data" ) ); + const int tx_size = tx_hex ? (int) ( strlen( tx_hex ) / 2 ) : 0; + + if ( segwit ) + { + const char *txid = json_string_value( json_object_get( tmp, "txid" ) ); + if ( !txid || !hex2bin( merkle_tree[1 + i], txid, 32 ) ) + { + applog(LOG_ERR, "JSON invalid transaction txid"); + goto out; + } + memrev( merkle_tree[1 + i], 32 ); + } + else + { + unsigned char *tx = (uchar*) malloc( tx_size ); + if ( !tx_hex || !hex2bin( tx, tx_hex, tx_size ) ) + { + applog( LOG_ERR, "JSON invalid transactions" ); + free( tx ); + goto out; + } + sha256d( merkle_tree[1 + i], tx, tx_size ); + free( tx ); + } + + if ( !submit_coinbase ) + strcat( work->txs, tx_hex ); + } + n = 1 + tx_count; + while ( n > 1 ) + { + if ( n % 2 ) + { + memcpy( merkle_tree[n], merkle_tree[n-1], 32 ); + ++n; + } + n /= 2; + for ( i = 0; i < n; i++ ) + sha256d( merkle_tree[i], merkle_tree[2*i], 64 ); + } + + work->tx_count = tx_count; + + /* assemble block header */ + algo_gate.build_block_header( work, version, + (uint32_t*) prevhash, (uint32_t*) merkle_tree, + curtime, bits, + final_sapling_hash ); + + if ( unlikely( !jobj_binary( val, "target", target, sizeof(target) ) ) ) + { + applog( LOG_ERR, "JSON invalid target" ); + goto out; + } + + for (int i = 0; i < 32; i++) { + ((uint8_t*)work->target)[i] = ((uint8_t*)target)[31 - i]; + } + net_diff = work->targetdiff = hash_to_diff(work->target); + + tmp = json_object_get( val, "workid" ); + if ( tmp ) + { + if ( !json_is_string( tmp ) ) + { + applog( LOG_ERR, "JSON invalid workid" ); + goto out; + } + work->workid = strdup( json_string_value( tmp ) ); + } + + rc = true; +out: + /* Long polling */ + tmp = json_object_get( val, "longpollid" ); + if ( want_longpoll && json_is_string( tmp ) ) + { + free( lp_id ); + lp_id = strdup( json_string_value( tmp ) ); + if ( !have_longpoll ) + { + char *lp_uri; + tmp = json_object_get( val, "longpolluri" ); + lp_uri = json_is_string( tmp ) ? strdup( json_string_value( tmp ) ) + : rpc_url; + have_longpoll = true; + tq_push(thr_info[longpoll_thr_id].q, lp_uri); + } + } + + free( merkle_tree ); + free( cbtx ); + return rc; +} + +// returns the unit prefix and the hashrate appropriately scaled. +void scale_hash_for_display ( double* hashrate, char* prefix ) +{ + if ( *hashrate < 1e4 ) *prefix = 0; + else if ( *hashrate < 1e7 ) { *prefix = 'k'; *hashrate /= 1e3; } + else if ( *hashrate < 1e10 ) { *prefix = 'M'; *hashrate /= 1e6; } + else if ( *hashrate < 1e13 ) { *prefix = 'G'; *hashrate /= 1e9; } + else if ( *hashrate < 1e16 ) { *prefix = 'T'; *hashrate /= 1e12; } + else if ( *hashrate < 1e19 ) { *prefix = 'P'; *hashrate /= 1e15; } + else if ( *hashrate < 1e22 ) { *prefix = 'E'; *hashrate /= 1e18; } + else if ( *hashrate < 1e25 ) { *prefix = 'Z'; *hashrate /= 1e21; } + else { *prefix = 'Y'; *hashrate /= 1e24; } +} + +static inline void sprintf_et( char *str, long unsigned int seconds ) +{ + long unsigned int min = seconds / 60; + long unsigned int sec = seconds % 60; + long unsigned int hrs = min / 60; + + if ( unlikely( hrs ) ) + { + long unsigned int days = hrs / 24; + long unsigned int years = days / 365; + if ( years ) // 0y000d + sprintf( str, "%luy%lud", years, years % 365 ); + else if ( days ) // 0d00h + sprintf( str, "%lud%02luh", days, hrs % 24 ); + else // 0h00m + sprintf( str, "%luh%02lum", hrs, min % 60 ); + } + else // 0m00s + sprintf( str, "%lum%02lus", min, sec ); +} + +const long double exp32 = EXP32; // 2**32 +const long double exp48 = EXP32 * EXP16; // 2**48 +const long double exp64 = EXP32 * EXP32; // 2**64 +const long double exp96 = EXP32 * EXP32 * EXP32; // 2**96 +const long double exp128 = EXP32 * EXP32 * EXP32 * EXP32; // 2**128 +const long double exp160 = EXP32 * EXP32 * EXP32 * EXP32 * EXP16; // 2**160 + +struct share_stats_t +{ + int share_count; + struct timeval submit_time; + double net_diff; + double share_diff; + double stratum_diff; + double target_diff; + uint32_t height; + char job_id[32]; +}; + +#define s_stats_size 8 +static struct share_stats_t share_stats[ s_stats_size ] = {{0}}; +static int s_get_ptr = 0, s_put_ptr = 0; +static struct timeval last_submit_time = {0}; + +static inline int stats_ptr_incr( int p ) +{ + return ++p % s_stats_size; +} + +void report_summary_log( bool force ) +{ + struct timeval now, et, uptime, start_time; + + if ( rejected_share_count > 10 ) + { + if ( rejected_share_count > ( submitted_share_count / 2 ) ) + { + applog(LOG_ERR,"Excessive rejected share rate, exiting..."); + exit(1); + } + else if ( rejected_share_count > ( submitted_share_count / 10 ) ) + applog(LOG_WARNING,"High rejected share rate, check settings."); + } + + gettimeofday( &now, NULL ); + timeval_subtract( &et, &now, &five_min_start ); + +#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32) || defined(__APPLE__)) + + // Display CPU temperature and clock rate. + int curr_temp = cpu_temp(0); + static struct timeval cpu_temp_time = {0}; + struct timeval diff; + + if ( !opt_quiet || ( curr_temp >= 80 ) ) + { + int wait_time = curr_temp >= 90 ? 5 + : curr_temp >= 80 ? 30 + : curr_temp >= 70 ? 60 : 120; + timeval_subtract( &diff, &now, &cpu_temp_time ); + if ( ( diff.tv_sec > wait_time ) + || ( ( curr_temp > prev_temp ) && ( curr_temp >= 75 ) ) ) + { + char tempstr[32]; + float lo_freq = 0., hi_freq = 0.; + + memcpy( &cpu_temp_time, &now, sizeof(cpu_temp_time) ); + linux_cpu_hilo_freq( &lo_freq, &hi_freq ); + if ( use_colors && ( curr_temp >= 70 ) ) + { + if ( curr_temp >= 80 ) + sprintf( tempstr, "%s%d C%s", CL_RED, curr_temp, CL_WHT ); + else + sprintf( tempstr, "%s%d C%s", CL_YLW, curr_temp, CL_WHT ); + } + else + sprintf( tempstr, "%d C", curr_temp ); + + applog( LOG_NOTICE,"CPU temp: curr %s max %d, Freq: %.3f/%.3f GHz", + tempstr, hi_temp, lo_freq / 1e6, hi_freq / 1e6 ); + if ( curr_temp > hi_temp ) hi_temp = curr_temp; + if ( ( opt_max_temp > 0.0 ) && ( curr_temp > opt_max_temp ) ) + restart_threads(); + prev_temp = curr_temp; + } + } + +#endif + + if ( !( force && ( submit_sum || ( et.tv_sec > 5 ) ) ) ) + { + if ( et.tv_sec < 300 ) + return; + if ( ( s_get_ptr != s_put_ptr ) && ( et.tv_sec < 360 ) ) + return; + } + +// if ( !( force && ( submit_sum || ( et.tv_sec > 5 ) ) ) +// && ( et.tv_sec < 300 ) ) +// return; + + // collect and reset periodic counters + pthread_mutex_lock( &stats_lock ); + + uint64_t submits = submit_sum; submit_sum = 0; + uint64_t accepts = accept_sum; accept_sum = 0; + uint64_t rejects = reject_sum; reject_sum = 0; + uint64_t stales = stale_sum; stale_sum = 0; + uint64_t solved = solved_sum; solved_sum = 0; + memcpy( &start_time, &five_min_start, sizeof start_time ); + memcpy( &five_min_start, &now, sizeof now ); + + pthread_mutex_unlock( &stats_lock ); + + timeval_subtract( &et, &now, &start_time ); + timeval_subtract( &uptime, &total_hashes_time, &session_start ); + + double share_time = (double)et.tv_sec + (double)et.tv_usec * 1e-6; + double ghrate = safe_div( total_hashes, (double)uptime.tv_sec, 0. ); + double target_diff = exp32 * last_targetdiff; + double shrate = safe_div( target_diff * (double)(accepts), + share_time, 0. ); + double sess_hrate = safe_div( exp32 * norm_diff_sum, + (double)uptime.tv_sec, 0. ); + double submit_rate = safe_div( (double)submits * 60., share_time, 0. ); + char shr_units[4] = {0}; + char ghr_units[4] = {0}; + char sess_hr_units[4] = {0}; + char et_str[24]; + char upt_str[24]; + + scale_hash_for_display( &shrate, shr_units ); + scale_hash_for_display( &ghrate, ghr_units ); + scale_hash_for_display( &sess_hrate, sess_hr_units ); + + sprintf_et( et_str, et.tv_sec ); + sprintf_et( upt_str, uptime.tv_sec ); + + applog( LOG_BLUE, "%s: %s", algo_names[ opt_algo ], rpc_url ); + applog2( LOG_NOTICE, "Periodic Report %s %s", et_str, upt_str ); + applog2( LOG_INFO, "Share rate %.2f/min %.2f/min", + submit_rate, safe_div( (double)submitted_share_count*60., + ( (double)uptime.tv_sec + (double)uptime.tv_usec * 1e-6 ), 0. ) ); + applog2( LOG_INFO, "Hash rate %7.2f%sh/s %7.2f%sh/s (%.2f%sh/s)", + shrate, shr_units, sess_hrate, sess_hr_units, ghrate, ghr_units ); + + if ( accepted_share_count < submitted_share_count ) + { + double lost_ghrate = safe_div( target_diff + * (double)(submitted_share_count - accepted_share_count ), + (double)uptime.tv_sec, 0. ); + double lost_shrate = safe_div( target_diff * (double)(submits - accepts ), share_time, 0. ); + char lshr_units[4] = {0}; + char lghr_units[4] = {0}; + scale_hash_for_display( &lost_shrate, lshr_units ); + scale_hash_for_display( &lost_ghrate, lghr_units ); + applog2( LOG_INFO, "Lost hash rate %7.2f%sh/s %7.2f%sh/s", + lost_shrate, lshr_units, lost_ghrate, lghr_units ); + } + + applog2( LOG_INFO,"Submitted %7d %7d", + submits, submitted_share_count ); + applog2( LOG_INFO, "Accepted %7d %7d %5.1f%%", + accepts, accepted_share_count, + 100. * safe_div( (double)accepted_share_count, + (double)submitted_share_count, 0. ) ); + if ( stale_share_count ) + { + int prio = stales ? LOG_MINR : LOG_INFO; + applog2( prio, "Stale %7d %7d %5.1f%%", + stales, stale_share_count, + 100. * safe_div( (double)stale_share_count, + (double)submitted_share_count, 0. ) ); + } + if ( rejected_share_count ) + { + int prio = rejects ? LOG_ERR : LOG_INFO; + applog2( prio, "Rejected %7d %7d %5.1f%%", + rejects, rejected_share_count, + 100. * safe_div( (double)rejected_share_count, + (double)submitted_share_count, 0. ) ); + } + if ( solved_block_count ) + { + int prio = solved ? LOG_PINK : LOG_INFO; + applog2( prio, "Blocks Solved %7d %7d", + solved, solved_block_count ); + } + if ( stratum_errors ) + applog2( LOG_INFO, "Stratum resets %7d", stratum_errors ); + + applog2( LOG_INFO, "Hi/Lo Share Diff %.5g / %.5g", + highest_share, lowest_share ); + + int mismatch = submitted_share_count + - ( accepted_share_count + stale_share_count + rejected_share_count ); + + if ( mismatch ) + { + if ( stratum_errors ) + applog2( LOG_MINR, "Count mismatch: %d, stats may be inaccurate", + mismatch ); + else if ( !opt_quiet ) + applog2( LOG_INFO, CL_LBL + "Count mismatch, submitted share may still be pending" CL_N ); + } +} + +static int share_result( int result, struct work *work, + const char *reason ) +{ + double share_time = 0.; + double hashrate = 0.; + int latency = 0; + struct share_stats_t my_stats = {0}; + struct timeval ack_time, latency_tv, et; + char ares[48]; + char sres[48]; + char rres[48]; + char bres[48]; + bool solved = false; + bool stale = false; + char *acol, *bcol, *scol, *rcol; + acol = bcol = scol = rcol = "\0"; + + pthread_mutex_lock( &stats_lock ); + + if ( likely( share_stats[ s_get_ptr ].submit_time.tv_sec ) ) + { + memcpy( &my_stats, &share_stats[ s_get_ptr], sizeof my_stats ); + memset( &share_stats[ s_get_ptr ], 0, sizeof my_stats ); + s_get_ptr = stats_ptr_incr( s_get_ptr ); + pthread_mutex_unlock( &stats_lock ); + } + else + { + // empty queue, it must have overflowed and stats were lost for a share. + pthread_mutex_unlock( &stats_lock ); + applog(LOG_WARNING,"Share stats not available."); + } + + // calculate latency and share time. + if likely( my_stats.submit_time.tv_sec ) + { + gettimeofday( &ack_time, NULL ); + timeval_subtract( &latency_tv, &ack_time, &my_stats.submit_time ); + latency = ( latency_tv.tv_sec * 1e3 + latency_tv.tv_usec / 1e3 ); + timeval_subtract( &et, &my_stats.submit_time, &last_submit_time ); + share_time = (double)et.tv_sec + ( (double)et.tv_usec / 1e6 ); + memcpy( &last_submit_time, &my_stats.submit_time, + sizeof last_submit_time ); + } + + // check result + if ( likely( result ) ) + { + accepted_share_count++; + if ( ( my_stats.share_diff > 0. ) + && ( my_stats.share_diff < lowest_share ) ) + lowest_share = my_stats.share_diff; + if ( my_stats.share_diff > highest_share ) + highest_share = my_stats.share_diff; + sprintf( sres, "S%d", stale_share_count ); + sprintf( rres, "R%d", rejected_share_count ); + if unlikely( ( my_stats.net_diff > 0. ) + && ( my_stats.share_diff >= my_stats.net_diff ) ) + { + solved = true; + solved_block_count++; + sprintf( bres, "BLOCK SOLVED %d", solved_block_count ); + sprintf( ares, "A%d", accepted_share_count ); + } + else + { + sprintf( bres, "B%d", solved_block_count ); + sprintf( ares, "Accepted %d", accepted_share_count ); + } + } + else + { + sprintf( ares, "A%d", accepted_share_count ); + sprintf( bres, "B%d", solved_block_count ); + if ( reason ) + stale = strstr( reason, "job" ); + else if ( work ) + stale = work->data[ algo_gate.ntime_index ] + != g_work.data[ algo_gate.ntime_index ]; + if ( stale ) + { + stale_share_count++; + sprintf( sres, "Stale %d", stale_share_count ); + sprintf( rres, "R%d", rejected_share_count ); + } + else + { + rejected_share_count++; + sprintf( sres, "S%d", stale_share_count ); + sprintf( rres, "Rejected %d" , rejected_share_count ); + } + } + + // update global counters for summary report + pthread_mutex_lock( &stats_lock ); + + for ( int i = 0; i < opt_n_threads; i++ ) + hashrate += thr_hashrates[i]; + global_hashrate = hashrate; + + if ( likely( result ) ) + { + accept_sum++; + norm_diff_sum += my_stats.target_diff; + if ( solved ) solved_sum++; + } + else + { + if ( stale ) stale_sum++; + else reject_sum++; + } + submit_sum++; + + pthread_mutex_unlock( &stats_lock ); + + if ( use_colors ) + { + bcol = acol = scol = rcol = CL_N; + if ( likely( result ) ) + { + acol = CL_LGR; + if ( unlikely( solved ) ) bcol = CL_LMA; + } + else if ( stale ) scol = CL_YL2; + else rcol = CL_LRD; + } + + const char *bell = !result && opt_bell ? &ASCII_BELL : ""; + applog( LOG_INFO, "%s%d %s%s %s%s %s%s %s%s%s, %.3f sec (%dms)", + bell, my_stats.share_count, acol, ares, scol, sres, rcol, rres, + bcol, bres, use_colors ? CL_N : "", share_time, latency ); + if ( unlikely( !( opt_quiet || result || stale ) ) ) + { + applog2( LOG_INFO, "%sReject reason: %s", bell, reason ? reason : "" ); + applog2( LOG_INFO, "Share diff: %.5g, Target: %.5g", + my_stats.share_diff, my_stats.target_diff ); + } + return 1; +} + +static const char *json_submit_req = + "{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}"; + +void std_le_build_stratum_request( char *req, struct work *work ) +{ + unsigned char *xnonce2str; + uint32_t ntime, nonce; + char ntimestr[9], noncestr[9]; + le32enc( &ntime, work->data[ algo_gate.ntime_index ] ); + le32enc( &nonce, work->data[ algo_gate.nonce_index ] ); + bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); + bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); + xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); + snprintf( req, JSON_BUF_LEN, json_submit_req, rpc_user, work->job_id, + xnonce2str, ntimestr, noncestr ); + free( xnonce2str ); +} + +// le is default +void std_be_build_stratum_request( char *req, struct work *work ) +{ + unsigned char *xnonce2str; + uint32_t ntime, nonce; + char ntimestr[9], noncestr[9]; + be32enc( &ntime, work->data[ algo_gate.ntime_index ] ); + be32enc( &nonce, work->data[ algo_gate.nonce_index ] ); + bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); + bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); + xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); + snprintf( req, JSON_BUF_LEN, json_submit_req, rpc_user, work->job_id, + xnonce2str, ntimestr, noncestr ); + free( xnonce2str ); +} + +static const char *json_getwork_req = + "{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n"; + +bool std_le_submit_getwork_result( CURL *curl, struct work *work ) +{ + char req[JSON_BUF_LEN]; + json_t *val, *res, *reason; + char* gw_str; + int data_size = algo_gate.get_work_data_size(); + + for ( int i = 0; i < data_size / sizeof(uint32_t); i++ ) + le32enc( &work->data[i], work->data[i] ); + gw_str = abin2hex( (uchar*)work->data, data_size ); + if ( unlikely( !gw_str ) ) + { + applog(LOG_ERR, "submit_upstream_work OOM"); + return false; + } + // build JSON-RPC request + snprintf( req, JSON_BUF_LEN, json_getwork_req, gw_str ); + free( gw_str ); + // issue JSON-RPC request + val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 ); + if ( unlikely(!val) ) + { + applog(LOG_ERR, "submit_upstream_work json_rpc_call failed"); + return false; + } + res = json_object_get( val, "result" ); + reason = json_object_get( val, "reject-reason" ); + share_result( json_is_true( res ), work, + reason ? json_string_value( reason ) : NULL ); + json_decref( val ); + return true; +} + +bool std_be_submit_getwork_result( CURL *curl, struct work *work ) +{ + char req[JSON_BUF_LEN]; + json_t *val, *res, *reason; + char* gw_str; + int data_size = algo_gate.get_work_data_size(); + + for ( int i = 0; i < data_size / sizeof(uint32_t); i++ ) + be32enc( &work->data[i], work->data[i] ); + gw_str = abin2hex( (uchar*)work->data, data_size ); + if ( unlikely( !gw_str ) ) + { + applog(LOG_ERR, "submit_upstream_work OOM"); + return false; + } + // build JSON-RPC request + snprintf( req, JSON_BUF_LEN, json_getwork_req, gw_str ); + free( gw_str ); + // issue JSON-RPC request + val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 ); + if ( unlikely(!val) ) + { + applog(LOG_ERR, "submit_upstream_work json_rpc_call failed"); + return false; + } + res = json_object_get( val, "result" ); + reason = json_object_get( val, "reject-reason" ); + share_result( json_is_true( res ), work, + reason ? json_string_value( reason ) : NULL ); + json_decref( val ); + return true; +} + +char* std_malloc_txs_request(struct work *work) +{ + char *req; + json_t *val; + char data_str[2 * sizeof(work->data) + 1]; + int i; + int datasize = work->sapling ? 112 : 80; + // この処理に変更する: + bin2hex(data_str, (unsigned char *)work->data, datasize); + + + if (work->workid) + { + char *params; + val = json_object(); + json_object_set_new(val, "workid", json_string(work->workid)); + params = json_dumps(val, 0); + json_decref(val); + req = (char *)malloc(128 + 2 * datasize + strlen(work->txs) + strlen(params)); + sprintf(req, + "{\"method\": \"submitblock\", \"params\": [\"%s%s\", %s], \"id\":4}\r\n", + data_str, work->txs, params); + free(params); + } + else + { + req = (char *)malloc(128 + 2 * datasize + strlen(work->txs)); + sprintf(req, + "{\"method\": \"submitblock\", \"params\": [\"%s%s\"], \"id\":4}\r\n", + data_str, work->txs); + } + + return req; +} + + +static bool submit_upstream_work( CURL *curl, struct work *work ) +{ + if ( have_stratum ) + { + char req[JSON_BUF_LEN]; + stratum.sharediff = work->sharediff; + algo_gate.build_stratum_request( req, work, &stratum ); + if ( unlikely( !stratum_send_line( &stratum, req ) ) ) + { + applog(LOG_ERR, "submit_upstream_work stratum_send_line failed"); + return false; + } + return true; + } + else if ( work->txs ) + { + char *req = NULL; + json_t *val, *res; + + req = algo_gate.malloc_txs_request( work ); + val = json_rpc_call( curl, rpc_url, rpc_userpass, req, NULL, 0 ); + free( req ); + + if ( unlikely( !val ) ) + { + applog( LOG_ERR, "submit_upstream_work json_rpc_call failed" ); + return false; + } + res = json_object_get( val, "result" ); + if ( json_is_object( res ) ) + { + char *res_str; + bool sumres = false; + void *iter = json_object_iter( res ); + while ( iter ) + { + if ( json_is_null( json_object_iter_value( iter ) ) ) + { + sumres = true; + break; + } + iter = json_object_iter_next( res, iter ); + } + res_str = json_dumps( res, 0 ); + share_result( sumres, work, res_str ); + free( res_str ); + } + else + share_result( json_is_null( res ), work, json_string_value( res ) ); + json_decref( val ); + return true; + } + else + return algo_gate.submit_getwork_result( curl, work ); +} + +const char *getwork_req = + "{\"method\": \"getwork\", \"params\": [], \"id\":0}\r\n"; + +#define GBT_CAPABILITIES "[\"coinbasetxn\", \"coinbasevalue\", \"longpoll\", \"workid\"]" + +#define GBT_RULES "[\"segwit\"]" +#define GBT_MWEB_RULES "[\"segwit\", \"mweb\"]" + +static const char *gbt_req = + "{\"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": " + GBT_CAPABILITIES ", \"rules\": " GBT_RULES "}], \"id\":0}\r\n"; +const char *gbt_lp_req = + "{\"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": " + GBT_CAPABILITIES ", \"rules\": " GBT_RULES ", \"longpollid\": \"%s\"}], \"id\":0}\r\n"; + +static const char *gbt_mweb_req = +"{\"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": " +GBT_CAPABILITIES ", \"rules\": " GBT_MWEB_RULES "}], \"id\":0}\r\n"; +const char *gbt_lp_mweb_req = +"{\"method\": \"getblocktemplate\", \"params\": [{\"capabilities\": " +GBT_CAPABILITIES ", \"rules\": " GBT_MWEB_RULES ", \"longpollid\": \"%s\"}], \"id\":0}\r\n"; + + +static bool get_upstream_work( CURL *curl, struct work *work ) +{ + json_t *val; + int err; + bool rc; + struct timeval tv_start, tv_end, diff; + +start: + gettimeofday( &tv_start, NULL ); + if ( opt_mweb ) + val = json_rpc_call( curl, rpc_url, rpc_userpass, + have_gbt ? gbt_mweb_req : getwork_req, &err, + have_gbt ? JSON_RPC_QUIET_404 : 0); + else + val = json_rpc_call( curl, rpc_url, rpc_userpass, + have_gbt ? gbt_req : getwork_req, &err, + have_gbt ? JSON_RPC_QUIET_404 : 0); + + gettimeofday( &tv_end, NULL ); + + if ( have_stratum ) + { + if ( val ) + json_decref(val); + + return true; + } + + if ( !have_gbt && !allow_getwork ) + { + applog( LOG_ERR, "No usable protocol" ); + if ( val ) + json_decref( val ); + return false; + } + + if ( have_gbt && allow_getwork && !val && err == CURLE_OK ) + { + applog( LOG_NOTICE, "getblocktemplate failed, falling back to getwork" ); + have_gbt = false; + goto start; + } + + if ( !val ) + return false; + + if ( have_gbt ) + { + rc = gbt_work_decode( json_object_get( val, "result" ), work ); + if ( !have_gbt ) + { + json_decref( val ); + goto start; + } + allow_getwork = false; // GBT is working, disable fallback + } + else + rc = work_decode( json_object_get( val, "result" ), work ); + + if ( rc ) + { + bool new_work = true; + + json_decref( val ); + + get_mininginfo( curl, work ); + report_summary_log( false ); + + if ( opt_protocol || opt_debug ) + { + timeval_subtract( &diff, &tv_end, &tv_start ); + applog( LOG_INFO, "%s new work received in %.2f ms", + ( have_gbt ? "GBT" : "GetWork" ), + ( 1000.0 * diff.tv_sec ) + ( 0.001 * diff.tv_usec ) ); + } + + if ( work->height > last_block_height ) + { + last_block_height = work->height; + last_targetdiff = net_diff; + + applog( LOG_BLUE, "New Block %d, Tx %d, Net Diff %.5g, Ntime %08x", + work->height, work->tx_count, net_diff, + bswap_32( work->data[ algo_gate.ntime_index ] ) ); + } + else if ( memcmp( work->data, g_work.data, algo_gate.work_cmp_size ) ) + applog( LOG_BLUE, "New Work: Block %d, Tx %d, Net Diff %.5g, Ntime %08x", + work->height, work->tx_count, net_diff, + bswap_32( work->data[ algo_gate.ntime_index ] ) ); + else + new_work = false; + + if ( new_work ) + { + if ( !opt_quiet ) + { + double miner_hr = 0.; + double net_hr = net_hashrate; + double nd = net_diff * exp32; + char net_hr_units[4] = {0}; + char miner_hr_units[4] = {0}; + char net_ttf[32]; + char miner_ttf[32]; + + pthread_mutex_lock( &stats_lock ); + + for ( int i = 0; i < opt_n_threads; i++ ) + miner_hr += thr_hashrates[i]; + global_hashrate = miner_hr; + + pthread_mutex_unlock( &stats_lock ); + + if ( net_hr > 0. ) + sprintf_et( net_ttf, nd / net_hr ); + else + sprintf( net_ttf, "NA" ); + if ( miner_hr > 0. ) + sprintf_et( miner_ttf, nd / miner_hr ); + else + sprintf( miner_ttf, "NA" ); + + scale_hash_for_display ( &miner_hr, miner_hr_units ); + scale_hash_for_display ( &net_hr, net_hr_units ); + applog2( LOG_INFO, + "Miner TTF @ %.2f %sh/s %s, Net TTF @ %.2f %sh/s %s", + miner_hr, miner_hr_units, miner_ttf, net_hr, + net_hr_units, net_ttf ); + } + restart_threads(); + } + } // rc + + return rc; +} + +static void workio_cmd_free(struct workio_cmd *wc) +{ + if (!wc) + return; + + switch (wc->cmd) { + case WC_SUBMIT_WORK: + work_free(wc->u.work); + free(wc->u.work); + break; + default: /* do nothing */ + break; + } + + memset(wc, 0, sizeof(*wc)); /* poison */ + free(wc); +} + +static bool workio_get_work( struct workio_cmd *wc, CURL *curl ) +{ + struct work *work_heap; + int failures = 0; + + work_heap = calloc( 1, sizeof(struct work) ); + if ( !work_heap ) return false; + + /* obtain new work from bitcoin via JSON-RPC */ + while ( !get_upstream_work( curl, work_heap ) ) + { + if ( unlikely( ( opt_retries >= 0 ) && ( ++failures > opt_retries ) ) ) + { + applog( LOG_ERR, "json_rpc_call failed, terminating workio thread" ); + free( work_heap ); + return false; + } + + /* pause, then restart work-request loop */ + applog( LOG_ERR, "json_rpc_call failed, retry after %d seconds", + opt_fail_pause ); + sleep( opt_fail_pause ); + } + + /* send work to requesting thread */ + if ( !tq_push(wc->thr->q, work_heap ) ) + free( work_heap ); + + return true; +} + + +static bool workio_submit_work(struct workio_cmd *wc, CURL *curl) +{ + int failures = 0; + + /* submit solution to bitcoin via JSON-RPC */ + while (!submit_upstream_work(curl, wc->u.work)) + { + if (unlikely((opt_retries >= 0) && (++failures > opt_retries))) + { + applog(LOG_ERR, "...terminating workio thread"); + return false; + } + /* pause, then restart work-request loop */ + if (!opt_benchmark) + applog(LOG_ERR, "...retry after %d seconds", opt_fail_pause); + sleep(opt_fail_pause); + } + return true; +} + +static void *workio_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info *) userdata; + CURL *curl; + bool ok = true; + + curl = curl_easy_init(); + if (unlikely( !curl ) ) + { + applog(LOG_ERR, "CURL initialization failed"); + return NULL; + } + + while ( likely(ok) ) + { + struct workio_cmd *wc; + + /* wait for workio_cmd sent to us, on our queue */ + wc = (struct workio_cmd *) tq_pop(mythr->q, NULL); + if (!wc) + { + ok = false; + break; + } + + /* process workio_cmd */ + switch (wc->cmd) + { + case WC_GET_WORK: + ok = workio_get_work(wc, curl); + break; + case WC_SUBMIT_WORK: + ok = workio_submit_work(wc, curl); + break; + + default: /* should never happen */ + ok = false; + break; + } + workio_cmd_free(wc); + } + + tq_freeze(mythr->q); + curl_easy_cleanup(curl); + return NULL; +} + +static bool get_work(struct thr_info *thr, struct work *work) +{ + struct workio_cmd *wc; + struct work *work_heap; + + if unlikely( opt_benchmark ) + { + uint32_t ts = (uint32_t) time(NULL); + + // why 74? std cmp_size is 76, std data is 128 + for ( int n = 0; n < 74; n++ ) ( (char*)work->data )[n] = n; + + work->data[algo_gate.ntime_index] = swab32(ts); // ntime + + // this overwrites much of the for loop init + memset( work->data + algo_gate.nonce_index, 0x00, 52); // nonce..nonce+52 + work->data[20] = 0x80000000; + work->data[31] = 0x00000280; + return true; + } + /* fill out work request message */ + wc = (struct workio_cmd *) calloc(1, sizeof(*wc)); + if (!wc) + return false; + wc->cmd = WC_GET_WORK; + wc->thr = thr; + /* send work request to workio thread */ + if (!tq_push(thr_info[work_thr_id].q, wc)) + { + workio_cmd_free(wc); + return false; + } + /* wait for response, a unit of work */ + work_heap = (struct work*) tq_pop(thr->q, NULL); + if ( !work_heap ) return false; + /* copy returned work into storage provided by caller */ + memcpy( work, work_heap, sizeof(*work) ); + free( work_heap ); + return true; +} + +static bool submit_work( struct thr_info *thr, const struct work *work_in ) +{ + struct workio_cmd *wc; + + /* fill out work request message */ + wc = (struct workio_cmd *) calloc(1, sizeof(*wc)); + if (!wc) + return false; + wc->u.work = (struct work*) malloc(sizeof(*work_in)); + if (!wc->u.work) + goto err_out; + wc->cmd = WC_SUBMIT_WORK; + wc->thr = thr; + work_copy(wc->u.work, work_in); + + /* send solution to workio thread */ + if (!tq_push(thr_info[work_thr_id].q, wc)) + goto err_out; + return true; +err_out: + workio_cmd_free(wc); + return false; +} + +static void update_submit_stats( struct work *work, const void *hash ) +{ + pthread_mutex_lock( &stats_lock ); + + submitted_share_count++; + share_stats[ s_put_ptr ].share_count = submitted_share_count; + gettimeofday( &share_stats[ s_put_ptr ].submit_time, NULL ); + share_stats[ s_put_ptr ].share_diff = work->sharediff; + share_stats[ s_put_ptr ].net_diff = net_diff; + share_stats[ s_put_ptr ].stratum_diff = stratum_diff; + share_stats[ s_put_ptr ].target_diff = work->targetdiff; + share_stats[ s_put_ptr ].height = work->height; + if ( have_stratum ) + strncpy( share_stats[ s_put_ptr ].job_id, work->job_id, 30 ); + s_put_ptr = stats_ptr_incr( s_put_ptr ); + + pthread_mutex_unlock( &stats_lock ); +} + +bool submit_solution( struct work *work, const void *hash, + struct thr_info *thr ) +{ +// Job went stale during hashing of a valid share. +// if ( !opt_quiet && work_restart[ thr->id ].restart ) +// applog( LOG_INFO, CL_LBL "Share may be stale, submitting anyway..." CL_N ); + + work->sharediff = hash_to_diff( hash ); + if ( likely( submit_work( thr, work ) ) ) + { + update_submit_stats( work, hash ); + + if unlikely( !have_stratum && !have_longpoll ) + { // solo, block solved, force getwork + pthread_rwlock_wrlock( &g_work_lock ); + g_work_time = 0; + pthread_rwlock_unlock( &g_work_lock ); + restart_threads(); + } + + if ( !opt_quiet ) + { + if ( have_stratum ) + { + applog( LOG_INFO, "%d Submitted Diff %.5g, Block %d, Job %s", + submitted_share_count, work->sharediff, work->height, + work->job_id ); + if ( opt_debug && opt_extranonce ) + { + unsigned char *xnonce2str = abin2hex( work->xnonce2, + work->xnonce2_len ); + applog( LOG_INFO, "Xnonce2 %s", xnonce2str ); + free( xnonce2str ); + } + } + else + applog( LOG_INFO, "%d Submitted Diff %.5g, Block %d, Ntime %08x", + submitted_share_count, work->sharediff, work->height, + work->data[ algo_gate.ntime_index ] ); + + if ( opt_debug ) + { + uint32_t* h = (uint32_t*)hash; + uint32_t* t = (uint32_t*)work->target; + uint32_t* d = (uint32_t*)work->data; + + applog( LOG_INFO, "Data[ 0: 9]: %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x", + d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9] ); + applog( LOG_INFO, "Data[10:19]: %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x", + d[10],d[11],d[12],d[13],d[14],d[15],d[16],d[17],d[18],d[19] ); + applog( LOG_INFO, "Hash[ 7: 0]: %08x %08x %08x %08x %08x %08x %08x %08x", + h[7],h[6],h[5],h[4],h[3],h[2],h[1],h[0] ); + applog( LOG_INFO, "Targ[ 7: 0]: %08x %08x %08x %08x %08x %08x %08x %08x", + t[7],t[6],t[5],t[4],t[3],t[2],t[1],t[0] ); + } + } + return true; + } + else + applog( LOG_WARNING, "%d failed to submit share", submitted_share_count ); + return false; +} + +static bool wanna_mine(int thr_id) +{ + bool state = true; + +#if !(defined(__WINDOWS__) || defined(_WIN64) || defined(_WIN32) || defined(__APPLE__)) + + if (opt_max_temp > 0.0) + { + float temp = cpu_temp(0); + if (temp > opt_max_temp) + { + if ( !thr_id && !conditional_state[thr_id] && !opt_quiet ) + applog(LOG_NOTICE, "CPU temp too high: %.0fC max %.0f, waiting...", temp, opt_max_temp ); + state = false; + } + if ( temp > hi_temp ) hi_temp = temp; + } + +#endif + + if (opt_max_diff > 0.0 && net_diff > opt_max_diff) + { + if (!thr_id && !conditional_state[thr_id] && !opt_quiet) + applog(LOG_NOTICE, "network diff too high, waiting..."); + state = false; + } + if (opt_max_rate > 0.0 && net_hashrate > opt_max_rate) + { + if (!thr_id && !conditional_state[thr_id] && !opt_quiet) + { + char rate[32]; + format_hashrate(opt_max_rate, rate); + applog(LOG_NOTICE, "network hashrate too high (%s), waiting...", rate); + } + state = false; + } + + if ( conditional_state[thr_id] && state && !thr_id && !opt_quiet ) + applog(LOG_NOTICE, "...resuming" ); + conditional_state[thr_id] = (uint8_t) !state; + return state; +} + +// Common target functions, default usually listed first. + +// default, double sha256 for root hash +void sha256d_gen_merkle_root( char* merkle_root, struct stratum_ctx* sctx ) +{ + sha256d( merkle_root, sctx->job.coinbase, (int) sctx->job.coinbase_size ); + for ( int i = 0; i < sctx->job.merkle_count; i++ ) + { + memcpy( merkle_root + 32, sctx->job.merkle[i], 32 ); + sha256d( merkle_root, merkle_root, 64 ); + } +} +// single sha256 root hash +void sha256_gen_merkle_root( char* merkle_root, struct stratum_ctx* sctx ) +{ + sha256_full( merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size ); + for ( int i = 0; i < sctx->job.merkle_count; i++ ) + { + memcpy( merkle_root + 32, sctx->job.merkle[i], 32 ); + sha256d( merkle_root, merkle_root, 64 ); + } +} + +// Default is do_nothing (assumed LE) +void set_work_data_big_endian( struct work *work ) +{ + int nonce_index = algo_gate.nonce_index; + for ( int i = 0; i < nonce_index; i++ ) + be32enc( work->data + i, work->data[i] ); +} + +void std_get_new_work( struct work* work, struct work* g_work, int thr_id, + uint32_t *end_nonce_ptr ) +{ + uint32_t *nonceptr = work->data + algo_gate.nonce_index; + bool force_new_work = false; + + if ( have_stratum ) + force_new_work = work->job_id ? strtoul( work->job_id, NULL, 16 ) + != strtoul( g_work->job_id, NULL, 16 ) + : false; + + if ( force_new_work || ( *nonceptr >= *end_nonce_ptr ) + || memcmp( work->data, g_work->data, algo_gate.work_cmp_size ) ) + { + work_free( work ); + work_copy( work, g_work ); + *nonceptr = 0xffffffffU / opt_n_threads * thr_id; + *end_nonce_ptr = ( 0xffffffffU / opt_n_threads ) * (thr_id+1) - 0x20; + } + else + ++(*nonceptr); +} + +static void stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work ) +{ + bool new_job; + + pthread_rwlock_wrlock( &g_work_lock ); + pthread_mutex_lock( &sctx->work_lock ); + + new_job = sctx->new_job; // otherwise just increment extranonce2 + sctx->new_job = false; + + free( g_work->job_id ); + g_work->job_id = strdup( sctx->job.job_id ); + g_work->xnonce2_len = sctx->xnonce2_size; + g_work->xnonce2 = (uchar*) realloc( g_work->xnonce2, sctx->xnonce2_size ); + memcpy( g_work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size ); + algo_gate.build_extraheader( g_work, sctx ); + net_diff = nbits_to_diff( g_work->data[ algo_gate.nbits_index ] ); + algo_gate.set_work_data_endian( g_work ); + g_work->height = sctx->block_height; + g_work->targetdiff = sctx->job.diff + / ( opt_target_factor * opt_diff_factor ); + diff_to_hash( g_work->target, g_work->targetdiff ); + + // Pre increment extranonce2 in case of being called again before receiving + // a new job + for ( int t = 0; + t < sctx->xnonce2_size && !( ++sctx->job.xnonce2[t] ); + t++ ); + + g_work_time = time(NULL); + restart_threads(); + + pthread_mutex_unlock( &sctx->work_lock ); + pthread_rwlock_unlock( &g_work_lock ); + + pthread_mutex_lock( &stats_lock ); + + double hr = 0.; + for ( int i = 0; i < opt_n_threads; i++ ) + hr += thr_hashrates[i]; + global_hashrate = hr; + + pthread_mutex_unlock( &stats_lock ); + + if ( stratum_diff != sctx->job.diff ) + applog( LOG_BLUE, "New Stratum Diff %g, Block %d, Tx %d, Job %s", + sctx->job.diff, sctx->block_height, + sctx->job.merkle_count, g_work->job_id ); + else if ( last_block_height != sctx->block_height ) + applog( LOG_BLUE, "New Block %d, Tx %d, Netdiff %.5g, Job %s", + sctx->block_height, sctx->job.merkle_count, + net_diff, g_work->job_id ); + else if ( g_work->job_id && new_job ) + applog( LOG_BLUE, "New Work: Block %d, Tx %d, Netdiff %.5g, Job %s", + sctx->block_height, sctx->job.merkle_count, + net_diff, g_work->job_id ); + else if ( opt_debug ) + { + unsigned char *xnonce2str = bebin2hex( g_work->xnonce2, + g_work->xnonce2_len ); + applog( LOG_INFO, "Extranonce2 0x%s, Block %d, Job %s", + xnonce2str, sctx->block_height, g_work->job_id ); + free( xnonce2str ); + } + + // Update data and calculate new estimates. + if ( ( stratum_diff != sctx->job.diff ) + || ( last_block_height != sctx->block_height ) ) + { + if ( unlikely( !session_first_block ) ) + session_first_block = stratum.block_height; + last_block_height = stratum.block_height; + stratum_diff = sctx->job.diff; + last_targetdiff = g_work->targetdiff; + if ( lowest_share < last_targetdiff ) + lowest_share = 9e99; + } + + if ( new_job && !opt_quiet ) + { + applog2( LOG_INFO, "Diff: Net %.5g, Stratum %.5g, Target %.5g", + net_diff, stratum_diff, g_work->targetdiff ); + + if ( likely( hr > 0. ) ) + { + double nd = net_diff * exp32; + char hr_units[4] = {0}; + char block_ttf[32]; + char share_ttf[32]; + static bool multipool = false; + + if ( stratum.block_height < last_block_height ) multipool = true; + + sprintf_et( block_ttf, nd / hr ); + sprintf_et( share_ttf, ( g_work->targetdiff * exp32 ) / hr ); + scale_hash_for_display ( &hr, hr_units ); + applog2( LOG_INFO, "TTF @ %.2f %sh/s: Block %s, Share %s", + hr, hr_units, block_ttf, share_ttf ); + + if ( !multipool && last_block_height > session_first_block ) + { + struct timeval now, et; + gettimeofday( &now, NULL ); + timeval_subtract( &et, &now, &session_start ); + uint64_t net_ttf = safe_div( et.tv_sec, + last_block_height - session_first_block, 0 ); + if ( net_diff > 0. && net_ttf ) + { + double net_hr = safe_div( nd, net_ttf, 0. ); + char net_hr_units[4] = {0}; + scale_hash_for_display ( &net_hr, net_hr_units ); + applog2( LOG_INFO, "Net hash rate (est) %.2f %sh/s", + net_hr, net_hr_units ); + } + } + } // hr > 0 + } // !quiet +} + +static void *miner_thread( void *userdata ) +{ + struct work work __attribute__ ((aligned (64))) ; + struct thr_info *mythr = (struct thr_info *) userdata; + int thr_id = mythr->id; + uint32_t max_nonce; + uint32_t *nonceptr = work.data + algo_gate.nonce_index; + + // end_nonce gets read before being set so it needs to be initialized + // what is an appropriate value that is completely neutral? + // zero seems to work. No, it breaks benchmark. +// uint32_t end_nonce = 0; +// uint32_t end_nonce = opt_benchmark +// ? ( 0xffffffffU / opt_n_threads ) * (thr_id + 1) - 0x20 +// : 0; + uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - opt_n_threads; + + memset( &work, 0, sizeof(work) ); + + /* Set worker threads to nice 19 and then preferentially to SCHED_IDLE + * and if that fails, then SCHED_BATCH. No need for this to be an + * error if it fails */ + if ( !opt_priority ) + { + setpriority(PRIO_PROCESS, 0, 19); + if ( !thr_id && opt_debug ) + applog(LOG_INFO, "Default miner thread priority %d (nice 19)", opt_priority ); + drop_policy(); + } + else + { + int prio = 0; +#ifndef WIN32 + prio = 18; + // note: different behavior on linux (-19 to 19) + switch ( opt_priority ) + { + case 1: prio = 5; break; + case 2: prio = 0; break; + case 3: prio = -5; break; + case 4: prio = -10; break; + case 5: prio = -15; + } + if ( !thr_id ) + { + applog( LOG_INFO, "User set miner thread priority %d (nice %d)", + opt_priority, prio ); + applog( LOG_WARNING, "High priority mining threads may cause system instability"); + } +#endif + setpriority(PRIO_PROCESS, 0, prio); + if ( opt_priority == 0 ) + drop_policy(); + } + + // CPU thread affinity + if ( opt_affinity && num_cpus > 1 ) affine_to_cpu( mythr ); + + if ( !algo_gate.miner_thread_init( thr_id ) ) + { + applog( LOG_ERR, "FAIL: thread %d failed to initialize", thr_id ); + exit (1); + } + + // wait for stratum to send first job + if ( have_stratum ) while ( unlikely( stratum_down ) ) + { + if ( opt_debug ) + applog( LOG_INFO, "Thread %d waiting for first job", thr_id ); + sleep(1); + } + + // nominal startng values + int64_t max64 = 20; + thr_hashrates[thr_id] = 20; + while (1) + { + uint64_t hashes_done; + struct timeval tv_start, tv_end, diff; +// int64_t max64 = 1000; + int nonce_found = 0; + + if ( have_stratum ) + { + while ( unlikely( stratum_down ) ) + sleep( 1 ); + if ( unlikely( ( *nonceptr >= end_nonce ) + && !work_restart[thr_id].restart ) ) + { + if ( opt_extranonce ) + stratum_gen_work( &stratum, &g_work ); + else + { + if ( !thr_id ) + { + applog( LOG_WARNING, "Nonce range exhausted, extranonce not subscribed." ); + applog( LOG_WARNING, "Waiting for new work..."); + } + while ( !work_restart[thr_id].restart ) + sleep ( 1 ); + } + } + } + else if ( !opt_benchmark ) // GBT or getwork + { + // max64 is used to set end_nonce to match the scantime. + // It also factors the nonce range to end the scan when nonces are + // exhausted. In either case needing new work can be assumed. + // Only problem is every thread will call get_work. + // First thread resets scantime blocking all subsequent threads + // from fetching new work. + + pthread_rwlock_wrlock( &g_work_lock ); + const time_t now = time(NULL); + if ( ( ( now - g_work_time ) >= opt_scantime ) + || ( *nonceptr >= end_nonce ) ) + { + if ( unlikely( !get_work( mythr, &g_work ) ) ) + { + pthread_rwlock_unlock( &g_work_lock ); + applog( LOG_ERR, "work retrieval failed, exiting miner thread %d", thr_id ); + goto out; + } + g_work_time = now; + } + pthread_rwlock_unlock( &g_work_lock ); + } + + pthread_rwlock_rdlock( &g_work_lock ); + + algo_gate.get_new_work( &work, &g_work, thr_id, &end_nonce ); + work_restart[thr_id].restart = 0; + + pthread_rwlock_unlock( &g_work_lock ); + + // conditional mining + if ( unlikely( !wanna_mine( thr_id ) ) ) + { + restart_threads(); + sleep(5); + continue; + } + + // opt_scantime expressed in hashes + max64 = opt_scantime * thr_hashrates[thr_id]; + + // time limit + if ( unlikely( opt_time_limit ) ) + { + unsigned int now = (unsigned int)time(NULL); + if ( now >= time_limit_stop ) + { + if ( thr_id != 0 ) + { + sleep(1); + continue; + } + if (opt_benchmark) + { + char rate[32]; + format_hashrate( global_hashrate, rate ); + applog( LOG_NOTICE, "Benchmark: %s", rate ); + } + else + applog( LOG_NOTICE, "Mining timeout of %ds reached, exiting...", + opt_time_limit); + + proper_exit(0); + } + // else + if ( time_limit_stop - now < opt_scantime ) + max64 = ( time_limit_stop - now ) * thr_hashrates[thr_id] ; + } + + // Select nonce range based on max64, the estimated number of hashes + // to meet the desired scan time. + // Initial value arbitrarilly set to 1000 just to get + // a sample hashrate for the next time. + uint32_t work_nonce = *nonceptr; + if ( max64 <= 0) + max64 = 1000; + if ( work_nonce + max64 > end_nonce ) + max_nonce = end_nonce; + else + max_nonce = work_nonce + (uint32_t)max64; + + // init time + hashes_done = 0; + gettimeofday( (struct timeval *) &tv_start, NULL ); + + // Scan for nonce + nonce_found = algo_gate.scanhash( &work, max_nonce, &hashes_done, + mythr ); + + // record scanhash elapsed time + gettimeofday( &tv_end, NULL ); + timeval_subtract( &diff, &tv_end, &tv_start ); + if ( diff.tv_usec || diff.tv_sec ) + { + pthread_mutex_lock( &stats_lock ); + total_hashes += hashes_done; + total_hashes_time = tv_end; + thr_hashrates[thr_id] = + hashes_done / ( diff.tv_sec + diff.tv_usec * 1e-6 ); + pthread_mutex_unlock( &stats_lock ); + } + + // This code is deprecated, scanhash should never return true. + // This remains as a backup in case some old implementations still exist. + // If unsubmiited nonce(s) found, submit now. + if ( unlikely( nonce_found && !opt_benchmark ) ) + { + applog( LOG_WARNING, "BUG: See RELEASE_NOTES for reporting bugs. Algo = %s.", + algo_names[ opt_algo ] ); + if ( !submit_work( mythr, &work ) ) + { + applog( LOG_WARNING, "Failed to submit share." ); + break; + } + if ( !opt_quiet ) + applog( LOG_NOTICE, "%d: submitted by thread %d.", + accepted_share_count + rejected_share_count + 1, + mythr->id ); + + // prevent stale work in solo + // we can't submit twice a block! + if unlikely( !have_stratum && !have_longpoll ) + { + pthread_rwlock_wrlock( &g_work_lock ); + // will force getwork + g_work_time = 0; + pthread_rwlock_unlock( &g_work_lock ); + } + } + + // display hashrate + if ( unlikely( opt_hash_meter ) ) + { + char hr[16]; + char hr_units[2] = {0,0}; + double hashrate; + + hashrate = thr_hashrates[thr_id]; + if ( hashrate != 0. ) + { + scale_hash_for_display( &hashrate, hr_units ); + sprintf( hr, "%.2f", hashrate ); + applog( LOG_INFO, "Thread %d, CPU %d: %s %sh/s", + thr_id, thread_affinity_map[ thr_id ], hr, hr_units ); + } + } + + // Display benchmark total + // Update hashrate for API if no shares accepted yet. + if ( unlikely( ( opt_benchmark || !accepted_share_count ) + && thr_id == opt_n_threads - 1 ) ) + { + double hashrate = 0.; + pthread_mutex_lock( &stats_lock ); + for ( int i = 0; i < opt_n_threads; i++ ) + hashrate += thr_hashrates[i]; + global_hashrate = hashrate; + pthread_mutex_unlock( &stats_lock ); + + if ( opt_benchmark ) + { + struct timeval uptime; + char hr[16]; + char hr_units[2] = {0,0}; + timeval_subtract( &uptime, &total_hashes_time, &session_start ); + double hashrate = safe_div( total_hashes, uptime.tv_sec, 0. ); + + if ( hashrate > 0. ) + { + scale_hash_for_display( &hashrate, hr_units ); + sprintf( hr, "%.2f", hashrate ); +#if (defined(_WIN64) || defined(__WINDOWS__) || defined(_WIN32) || defined(__APPLE__)) + applog( LOG_NOTICE, "Total: %s %sH/s", hr, hr_units ); +#else + float lo_freq = 0., hi_freq = 0.; + linux_cpu_hilo_freq( &lo_freq, &hi_freq ); + applog( LOG_NOTICE, + "Total: %s %sH/s, Temp: %dC, Freq: %.3f/%.3f GHz", + hr, hr_units, (uint32_t)cpu_temp(0), lo_freq / 1e6, + hi_freq / 1e6 ); +#endif + } + } + } // benchmark + } // miner_thread loop + +out: + tq_freeze(mythr->q); + return NULL; +} + +void restart_threads(void) +{ + for ( int i = 0; i < opt_n_threads; i++) + work_restart[i].restart = 1; + if ( opt_debug ) + applog( LOG_INFO, "Threads restarted for new work."); +} + +json_t *std_longpoll_rpc_call( CURL *curl, int *err, char* lp_url ) +{ + json_t *val; + char *req = NULL; + if (have_gbt) + { + if (opt_mweb) { + req = (char*) malloc( strlen(gbt_lp_mweb_req) + strlen(lp_id) + 1 ); + sprintf( req, gbt_lp_mweb_req, lp_id ); + } + else + { + req = (char*) malloc( strlen(gbt_lp_req) + strlen(lp_id) + 1 ); + sprintf( req, gbt_lp_req, lp_id ); + } + } + val = json_rpc_call( curl, rpc_url, rpc_userpass, getwork_req, err, + JSON_RPC_LONGPOLL ); + val = json_rpc_call( curl, lp_url, rpc_userpass, req ? req : getwork_req, + err, JSON_RPC_LONGPOLL); + free(req); + return val; +} + +static void *longpoll_thread(void *userdata) +{ + struct thr_info *mythr = (struct thr_info*) userdata; + CURL *curl = NULL; + char *copy_start, *hdr_path = NULL, *lp_url = NULL; + bool need_slash = false; + + curl = curl_easy_init(); + if (unlikely(!curl)) + { + applog(LOG_ERR, "CURL init failed"); + goto out; + } + +start: + hdr_path = (char*) tq_pop(mythr->q, NULL); + if (!hdr_path) + goto out; + + /* full URL */ + if (strstr(hdr_path, "://")) + { + lp_url = hdr_path; + hdr_path = NULL; + } + else + /* absolute path, on current server */ + { + copy_start = (*hdr_path == '/') ? (hdr_path + 1) : hdr_path; + if (rpc_url[strlen(rpc_url) - 1] != '/') + need_slash = true; + + lp_url = (char*) malloc(strlen(rpc_url) + strlen(copy_start) + 2); + if (!lp_url) + goto out; + + sprintf(lp_url, "%s%s%s", rpc_url, need_slash ? "/" : "", copy_start); + } + + if (!opt_quiet) + applog(LOG_BLUE, "Long-polling on %s", lp_url); + + while (1) + { + int err; + json_t *val; + val = (json_t*)algo_gate.longpoll_rpc_call( curl, &err, lp_url ); + + if (have_stratum) + { + if (val) + json_decref(val); + goto out; + } + if (likely( val )) + { + bool rc; + char *start_job_id; + double start_diff = 0.0; + json_t *res, *soval; + res = json_object_get(val, "result"); + soval = json_object_get(res, "submitold"); + submit_old = soval ? json_is_true(soval) : false; + + pthread_rwlock_wrlock( &g_work_lock ); + +// This code has been here for a long time even though job_id isn't used. +// This needs to be changed eventually to test the block height properly +// using g_work.block_height . + start_job_id = g_work.job_id ? strdup(g_work.job_id) : NULL; + if (have_gbt) + rc = gbt_work_decode(res, &g_work); + else + rc = work_decode(res, &g_work); + if (rc) + { +// purge job id from solo mining + bool newblock = g_work.job_id && strcmp(start_job_id, g_work.job_id); + newblock |= (start_diff != net_diff); // the best is the height but... longpoll... + if (newblock) + { + start_diff = net_diff; + if (!opt_quiet) + { + char netinfo[64] = { 0 }; + if ( net_diff > 0. ) + { + sprintf(netinfo, ", diff %.3f", net_diff); + } + sprintf( &netinfo[strlen(netinfo)], ", target %.3f", + g_work.targetdiff ); + applog(LOG_BLUE, "%s detected new block%s", short_url, netinfo); + } + time(&g_work_time); + restart_threads(); + } + } + free(start_job_id); + + pthread_rwlock_unlock( &g_work_lock ); + + json_decref(val); + } + else // !val + { + pthread_rwlock_wrlock( &g_work_lock ); + g_work_time -= LP_SCANTIME; + pthread_rwlock_unlock( &g_work_lock ); + if (err == CURLE_OPERATION_TIMEDOUT) + { + restart_threads(); + } + else + { + have_longpoll = false; + restart_threads(); + free(hdr_path); + free(lp_url); + lp_url = NULL; + sleep(opt_fail_pause); + goto start; + } + } + } + +out: + free(hdr_path); + free(lp_url); + tq_freeze(mythr->q); + if (curl) + curl_easy_cleanup(curl); + + return NULL; +} + +static bool stratum_handle_response( char *buf ) +{ + json_t *val, *id_val, *res_val, *err_val; + json_error_t err; + bool ret = false; + bool share_accepted = false; + + val = JSON_LOADS( buf, &err ); + if (!val) + { + applog(LOG_INFO, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + res_val = json_object_get( val, "result" ); + if ( !res_val ) { /* now what? */ } + + id_val = json_object_get( val, "id" ); + if ( !id_val || json_is_null(id_val) ) + goto out; + + err_val = json_object_get( val, "error" ); + + if ( !res_val || json_integer_value( id_val ) < 4 ) + goto out; + share_accepted = json_is_true( res_val ); + share_result( share_accepted, NULL, err_val ? + json_string_value( json_array_get(err_val, 1) ) : NULL ); + + ret = true; +out: + if (val) + json_decref(val); + return ret; +} + +// used by stratum and gbt +void std_build_block_header( struct work* g_work, uint32_t version, + uint32_t *prevhash, uint32_t *merkle_tree, uint32_t ntime, + uint32_t nbits, unsigned char *final_sapling_hash ) +{ + int i; + + memset( g_work->data, 0, sizeof(g_work->data) ); + g_work->data[0] = version; + g_work->sapling = opt_sapling; + if (have_stratum) { + g_work->data[0] = swab32(version); + for (int i = 0; i < 8; i++) + g_work->data[1 + i] = swab32(prevhash[i]); + } + else for (int i = 0; i < 8; i++) + g_work->data[1 + i] = swab32(prevhash[7 - i]); + //for ( i = 0; i < 8; i++ ) + // g_work->data[ 9+i ] = be32dec( merkle_tree + i ); + memcpy(&g_work->data[9], merkle_tree, 32); + g_work->data[ algo_gate.ntime_index ] = ntime; + g_work->data[ algo_gate.nbits_index ] = nbits; + g_work->data[ algo_gate.nonce_index ] = 0; + + if ( g_work->sapling ) + { + if ( have_stratum ) + for ( i = 0; i < 8; i++ ) + g_work->data[20 + i] = le32dec( (uint32_t*)final_sapling_hash + i ); + else + { + for ( i = 0; i < 8; i++ ) + g_work->data[27 - i] = le32dec( (uint32_t*)final_sapling_hash + i ); + g_work->data[19] = 0; + } + g_work->data[28] = 0x80000000; + g_work->data[29] = 0x00000000; + g_work->data[30] = 0x00000000; + g_work->data[31] = 0x00000380; + } + else + { + g_work->data[20] = 0x80000000; + g_work->data[31] = 0x00000280; + } +} + +void std_build_extraheader( struct work* g_work, struct stratum_ctx* sctx ) +{ + uchar merkle_tree[64] = { 0 }; + + algo_gate.gen_merkle_root( merkle_tree, sctx ); + algo_gate.build_block_header( g_work, le32dec(sctx->job.version), + (uint32_t*) sctx->job.prevhash, (uint32_t*) merkle_tree, + swab32(le32dec(sctx->job.ntime)), swab32(le32dec(sctx->job.nbits)), + sctx->job.final_sapling_hash ); +} + +// Loop is out of order: +// +// connect/reconnect +// handle message +// get new message +// +// change to +// connect/reconnect +// get new message +// handle message + + +static void *stratum_thread(void *userdata ) +{ + struct thr_info *mythr = (struct thr_info *) userdata; + char *s = NULL; + + stratum.url = (char*) tq_pop(mythr->q, NULL); + if (!stratum.url) + goto out; + applog( LOG_BLUE, "Stratum connect %s", stratum.url ); + + while (1) + { + int failures = 0; + + if ( unlikely( stratum_need_reset ) ) + { + stratum_need_reset = false; + gettimeofday( &stratum_reset_time, NULL ); + stratum_down = true; + stratum_errors++; + stratum_disconnect( &stratum ); + if ( strcmp( stratum.url, rpc_url ) ) + { + free( stratum.url ); + stratum.url = strdup( rpc_url ); + applog(LOG_BLUE, "Connection changed to %s", short_url); + } + else + applog(LOG_BLUE, "Stratum connection reset"); + // reset stats queue as well + restart_threads(); + if ( s_get_ptr != s_put_ptr ) s_get_ptr = s_put_ptr = 0; + } + + while ( !stratum.curl ) + { + stratum_down = true; + restart_threads(); + pthread_rwlock_wrlock( &g_work_lock ); + g_work_time = 0; + pthread_rwlock_unlock( &g_work_lock ); + if ( !stratum_connect( &stratum, stratum.url ) + || !stratum_subscribe( &stratum ) + || !stratum_authorize( &stratum, rpc_user, rpc_pass ) ) + { + stratum_disconnect( &stratum ); + if (opt_retries >= 0 && ++failures > opt_retries) + { + applog(LOG_ERR, "...terminating workio thread"); + tq_push(thr_info[work_thr_id].q, NULL); + goto out; + } + if (!opt_benchmark) + applog(LOG_ERR, "...retry after %d seconds", opt_fail_pause); + sleep(opt_fail_pause); + } + else + { +// sometimes stratum connects but doesn't immediately send a job, wait for one. +// stratum_down = false; + applog(LOG_BLUE,"Stratum connection established" ); + if ( stratum.new_job ) // prime first job + { + stratum_down = false; + stratum_gen_work( &stratum, &g_work ); + } + } + } + + // Wait for new message from server + if ( likely( stratum_socket_full( &stratum, opt_timeout ) ) ) + { + if ( likely( s = stratum_recv_line( &stratum ) ) ) + { + stratum_down = false; + if ( likely( !stratum_handle_method( &stratum, s ) ) ) + stratum_handle_response( s ); + free( s ); + } + else + { +// applog(LOG_WARNING, "Stratum connection interrupted"); +// stratum_disconnect( &stratum ); + stratum_need_reset = true; + } + } + else + { + applog(LOG_ERR, "Stratum connection timeout"); + stratum_need_reset = true; +// stratum_disconnect( &stratum ); + } + + report_summary_log( ( stratum_diff != stratum.job.diff ) + && ( stratum_diff != 0. ) ); + + if ( !stratum_need_reset ) + { + // Is keepalive needed? Mutex would normally be required but that + // would block any attempt to submit a share. A share is more + // important even if it messes up the keepalive. + + if ( opt_stratum_keepalive ) + { + struct timeval now, et; + gettimeofday( &now, NULL ); + // any shares submitted since last keepalive? + if ( last_submit_time.tv_sec > stratum_keepalive_timer.tv_sec ) + memcpy( &stratum_keepalive_timer, &last_submit_time, + sizeof (struct timeval) ); + + timeval_subtract( &et, &now, &stratum_keepalive_timer ); + + if ( et.tv_sec > stratum_keepalive_timeout ) + { + double diff = stratum.job.diff * 0.5; + stratum_keepalive_timer = now; + if ( !opt_quiet ) + applog( LOG_BLUE, + "Stratum keepalive requesting lower difficulty" ); + stratum_suggest_difficulty( &stratum, diff ); + } + + if ( last_submit_time.tv_sec > stratum_reset_time.tv_sec ) + timeval_subtract( &et, &now, &last_submit_time ); + else + timeval_subtract( &et, &now, &stratum_reset_time ); + + if ( et.tv_sec > stratum_keepalive_timeout + 90 ) + { + applog( LOG_NOTICE, "No shares submitted, resetting stratum connection" ); + stratum_need_reset = true; + stratum_keepalive_timer = now; + } + } // stratum_keepalive + + if ( stratum.new_job && !stratum_need_reset ) + stratum_gen_work( &stratum, &g_work ); + + } // stratum_need_reset + } // loop +out: + return NULL; +} + +static void show_credits() +{ + printf("\n ********** "PACKAGE_NAME" "PACKAGE_VERSION" ********** \n"); + printf(" A CPU miner with multi algo support and optimized for CPUs\n"); + printf(" with AVX512, SHA, AES and NEON extensions by JayDDee.\n"); + printf(" BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT\n\n"); +} + +#define check_cpu_capability() cpu_capability( false ) +#define display_cpu_capability() cpu_capability( true ) + +static bool cpu_capability( bool display_only ) +{ + char cpu_brand[0x40]; + bool cpu_has_sse2 = has_sse2(); // X86_64 only + bool cpu_has_ssse3 = has_ssse3(); // X86_64 only + bool cpu_has_sse41 = has_sse41(); // X86_64 only + bool cpu_has_sse42 = has_sse42(); + bool cpu_has_avx = has_avx(); + bool cpu_has_neon = has_neon(); // AArch64 + bool cpu_has_sve = has_sve(); // aarch64 only, insignificant + bool cpu_has_sve2 = has_sve2(); // AArch64 only + bool cpu_has_sme = has_sme(); + bool cpu_has_sme2 = has_sme2(); + bool cpu_has_avx2 = has_avx2(); + bool cpu_has_avx512 = has_avx512(); + bool cpu_has_avx10 = has_avx10(); + bool cpu_has_aes = has_aes(); // x86_64 or AArch64 + bool cpu_has_vaes = has_vaes(); // X86_64 only + bool cpu_has_sha256 = has_sha256(); // x86_64 or AArch64 + bool cpu_has_sha512 = has_sha512(); + bool sw_has_x86_64 = false; + bool sw_has_aarch64 = false; + int sw_arm_arch = 0; // AArch64 version + bool sw_has_neon = false; // AArch64 + bool sw_has_sve = false; // AArch64 + bool sw_has_sve2 = false; // AArch64 + bool sw_has_sme = false; + bool sw_has_sme2 = false; + bool sw_has_sse2 = false; // x86_64 + bool sw_has_ssse3 = false; // x86_64 + bool sw_has_sse41 = false; // x86_64 + bool sw_has_sse42 = false; + bool sw_has_avx = false; + bool sw_has_avx2 = false; + bool sw_has_avx512 = false; + bool sw_has_avx10_256 = false; + bool sw_has_avx10_512 = false; + bool sw_has_aes = false; + bool sw_has_vaes = false; + bool sw_has_sha256 = false; // x86_64 or AArch64 + bool sw_has_sha512 = false; // x86_64 or AArch64 +/* + set_t algo_features = algo_gate.optimizations; + bool algo_has_sse2 = set_incl( SSE2_OPT, algo_features ); + bool algo_has_sse42 = set_incl( SSE42_OPT, algo_features ); + bool algo_has_avx = set_incl( AVX_OPT, algo_features ); + bool algo_has_avx2 = set_incl( AVX2_OPT, algo_features ); + bool algo_has_avx512 = set_incl( AVX512_OPT, algo_features ); + bool algo_has_aes = set_incl( AES_OPT, algo_features ); + bool algo_has_vaes = set_incl( VAES_OPT, algo_features ); + bool algo_has_sha256 = set_incl( SHA256_OPT, algo_features ); + bool algo_has_sha512 = set_incl( SHA512_OPT, algo_features ); + bool algo_has_neon = set_incl( NEON_OPT, algo_features ); + bool use_sse2; + bool use_sse42; + bool use_avx; + bool use_avx2; + bool use_avx512; + bool use_aes; + bool use_vaes; + bool use_sha256; + bool use_sha512; + bool use_neon; + bool use_none; +*/ + #if defined(__x86_64__) + sw_has_x86_64 = true; + #elif defined(__aarch64__) + sw_has_aarch64 = true; + #ifdef __ARM_NEON + sw_has_neon = true; + #endif + #ifdef __ARM_ARCH + sw_arm_arch = __ARM_ARCH; + #endif + #endif + + // x86_64 only + #if defined(__SSE2__) + sw_has_sse2 = true; + #endif + #if defined(__SSSE3__) + sw_has_ssse3 = true; + #endif + #if defined(__SSE41__) + sw_has_sse41 = true; + #endif + #ifdef __SSE4_2__ + sw_has_sse42 = true; + #endif + #ifdef __AVX__ + sw_has_avx = true; + #endif + #ifdef __AVX2__ + sw_has_avx2 = true; + #endif + #if (defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512BW__) && defined(__AVX512VL__)) + sw_has_avx512 = true; + #endif + #if defined(__AVX10_1_256__) + sw_has_avx10_256 = true; + #endif + #if defined(__AVX10_1_512__) + sw_has_avx10_512 = true; + #endif + + // x86_64 or AArch64 + #if defined(__AES__) || defined(__ARM_FEATURE_AES) + sw_has_aes = true; + #endif + #ifdef __VAES__ + sw_has_vaes = true; + #endif + #if defined(__SHA__) || defined(__ARM_FEATURE_SHA2) + sw_has_sha256 = true; + #endif + #if defined(__SHA512__) || defined(__ARM_FEATURE_SHA512) + sw_has_sha512 = true; + #endif + + // AArch64 only + #if defined(__ARM_NEON) + sw_has_neon = true; + #endif + #if defined(__ARM_FEATURE_SVE) + sw_has_sve = true; + #endif + #if defined(__ARM_FEATURE_SVE2) + sw_has_sve2 = true; + #endif + #if defined(__ARM_FEATURE_SME) + sw_has_sme = true; + #endif + #if defined(__ARM_FEATURE_SME2) + sw_has_sme2 = true; + #endif + + // CPU + cpu_brand_string( cpu_brand ); + printf( "CPU: %s\n", cpu_brand ); + + // Build + printf( "SW built on " __DATE__ + #if defined(__clang__) + " with CLANG-%d.%d.%d", __clang_major__, __clang_minor__, + __clang_patchlevel__ ); + #elif defined(__GNUC__) + " with GCC-%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ ); + #endif + + // OS + #if defined(__linux) + printf(" Linux\n"); + #elif defined(WIN32) + printf(" Windows"); + #if defined(__MINGW64__) + printf(" MinGW-w64\n"); + #else + printf("\n"); + #endif + #elif defined(__APPLE__) + printf(" MacOS\n"); + #elif defined(__bsd__) || defined(__unix__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + printf(" BSD/Unix\n"); + #else + printf("\n"); + #endif + + printf("CPU features: "); + if ( cpu_arch_x86_64() ) + { + if ( cpu_has_avx10 ) printf( " AVX10.%d-%d", avx10_version(), + avx10_vector_length() ); + if ( cpu_has_avx512 ) printf( " AVX512" ); + else if ( cpu_has_avx2 ) printf( " AVX2 " ); + else if ( cpu_has_avx ) printf( " AVX " ); + else if ( cpu_has_sse42 ) printf( " SSE4.2" ); + else if ( cpu_has_sse41 ) printf( " SSE4.1" ); + else if ( cpu_has_ssse3 ) printf( " SSSE3 " ); + else if ( cpu_has_sse2 ) printf( " SSE2 " ); + } + else if ( cpu_arch_aarch64() ) + { + if ( cpu_has_neon ) printf( " NEON" ); + if ( cpu_has_sve2 ) printf( " SVE2-%d", sve_vector_length() ); + else if ( cpu_has_sve ) printf( " SVE" ); + if ( cpu_has_sme2 ) printf( " SME2" ); + else if ( cpu_has_sme ) printf( " SME" ); + } + if ( cpu_has_vaes ) printf( " VAES" ); + else if ( cpu_has_aes ) printf( " AES" ); + if ( cpu_has_sha512 ) printf( " SHA512" ); + else if ( cpu_has_sha256 ) printf( " SHA256" ); + + printf("\nSW features: "); + if ( sw_has_x86_64 ) + { + if ( sw_has_avx10_512 ) printf( " AVX10-512" ); + else if ( sw_has_avx10_256 ) printf( " AVX10-256" ); + else if ( sw_has_avx512 ) printf( " AVX512" ); + else if ( sw_has_avx2 ) printf( " AVX2 " ); + else if ( sw_has_avx ) printf( " AVX " ); + else if ( sw_has_sse42 ) printf( " SSE4.2" ); + else if ( sw_has_sse41 ) printf( " SSE4.1" ); + else if ( sw_has_ssse3 ) printf( " SSSE3 " ); + else if ( sw_has_sse2 ) printf( " SSE2 " ); + } + else if ( sw_has_aarch64 ) + { + if ( sw_arm_arch ) printf( " armv%d", sw_arm_arch ); + if ( sw_has_neon ) printf( " NEON" ); + if ( sw_has_sve2 ) printf( " SVE2" ); + else if ( sw_has_sve ) printf( " SVE" ); + if ( sw_has_sme2 ) printf( " SME2" ); + else if ( sw_has_sme ) printf( " SME" ); + } + if ( sw_has_vaes ) printf( " VAES" ); + else if ( sw_has_aes ) printf( " AES" ); + if ( sw_has_sha512 ) printf( " SHA512" ); + else if ( sw_has_sha256 ) printf( " SHA256" ); + + printf("\n"); + +/* + if ( !display_only ) + { + printf("\nAlgo features:"); + if ( algo_features == EMPTY_SET ) printf( " None" ); + else + { + if ( algo_has_avx512 ) printf( " AVX512" ); + else if ( algo_has_avx2 ) printf( " AVX2" ); + else if ( algo_has_sse42 ) printf( " SSE4.2" ); + else if ( algo_has_sse2 ) printf( " SSE2" ); + if ( algo_has_neon ) printf( " NEON" ); + if ( algo_has_vaes ) printf( " VAES" ); + else if ( algo_has_aes ) printf( " AES" ); + if ( algo_has_sha512 ) printf( " SHA512" ); + else if ( algo_has_sha256 ) printf( " SHA256" ); + } + } + printf("\n"); + + + if ( display_only ) return true; + + // Determine mining options + use_sse2 = cpu_has_sse2 && sw_has_sse2 && algo_has_sse2; + use_sse42 = cpu_has_sse42 && sw_has_sse42 && algo_has_sse42; + use_avx = cpu_has_avx && sw_has_avx && algo_has_avx; + use_avx2 = cpu_has_avx2 && sw_has_avx2 && algo_has_avx2; + use_avx512 = cpu_has_avx512 && sw_has_avx512 && algo_has_avx512; + use_aes = cpu_has_aes && sw_has_aes && algo_has_aes; + use_vaes = cpu_has_vaes && sw_has_vaes && algo_has_vaes; + use_sha256 = cpu_has_sha256 && sw_has_sha256 && algo_has_sha256; + use_sha512 = cpu_has_sha512 && sw_has_sha512 && algo_has_sha512; + use_neon = sw_has_aarch64 && sw_has_neon && algo_has_neon; + use_none = !( use_sse2 || use_sse42 || use_avx || use_aes || use_avx512 + || use_avx2 || use_sha256 || use_vaes || use_sha512 || use_neon ); + + // Display best options + if ( !use_none ) + { + applog_nl( "Enabled optimizations:" ); + if ( use_neon ) printf( " NEON" ); + if ( use_avx512 ) printf( " AVX512" ); + else if ( use_avx2 ) printf( " AVX2" ); + else if ( use_avx ) printf( " AVX" ); + else if ( use_sse42 ) printf( " SSE42" ); + else if ( use_sse2 ) printf( " SSE2" ); + if ( use_vaes ) printf( " VAES" ); + else if ( use_aes ) printf( " AES" ); + if ( use_sha512 ) printf( " SHA512" ); + else if ( use_sha256 ) printf( " SHA256" ); + printf( "\n" ); + } +*/ + + return true; +} + +/* +void show_version_and_exit(void) +{ + printf("\n built on " __DATE__ +#ifdef _MSC_VER + " with VC++ 2013\n"); +#elif defined(__GNUC__) + " with GCC"); + printf(" %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); +#endif + printf(" features:" +#if defined(USE_ASM) && defined(__i386__) + " i386" +#endif +#if defined(USE_ASM) && defined(__x86_64__) + " x86_64" +#endif +#if defined(USE_ASM) && (defined(__i386__) || defined(__x86_64__)) + " SSE2" +#endif +#if defined(__x86_64__) && defined(USE_AVX) + " AVX" +#endif +#if defined(__x86_64__) && defined(USE_AVX2) + " AVX2" +#endif +#if defined(__x86_64__) && defined(USE_XOP) + " XOP" +#endif +#if defined(USE_ASM) && defined(__arm__) && defined(__APCS_32__) + " ARM" +#if defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \ + defined(__ARM_ARCH_5TEJ__) || defined(__ARM_ARCH_6__) || \ + defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \ + defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_6T2__) || \ + defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || \ + defined(__ARM_ARCH_7__) || \ + defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ + defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) + " ARMv5E" +#endif +#if defined(__ARM_NEON__) + " NEON" +#endif +#endif + "\n\n"); + + printf("%s\n", curl_version()); +#ifdef JANSSON_VERSION + printf("jansson/%s ", JANSSON_VERSION); +#endif +#ifdef PTW32_VERSION + printf("pthreads/%d.%d.%d.%d ", PTW32_VERSION); +#endif + printf("\n"); + exit(0); +} +*/ +void show_usage_and_exit(int status) +{ + if (status) + fprintf(stderr, "Try `--help' for more information.\n"); + else + printf(usage); + exit(status); +} + +void strhide(char *s) +{ + if (*s) *s++ = 'x'; + while (*s) *s++ = '\0'; +} + +void parse_arg(int key, char *arg ) +{ + char *p; + int v, i; + double d; + + switch( key ) + { + case 'a': // algo + get_algo_alias( &arg ); + for (i = 1; i < ALGO_COUNT; i++) + { + v = (int) strlen( algo_names[i] ); + if ( v && !strncasecmp( arg, algo_names[i], v ) ) + { + if ( arg[v] == '\0' ) + { + opt_algo = (enum algos) i; + break; + } + if ( arg[v] == ':' ) + { + char *ep; + v = strtol( arg+v+1, &ep, 10 ); + if ( *ep || v < 2 ) + continue; + opt_algo = (enum algos) i; + opt_param_n = v; + break; + } + } + } + if ( i == ALGO_COUNT ) + { + applog( LOG_ERR,"Unknown algo: %s",arg ); + show_usage_and_exit( 1 ); + } + break; + + case 'b': // api-bind + opt_api_enabled = true; + p = strstr(arg, ":"); + if ( p ) + { + /* ip:port */ + if ( p - arg > 0 ) + { + opt_api_allow = strdup(arg); + opt_api_allow[p - arg] = '\0'; + } + opt_api_listen = atoi(p + 1); + } + else if ( arg && strstr( arg, "." ) ) + { + /* ip only */ + free(opt_api_allow); + opt_api_allow = strdup(arg); + opt_api_listen = default_api_listen; + } + else if ( arg ) + { + /* port or 0 to disable */ + opt_api_allow = default_api_allow; + opt_api_listen = atoi(arg); + } + break; + case 1030: // api-remote + opt_api_remote = 1; + break; + case 'B': // background + opt_background = true; + use_colors = false; + break; + case 'c': { // config + json_error_t err; + json_t *config; + + if (arg && strstr(arg, "://")) + config = json_load_url(arg, &err); + else + config = JSON_LOADF(arg, &err); + if (!json_is_object(config)) + { + if (err.line < 0) + fprintf(stderr, "%s\n", err.text); + else + fprintf(stderr, "%s:%d: %s\n", arg, err.line, err.text); + } + else + { + parse_config(config, arg); + json_decref(config); + } + break; + } + + // debug overrides quiet + case 'q': // quiet + if ( !( opt_debug || opt_protocol ) ) opt_quiet = true; + break; + case 'D': // debug + opt_debug = true; + opt_quiet = false; + break; + case 'p': // pass + free(rpc_pass); + rpc_pass = strdup(arg); + strhide(arg); + break; + case 'P': // protocol + opt_protocol = true; + opt_quiet = false; + break; + case 'r': // retries + v = atoi(arg); + if (v < -1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_retries = v; + break; + case 1025: // retry-pause + v = atoi(arg); + if (v < 1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_fail_pause = v; + break; + case 's': // scantime + v = atoi(arg); + if (v < 1 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_scantime = v; + break; + case 'T': // timeout + v = atoi(arg); + if (v < 1 || v > 99999) /* sanity check */ + show_usage_and_exit(1); + opt_timeout = v; + break; + case 't': // threads + v = atoi(arg); + if (v < 0 || v > 9999) /* sanity check */ + show_usage_and_exit(1); + opt_n_threads = v; + break; + case 'u': // user + free(rpc_user); + rpc_user = strdup(arg); + break; + + case 'o': // url + { + char *ap, *hp; + ap = strstr( arg, "://" ); + ap = ap ? ap + 3 : arg; + hp = strrchr( arg, '@' ); + if ( hp ) + { + *hp = '\0'; + p = strchr( ap, ':' ); + if ( p ) + { + free( rpc_userpass ); + rpc_userpass = strdup( ap ); + free( rpc_user ); + rpc_user = (char*)calloc( p - ap + 1, 1 ); + strncpy( rpc_user, ap, p - ap ); + free( rpc_pass ); + rpc_pass = strdup( ++p ); + if ( *p ) *p++ = 'x'; + v = (int)strlen( hp + 1 ) + 1; + memmove( p + 1, hp + 1, v ); + memset( p + v, 0, hp - p ); + hp = p; + } + else + { + free( rpc_user ); + rpc_user = strdup( ap ); + } + *hp++ = '@'; + } + else + hp = ap; + if ( ap != arg ) + { + if ( strncasecmp( arg, "http://", 7 ) + && strncasecmp( arg, "https://", 8 ) + && strncasecmp( arg, "stratum+tcp://", 14 ) + && strncasecmp( arg, "stratum+ssl://", 14 ) + && strncasecmp( arg, "stratum+tcps://", 15 ) ) + { + fprintf(stderr, "unknown protocol -- '%s'\n", arg); + show_usage_and_exit(1); + } + free(rpc_url); + rpc_url = strdup(arg); + strcpy(rpc_url + (ap - arg), hp); + short_url = &rpc_url[ap - arg]; + } + else + { + if ( *hp == '\0' || *hp == '/' ) + { + fprintf( stderr, "invalid URL -- '%s'\n", arg ); + show_usage_and_exit( 1 ); + } + free( rpc_url ); + rpc_url = (char*) malloc( strlen(hp) + 15 ); + sprintf( rpc_url, "stratum+tcp://%s", hp ); + short_url = &rpc_url[ sizeof("stratum+tcp://") - 1 ]; + } + have_stratum = !opt_benchmark && !strncasecmp( rpc_url, "stratum", 7 ); + break; + } + + case 'O': // userpass + p = strchr(arg, ':'); + if (!p) + { + fprintf(stderr, "invalid username:password pair -- '%s'\n", arg); + show_usage_and_exit(1); + } + free(rpc_userpass); + rpc_userpass = strdup(arg); + free(rpc_user); + rpc_user = (char*) calloc(p - arg + 1, 1); + strncpy(rpc_user, arg, p - arg); + free(rpc_pass); + rpc_pass = strdup(++p); + strhide(p); + break; + case 'x': // proxy + if ( !strncasecmp( arg, "socks4://", 9 ) ) + opt_proxy_type = CURLPROXY_SOCKS4; + else if ( !strncasecmp( arg, "socks5://", 9 ) ) + opt_proxy_type = CURLPROXY_SOCKS5; +#if LIBCURL_VERSION_NUM >= 0x071200 + else if ( !strncasecmp( arg, "socks4a://", 10 ) ) + opt_proxy_type = CURLPROXY_SOCKS4A; + else if ( !strncasecmp( arg, "socks5h://", 10 ) ) + opt_proxy_type = CURLPROXY_SOCKS5_HOSTNAME; +#endif + else + opt_proxy_type = CURLPROXY_HTTP; + free(opt_proxy); + opt_proxy = strdup(arg); + break; + case 1001: // cert + free(opt_cert); + opt_cert = strdup(arg); + break; + case 1002: // no-color + use_colors = false; + break; + case 1003: // no-longpoll + want_longpoll = false; + break; + case 1005: // benchmark + opt_benchmark = true; + want_longpoll = false; + want_stratum = false; + have_stratum = false; + break; + case 1006: // cputest +// print_hash_tests(); + exit(0); + case 1007: // no-stratum + want_stratum = false; + opt_extranonce = false; + break; + case 1008: // time-limit + opt_time_limit = atoi(arg); + break; + case 1009: // no-redirect + opt_redirect = false; + break; + case 1010: // no-getwork + allow_getwork = false; + break; + case 1011: // no-gbt + have_gbt = false; + break; + case 1012: // no-extranonce + opt_extranonce = false; + break; + case 1014: // hash-meter + opt_hash_meter = true; + break; + case 1031: // bell + opt_bell = true; + break; + case 1016: /* --coinbase-addr */ + if ( arg ) coinbase_address = strdup( arg ); + break; + case 1015: /* --coinbase-sig */ + if ( strlen( arg ) + 1 > sizeof(coinbase_sig) ) + { + fprintf( stderr, "coinbase signature too long\n" ); + show_usage_and_exit( 1 ); + } + strcpy( coinbase_sig, arg ); + break; + case 'f': + d = atof(arg); + if (d == 0.) /* --diff-factor */ + show_usage_and_exit(1); + opt_diff_factor = d; + break; + case 'm': + d = atof(arg); + if (d == 0.) /* --diff-multiplier */ + show_usage_and_exit(1); + opt_diff_factor = 1.0/d; + break; +#ifdef HAVE_SYSLOG_H + case 'S': // syslog + use_syslog = true; + use_colors = false; + break; +#endif + case 1020: // cpu-affinity + p = strstr( arg, "0x" ); + opt_affinity = p ? strtoull( p, NULL, 16 ) + : atoll( arg ); + break; + case 1021: // cpu-priority + v = atoi(arg); + applog(LOG_NOTICE,"--cpu-priority is deprecated and will be removed from a future release"); + if (v < 0 || v > 5) /* sanity check */ + show_usage_and_exit(1); + opt_priority = v; + break; + case 'N': // N parameter for various scrypt algos + d = atoi( arg ); + opt_param_n = d; + break; + case 'R': // R parameter for various scrypt algos + d = atoi( arg ); + opt_param_r = d; + break; + case 'K': // Client key for various algos + free( opt_param_key ); + opt_param_key = strdup( arg ); + break; + case 1060: // max-temp + d = atof(arg); + opt_max_temp = d; + break; + case 1061: // max-diff + d = atof(arg); + opt_max_diff = d; + break; + case 1062: // max-rate + d = atof(arg); + p = strstr(arg, "K"); + if (p) d *= 1e3; + p = strstr(arg, "M"); + if (p) d *= 1e6; + p = strstr(arg, "G"); + if (p) d *= 1e9; + opt_max_rate = d; + break; + case 1024: + opt_randomize = true; + applog(LOG_NOTICE,"--randomize is deprecated and will be removed from a future release"); + break; + case 1027: // data-file + opt_data_file = strdup( arg ); + break; + case 1028: // verify + opt_verify = true; + break; + case 1029: // stratum-keepalive + opt_stratum_keepalive = true; + break; + case 'V': // version + display_cpu_capability(); + exit(0); + case 'h': // help + show_usage_and_exit(0); + case 1032: // --mweb + opt_mweb = true; + break; + default: + show_usage_and_exit(1); + } +} + +void parse_config(json_t *config, char *ref) +{ + int i; + json_t *val; + + for (i = 0; i < ARRAY_SIZE(options); i++) { + if (!options[i].name) + break; + + val = json_object_get(config, options[i].name); + if (!val) + continue; + if (options[i].has_arg && json_is_string(val)) { + char *s = strdup(json_string_value(val)); + if (!s) + break; + parse_arg(options[i].val, s); + free(s); + } + else if (options[i].has_arg && json_is_integer(val)) { + char buf[16]; + sprintf(buf, "%d", (int)json_integer_value(val)); + parse_arg(options[i].val, buf); + } + else if (options[i].has_arg && json_is_real(val)) { + char buf[16]; + sprintf(buf, "%f", json_real_value(val)); + parse_arg(options[i].val, buf); + } + else if (!options[i].has_arg) { + if (json_is_true(val)) + parse_arg(options[i].val, ""); + } + else + applog(LOG_ERR, "JSON option %s invalid", + options[i].name); + } +} + +static void parse_cmdline(int argc, char *argv[]) +{ + int key; + + while (1) + { +#if HAVE_GETOPT_LONG + key = getopt_long(argc, argv, short_options, options, NULL); +#else + key = getopt(argc, argv, short_options); +#endif + if ( key < 0 ) break; + parse_arg( key, optarg ); + } + if ( optind < argc ) + { + fprintf( stderr, "%s: unsupported non-option argument -- '%s'\n", + argv[0], argv[optind]); + show_usage_and_exit(1); + } +} + +#ifndef WIN32 +static void signal_handler(int sig) +{ + switch (sig) { + case SIGHUP: + applog(LOG_INFO, "SIGHUP received"); + break; + case SIGINT: + applog(LOG_INFO, "SIGINT received, exiting"); + proper_exit(0); + break; + case SIGTERM: + applog(LOG_INFO, "SIGTERM received, exiting"); + proper_exit(0); + break; + } +} +#else +BOOL WINAPI ConsoleHandler(DWORD dwType) +{ + switch (dwType) { + case CTRL_C_EVENT: + applog(LOG_INFO, "CTRL_C_EVENT received, exiting"); + proper_exit(0); + break; + case CTRL_BREAK_EVENT: + applog(LOG_INFO, "CTRL_BREAK_EVENT received, exiting"); + proper_exit(0); + break; + default: + return false; + } + return true; +} +#endif + +static int thread_create(struct thr_info *thr, void* func) +{ + int err = 0; + pthread_attr_init(&thr->attr); + err = pthread_create(&thr->pth, &thr->attr, func, thr); + pthread_attr_destroy(&thr->attr); + return err; +} + +void get_defconfig_path(char *out, size_t bufsize, char *argv0); + +int main(int argc, char *argv[]) +{ + struct thr_info *thr; + long flags; + int i, err; + + pthread_mutex_init(&applog_lock, NULL); + + show_credits(); + + rpc_user = strdup(""); + rpc_pass = strdup(""); + +#if defined(WIN32) + +// Get the number of cpus, display after parsing command line +#if defined(WINDOWS_CPU_GROUPS_ENABLED) + num_cpus = 0; + num_cpugroups = GetActiveProcessorGroupCount(); + for( i = 0; i < num_cpugroups; i++ ) + { + int cpus = GetActiveProcessorCount( i ); + num_cpus += cpus; + } + +#else + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + num_cpus = sysinfo.dwNumberOfProcessors; +#endif + +#elif defined(_SC_NPROCESSORS_CONF) + num_cpus = sysconf(_SC_NPROCESSORS_CONF); +#elif defined(CTL_HW) && defined(HW_NCPU) + int req[] = { CTL_HW, HW_NCPU }; + size_t len = sizeof(num_cpus); + sysctl(req, 2, &num_cpus, &len, NULL, 0); +#else + num_cpus = 1; +#endif + + if ( num_cpus < 1 ) + num_cpus = 1; + opt_n_threads = num_cpus; + + parse_cmdline( argc, argv ); + + if ( opt_algo == ALGO_NULL ) + { + fprintf( stderr, "%s: No algo parameter specified\n", argv[0] ); + show_usage_and_exit(1); + } + + if ( !opt_scantime ) + { + if ( have_stratum ) opt_scantime = 30; + else if ( have_longpoll ) opt_scantime = LP_SCANTIME; + else opt_scantime = 5; + } + + if ( opt_time_limit ) + time_limit_stop = (unsigned int)time(NULL) + opt_time_limit; + + // need to register to get algo optimizations for cpu capabilities + // but that causes registration logs before cpu capabilities is output. + // Would need to split register function into 2 parts. First part sets algo + // optimizations but no logging, second part does any logging. + if ( !register_algo_gate( opt_algo, &algo_gate ) ) exit(1); + + if ( !check_cpu_capability() ) exit(1); + + if ( !opt_benchmark ) + { + if ( !short_url ) + { + fprintf(stderr, "%s: no URL supplied\n", argv[0]); + show_usage_and_exit(1); + } +/* + if ( !rpc_url ) + { + // try default config file in binary folder + char defconfig[MAX_PATH] = { 0 }; + get_defconfig_path(defconfig, MAX_PATH, argv[0]); + if (strlen(defconfig)) + { + if (opt_debug) + applog(LOG_DEBUG, "Using config %s", defconfig); + parse_arg('c', defconfig); + parse_cmdline(argc, argv); + } + } + if ( !rpc_url ) + { + fprintf(stderr, "%s: no URL supplied\n", argv[0]); + show_usage_and_exit(1); + } +*/ + } + + if (!rpc_userpass) + { + rpc_userpass = (char*) malloc(strlen(rpc_user) + strlen(rpc_pass) + 2); + if (rpc_userpass) + sprintf(rpc_userpass, "%s:%s", rpc_user, rpc_pass); + else + return 1; + } + + if ( coinbase_address ) + { + pk_script_size = address_to_script( pk_script, pk_buffer_size, + coinbase_address ); + if ( !pk_script_size ) + { + applog(LOG_ERR,"Invalid coinbase address: '%s'", coinbase_address ); + exit(0); + } + } + + pthread_mutex_init( &stats_lock, NULL ); + pthread_rwlock_init( &g_work_lock, NULL ); + pthread_mutex_init( &stratum.sock_lock, NULL ); + pthread_mutex_init( &stratum.work_lock, NULL ); + + flags = CURL_GLOBAL_ALL; + if ( !opt_benchmark ) + if ( strncasecmp( rpc_url, "https:", 6 ) + && strncasecmp( rpc_url, "stratum+ssl://", 14 ) + && strncasecmp( rpc_url, "stratum+tcps://", 15 ) ) + flags &= ~CURL_GLOBAL_SSL; + + if ( curl_global_init( flags ) ) + { + applog(LOG_ERR, "CURL initialization failed"); + return 1; + } + + if ( is_root() ) + applog( LOG_NOTICE, "Running cpuminer as Superuser is discouraged."); + +#ifndef WIN32 + if (opt_background) + { + i = fork(); + if (i < 0) exit(1); + if (i > 0) exit(0); + i = setsid(); + if (i < 0) + applog(LOG_ERR, "setsid() failed (errno = %d)", errno); + i = chdir("/"); + if (i < 0) + applog(LOG_ERR, "chdir() failed (errno = %d)", errno); + signal(SIGHUP, signal_handler); + signal(SIGTERM, signal_handler); + } + /* Always catch Ctrl+C */ + signal(SIGINT, signal_handler); +#else + SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE); + if (opt_background) + { + HWND hcon = GetConsoleWindow(); + if (hcon) { + // this method also hide parent command line window + ShowWindow(hcon, SW_HIDE); + } else { + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + CloseHandle(h); + FreeConsole(); + } + } + if (opt_priority > 0) + { + DWORD prio = NORMAL_PRIORITY_CLASS; + switch (opt_priority) + { + case 1: + prio = BELOW_NORMAL_PRIORITY_CLASS; + break; + case 3: + prio = ABOVE_NORMAL_PRIORITY_CLASS; + break; + case 4: + prio = HIGH_PRIORITY_CLASS; + break; + case 5: + prio = REALTIME_PRIORITY_CLASS; + } + SetPriorityClass(GetCurrentProcess(), prio); + } +#endif + +#if defined(WIN32) + +#if defined(_WIN32_WINNT) + if (opt_debug) + applog( LOG_INFO, "_WIN232_WINNT = 0x%04x", _WIN32_WINNT ); +#else + if (opt_debug) + applog( LOG_INFO, "_WIN232_WINNT undefined." ); +#endif +#if defined(WINDOWS_CPU_GROUPS_ENABLED) + if ( opt_debug || ( !opt_quiet && num_cpugroups > 1 ) ) + applog( LOG_INFO, "Found %d CPUs in %d groups", + num_cpus, num_cpugroups ); +#endif + +#endif + + conditional_state = malloc( opt_n_threads * ((sizeof(bool)) ) ); + memset( conditional_state, 0, opt_n_threads * ((sizeof(bool)) ) ); + + const int map_size = opt_n_threads < num_cpus ? num_cpus : opt_n_threads; + thread_affinity_map = malloc( map_size * (sizeof (int)) ); + if ( !thread_affinity_map ) + { + applog( LOG_ERR, "CPU Affinity disabled, memory allocation failed" ); + opt_affinity = 0ULL; + } + if ( opt_affinity ) + { + int active_cpus = 0; // total CPUs available using rolling affinity mask + for ( int thr = 0, cpu = 0; thr < map_size; thr++, cpu++ ) + { + while ( !( ( opt_affinity >> ( cpu & 63 ) ) & 1ULL ) ) cpu++; + thread_affinity_map[ thr ] = cpu % num_cpus; + if ( cpu < num_cpus ) active_cpus++; + } + if ( opt_n_threads > active_cpus ) + applog( LOG_WARNING, "More miner threads (%d) than active CPUs in affinity mask (%d)", opt_n_threads, active_cpus ); + if ( !opt_quiet ) + { + char affinity_mask[64]; + format_affinity_mask( affinity_mask, opt_affinity ); + applog( LOG_INFO, "CPU affinity [%s]", affinity_mask ); + } + } + +#ifdef HAVE_SYSLOG_H + if (use_syslog) + openlog("cpuminer", LOG_PID, LOG_USER); +#endif + + work_restart = (struct work_restart*) calloc(opt_n_threads, sizeof(*work_restart)); + if (!work_restart) + return 1; + thr_info = (struct thr_info*) calloc(opt_n_threads + 4, sizeof(*thr)); + if (!thr_info) + return 1; + thr_hashrates = (double *) calloc(opt_n_threads, sizeof(double)); + if (!thr_hashrates) + return 1; + + /* init workio thread info */ + work_thr_id = opt_n_threads; + thr = &thr_info[work_thr_id]; + thr->id = work_thr_id; + thr->q = tq_new(); + if (!thr->q) + return 1; + + if ( rpc_pass && rpc_user ) + opt_stratum_stats = ( strstr( rpc_pass, "stats" ) != NULL ) + || ( strcmp( rpc_user, "benchmark" ) == 0 ); + + /* start work I/O thread */ + if (thread_create(thr, workio_thread)) + { + applog(LOG_ERR, "work thread create failed"); + return 1; + } + + /* ESET-NOD32 Detects these 2 thread_create... */ + if (want_longpoll && !have_stratum) + { + if ( opt_debug ) + applog(LOG_INFO,"Creating long poll thread"); + + /* init longpoll thread info */ + longpoll_thr_id = opt_n_threads + 1; + thr = &thr_info[longpoll_thr_id]; + thr->id = longpoll_thr_id; + thr->q = tq_new(); + if (!thr->q) + return 1; + /* start longpoll thread */ + err = thread_create(thr, longpoll_thread); + if (err) { + applog(LOG_ERR, "Long poll thread create failed"); + return 1; + } + } + + if ( have_stratum ) + { + if ( opt_debug ) + applog(LOG_INFO,"Creating stratum thread"); + + stratum.new_job = false; // just to make sure + + /* init stratum thread info */ + stratum_thr_id = opt_n_threads + 2; + thr = &thr_info[stratum_thr_id]; + thr->id = stratum_thr_id; + thr->q = tq_new(); + if (!thr->q) + return 1; + /* start stratum thread */ + err = thread_create(thr, stratum_thread); + if (err) + { + applog(LOG_ERR, "Stratum thread create failed"); + return 1; + } + if (have_stratum) + tq_push(thr_info[stratum_thr_id].q, strdup(rpc_url)); + } + + if ( opt_api_enabled ) + { + if ( opt_debug ) + applog(LOG_INFO,"Creating API thread"); + + /* api thread */ + api_thr_id = opt_n_threads + 3; + thr = &thr_info[api_thr_id]; + thr->id = api_thr_id; + thr->q = tq_new(); + if (!thr->q) + return 1; + err = thread_create( thr, api_thread ); + if ( err ) + { + applog( LOG_ERR, "API thread create failed" ); + return 1; + } + if ( !opt_quiet ) + applog( LOG_INFO,"API listening to %s:%d", opt_api_allow, + opt_api_listen ); + } + + // hold the stats lock while starting miner threads + pthread_mutex_lock( &stats_lock ); + + /* start mining threads */ + for ( i = 0; i < opt_n_threads; i++ ) + { +// usleep( 5000 ); + thr = &thr_info[i]; + thr->id = i; + thr->q = tq_new(); + if ( !thr->q ) + return 1; + err = thread_create( thr, miner_thread ); + if ( err ) + { + applog( LOG_ERR, "Miner thread %d create failed", i ); + return 1; + } + } + + // Initialize stats timers and counters + memset( share_stats, 0, s_stats_size * sizeof (struct share_stats_t) ); + gettimeofday( &last_submit_time, NULL ); + memcpy( &five_min_start, &last_submit_time, sizeof (struct timeval) ); + memcpy( &session_start, &last_submit_time, sizeof (struct timeval) ); + memcpy( &stratum_keepalive_timer, &last_submit_time, sizeof (struct timeval) ); + memcpy( &stratum_reset_time, &last_submit_time, sizeof (struct timeval) ); + memcpy( &total_hashes_time, &last_submit_time, sizeof (struct timeval) ); + pthread_mutex_unlock( &stats_lock ); + + applog( LOG_INFO, "%d of %d miner threads started using '%s' algorithm", + opt_n_threads, num_cpus, algo_names[opt_algo] ); + + /* main loop - simply wait for workio thread to exit */ + pthread_join( thr_info[work_thr_id].pth, NULL ); + applog( LOG_WARNING, "workio thread dead, exiting." ); + return 0; +} diff --git a/rin/miner/cpuminer/cpuminer.1 b/rin/miner/cpuminer/cpuminer.1 new file mode 100644 index 0000000..581be77 --- /dev/null +++ b/rin/miner/cpuminer/cpuminer.1 @@ -0,0 +1,225 @@ +.TH CPUMINER 1 "May 2014" "cpuminer 2.4" +.SH NAME +cpuminer \- CPU miner for Bitcoin and Litecoin +.SH SYNOPSIS +.B cpuminer +[\fIOPTION\fR]... +.SH DESCRIPTION +.B cpuminer +is a multi-threaded CPU miner for Bitcoin, Litecoin and other cryptocurrencies. +It supports the getwork and getblocktemplate (BIP 22) methods, +as well as the Stratum mining protocol. +.PP +In its normal mode of operation, \fBcpuminer\fR connects to a mining server +(specified with the \fB\-o\fR option), receives work from it and starts hashing. +As soon as a solution is found, it is submitted to the same mining server, +which can accept or reject it. +When using getwork or getblocktemplate, +\fBcpuminer\fR can take advantage of long polling, if the server supports it; +in any case, fresh work is fetched as needed. +When using the Stratum protocol this is not possible, +and the server is responsible for sending fresh work at least every minute; +if it fails to do so, +\fBcpuminer\fR may drop the connection and try reconnecting again. +.PP +By default, \fBcpuminer\fR writes all its messages to standard error. +On systems that have a syslog, the \fB\-\-syslog\fR option can be used +to write to it instead. +.PP +On start, the nice value of all miner threads is set to 19. +On Linux, the scheduling policy is also changed to SCHED_IDLE, +or to SCHED_BATCH if that fails. +On multiprocessor systems, \fBcpuminer\fR +automatically sets the CPU affinity of miner threads +if the number of threads is a multiple of the number of processors. +.SH EXAMPLES +To connect to a Litecoin mining pool that provides a Stratum server +at example.com on port 3333, authenticating as worker "foo" with password "bar": +.PP +.nf +.RS +cpuminer \-o stratum+tcp://example.com:3333 \-O foo:bar +.RE +.fi +.PP +To mine to a local Bitcoin testnet instance running on port 18332, +authenticating with username "rpcuser" and password "rpcpass": +.PP +.nf +.RS +cpuminer \-a sha256d \-o http://localhost:18332 \-O rpcuser:rpcpass \\ + \-\-coinbase\-addr=mpXwg4jMtRhuSpVq4xS3HFHmCmWp9NyGKt +.RE +.fi +.PP +To connect to a Litecoin P2Pool node running on my.server on port 9327, +mining in the background and having output sent to the syslog facility, +omitting the per-thread hashmeter output: +.PP +.nf +.RS +cpuminer \-BSq \-o http://my.server:9327 +.RE +.fi +.SH OPTIONS +.TP +\fB\-a\fR, \fB\-\-algo\fR=\fIALGORITHM\fR +Set the hashing algorithm to use. +Default is scrypt. +Possible values are: +.RS 11 +.TP 10 +.B scrypt +scrypt(1024, 1, 1) (used by Litecoin) +.TP +.B scrypt:\fIN\fR +scrypt(\fIN\fR, 1, 1) (\fIN\fR must be a power of 2 greater than 1) +.TP +.B sha256d +SHA-256d (used by Bitcoin) +.RE +.TP +\fB\-\-benchmark\fR +Run in offline benchmark mode. +.TP +\fB\-B\fR, \fB\-\-background\fR +Run in the background as a daemon. +.TP +\fB\-\-cert\fR=\fIFILE\fR +Set an SSL certificate to use with the mining server. +Only supported when using the HTTPS protocol. +.TP +\fB\-\-coinbase\-addr\fR=\fIADDRESS\fR +Set a payout address for solo mining. +This is only used in getblocktemplate mode, +and only if the server does not provide a coinbase transaction. +.TP +\fB\-\-coinbase\-sig\fR=\fITEXT\fR +Set a string to be included in the coinbase (if allowed by the server). +This is only used in getblocktemplate mode. +.TP +\fB\-c\fR, \fB\-\-config\fR=\fIFILE\fR +Load options from a configuration file. +\fIFILE\fR must contain a JSON object +mapping long options to their arguments (as strings), +or to \fBtrue\fR if no argument is required. +Sample configuration file: + +.nf + { + "url": "stratum+tcp://example.com:3333", + "userpass": "foo:bar", + "retry-pause": "10", + "quiet": true + } +.fi +.TP +\fB\-D\fR, \fB\-\-debug\fR +Enable debug output. +.TP +\fB\-h\fR, \fB\-\-help\fR +Print a help message and exit. +.TP +\fB\-\-no\-gbt\fR +Do not use the getblocktemplate RPC method. +.TP +\fB\-\-no\-getwork\fR +Do not use the getwork RPC method. +.TP +\fB\-\-no\-longpoll\fR +Do not use long polling. +.TP +\fB\-\-no\-redirect\fR +Ignore requests from the server to switch to a different URL. +.TP +\fB\-\-no\-stratum\fR +Do not switch to Stratum, even if the server advertises support for it. +.TP +\fB\-o\fR, \fB\-\-url\fR=[\fISCHEME\fR://][\fIUSERNAME\fR[:\fIPASSWORD\fR]@]\fIHOST\fR:\fIPORT\fR[/\fIPATH\fR] +Set the URL of the mining server to connect to. +Supported schemes are \fBhttp\fR, \fBhttps\fR and \fBstratum+tcp\fR. +If no scheme is specified, http is assumed. +Specifying a \fIPATH\fR is only supported for HTTP and HTTPS. +Specifying credentials has the same effect as using the \fB\-O\fR option. + +By default, on HTTP and HTTPS, +the miner tries to use the getblocktemplate RPC method, +and falls back to using getwork if getblocktemplate is unavailable. +This behavior can be modified by using the \fB\-\-no\-gbt\fR +and \fB\-\-no\-getwork\fR options. +.TP +\fB\-O\fR, \fB\-\-userpass\fR=\fIUSERNAME\fR:\fIPASSWORD\fR +Set the credentials to use for connecting to the mining server. +Any value previously set with \fB\-u\fR or \fB\-p\fR is discarded. +.TP +\fB\-p\fR, \fB\-\-pass\fR=\fIPASSWORD\fR +Set the password to use for connecting to the mining server. +Any password previously set with \fB\-O\fR is discarded. +.TP +\fB\-P\fR, \fB\-\-protocol\-dump\fR +Enable output of all protocol-level activities. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Disable per-thread hashmeter output. +.TP +\fB\-r\fR, \fB\-\-retries\fR=\fIN\fR +Set the maximum number of times to retry if a network call fails. +If not specified, the miner will retry indefinitely. +.TP +\fB\-R\fR, \fB\-\-retry\-pause\fR=\fISECONDS\fR +Set how long to wait between retries. Default is 30 seconds. +.TP +\fB\-s\fR, \fB\-\-scantime\fR=\fISECONDS\fR +Set an upper bound on the time the miner can go without fetching fresh work. +This setting has no effect in Stratum mode or when long polling is activated. +Default is 5 seconds. +.TP +\fB\-S\fR, \fB\-\-syslog\fR +Log to the syslog facility instead of standard error. +.TP +\fB\-t\fR, \fB\-\-threads\fR=\fIN\fR +Set the number of miner threads. +If not specified, the miner will try to detect the number of available processors +and use that. +.TP +\fB\-T\fR, \fB\-\-timeout\fR=\fISECONDS\fR +Set a timeout for long polling. +.TP +\fB\-u\fR, \fB\-\-user\fR=\fIUSERNAME\fR +Set the username to use for connecting to the mining server. +Any username previously set with \fB\-O\fR is discarded. +.TP +\fB\-V\fR, \fB\-\-version\fR +Display version information and quit. +.TP +\fB\-x\fR, \fB\-\-proxy\fR=[\fISCHEME\fR://][\fIUSERNAME\fR:\fIPASSWORD\fR@]\fIHOST\fR:\fIPORT\fR +Connect to the mining server through a proxy. +Supported schemes are: \fBhttp\fR, \fBsocks4\fR, \fBsocks5\fR. +Since libcurl 7.18.0, the following are also supported: +\fBsocks4a\fR, \fBsocks5h\fR (SOCKS5 with remote name resolving). +If no scheme is specified, the proxy is treated as an HTTP proxy. +.SH ENVIRONMENT +The following environment variables can be specified in lower case or upper case; +the lower-case version has precedence. \fBhttp_proxy\fR is an exception +as it is only available in lower case. +.PP +.RS +.TP +\fBhttp_proxy\fR [\fISCHEME\fR://]\fIHOST\fR:\fIPORT\fR +Sets the proxy server to use for HTTP. +.TP +\fBHTTPS_PROXY\fR [\fISCHEME\fR://]\fIHOST\fR:\fIPORT\fR +Sets the proxy server to use for HTTPS. +.TP +\fBALL_PROXY\fR [\fISCHEME\fR://]\fIHOST\fR:\fIPORT\fR +Sets the proxy server to use if no protocol-specific proxy is set. +.RE +.PP +Using an environment variable to set the proxy has the same effect as +using the \fB\-x\fR option. +.SH AUTHOR +This variant is maintained by tpruvot@github. + +Most of the code in the current version of cpuminer was written by +Pooler with contributions from others. +The original minerd was written by Jeff Garzik . diff --git a/rin/miner/cpuminer/dummy.cpp b/rin/miner/cpuminer/dummy.cpp new file mode 100644 index 0000000..3113954 --- /dev/null +++ b/rin/miner/cpuminer/dummy.cpp @@ -0,0 +1,6 @@ +// This file exists to force the use of g++ as the linker which in turn +// links the math library with the inclusion of math.h. gcc will not +// automatically link math. Without this file linking will fail for m7m.c. +// Linking math manually, allowing gcc to do the linking work on Linux +// but on Windows it segfaults. Until that is solved this file must continue +// to exist. diff --git a/rin/miner/cpuminer/elist.h b/rin/miner/cpuminer/elist.h new file mode 100644 index 0000000..d4c85dc --- /dev/null +++ b/rin/miner/cpuminer/elist.h @@ -0,0 +1,254 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *nlh, + struct list_head *prev, + struct list_head *next) +{ + next->prev = nlh; + nlh->next = next; + nlh->prev = prev; + prev->next = nlh; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *nlh, struct list_head *head) +{ + __list_add(nlh, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *nlh, struct list_head *head) +{ + __list_add(nlh, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head *prev, struct list_head *next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = NULL; + entry->prev = NULL; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); \ + pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * @type: the type of the struct. + */ +#define list_for_each_entry(pos, head, member, type) \ + for (pos = list_entry((head)->next, type, member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, type, member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * @type: the type of the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member, type) \ + for (pos = list_entry((head)->next, type, member), \ + n = list_entry(pos->member.next, type, member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, type, member)) + +/** + * list_for_each_entry_continue - iterate over list of given type + * continuing after existing point + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * @type: the type of the struct. + */ +#define list_for_each_entry_continue(pos, head, member, type) \ + for (pos = list_entry(pos->member.next, type, member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, type, member), \ + prefetch(pos->member.next)) + +#endif diff --git a/rin/miner/cpuminer/libbrotlicommon.dll b/rin/miner/cpuminer/libbrotlicommon.dll new file mode 100644 index 0000000..6e49a79 Binary files /dev/null and b/rin/miner/cpuminer/libbrotlicommon.dll differ diff --git a/rin/miner/cpuminer/libbrotlidec.dll b/rin/miner/cpuminer/libbrotlidec.dll new file mode 100644 index 0000000..c67e14b Binary files /dev/null and b/rin/miner/cpuminer/libbrotlidec.dll differ diff --git a/rin/miner/cpuminer/libcrypto-3-x64.dll b/rin/miner/cpuminer/libcrypto-3-x64.dll new file mode 100644 index 0000000..6fc26c9 Binary files /dev/null and b/rin/miner/cpuminer/libcrypto-3-x64.dll differ diff --git a/rin/miner/cpuminer/libcurl-4.dll b/rin/miner/cpuminer/libcurl-4.dll new file mode 100644 index 0000000..db3eab0 Binary files /dev/null and b/rin/miner/cpuminer/libcurl-4.dll differ diff --git a/rin/miner/cpuminer/libgcc_s_seh-1.dll b/rin/miner/cpuminer/libgcc_s_seh-1.dll new file mode 100644 index 0000000..dceee9e Binary files /dev/null and b/rin/miner/cpuminer/libgcc_s_seh-1.dll differ diff --git a/rin/miner/cpuminer/libgmp-10.dll b/rin/miner/cpuminer/libgmp-10.dll new file mode 100644 index 0000000..a30b8e9 Binary files /dev/null and b/rin/miner/cpuminer/libgmp-10.dll differ diff --git a/rin/miner/cpuminer/libiconv-2.dll b/rin/miner/cpuminer/libiconv-2.dll new file mode 100644 index 0000000..34abf65 Binary files /dev/null and b/rin/miner/cpuminer/libiconv-2.dll differ diff --git a/rin/miner/cpuminer/libidn2-0.dll b/rin/miner/cpuminer/libidn2-0.dll new file mode 100644 index 0000000..37d6269 Binary files /dev/null and b/rin/miner/cpuminer/libidn2-0.dll differ diff --git a/rin/miner/cpuminer/libintl-8.dll b/rin/miner/cpuminer/libintl-8.dll new file mode 100644 index 0000000..2aed7ad Binary files /dev/null and b/rin/miner/cpuminer/libintl-8.dll differ diff --git a/rin/miner/cpuminer/libnghttp2-14.dll b/rin/miner/cpuminer/libnghttp2-14.dll new file mode 100644 index 0000000..da402cb Binary files /dev/null and b/rin/miner/cpuminer/libnghttp2-14.dll differ diff --git a/rin/miner/cpuminer/libpsl-5.dll b/rin/miner/cpuminer/libpsl-5.dll new file mode 100644 index 0000000..74ed804 Binary files /dev/null and b/rin/miner/cpuminer/libpsl-5.dll differ diff --git a/rin/miner/cpuminer/libssh2-1.dll b/rin/miner/cpuminer/libssh2-1.dll new file mode 100644 index 0000000..32f472d Binary files /dev/null and b/rin/miner/cpuminer/libssh2-1.dll differ diff --git a/rin/miner/cpuminer/libssl-3-x64.dll b/rin/miner/cpuminer/libssl-3-x64.dll new file mode 100644 index 0000000..64f4c17 Binary files /dev/null and b/rin/miner/cpuminer/libssl-3-x64.dll differ diff --git a/rin/miner/cpuminer/libunistring-5.dll b/rin/miner/cpuminer/libunistring-5.dll new file mode 100644 index 0000000..95815c4 Binary files /dev/null and b/rin/miner/cpuminer/libunistring-5.dll differ diff --git a/rin/miner/cpuminer/libwinpthread-1.dll b/rin/miner/cpuminer/libwinpthread-1.dll new file mode 100644 index 0000000..362cfc0 Binary files /dev/null and b/rin/miner/cpuminer/libwinpthread-1.dll differ diff --git a/rin/miner/cpuminer/libzstd.dll b/rin/miner/cpuminer/libzstd.dll new file mode 100644 index 0000000..d59a28d Binary files /dev/null and b/rin/miner/cpuminer/libzstd.dll differ diff --git a/rin/miner/cpuminer/malloc-huge.c b/rin/miner/cpuminer/malloc-huge.c new file mode 100644 index 0000000..75c0165 --- /dev/null +++ b/rin/miner/cpuminer/malloc-huge.c @@ -0,0 +1,36 @@ +#include "malloc-huge.h" +#include "miner.h" + +#define HUGEPAGE_SIZE_2M (2 * 1024 * 1024) + +void *malloc_hugepages( size_t size ) +{ +#if !(defined(MAP_HUGETLB) && defined(MAP_ANON)) +// applog( LOG_WARNING, "Huge pages not available",size); + return NULL; +#else + + if ( size < HUGEPAGE_MIN_ALLOC ) + { +// applog( LOG_WARNING, "Block too small for huge pages: %lu bytes",size); + return NULL; + } + + const size_t hugepage_mask = (size_t)HUGEPAGE_SIZE_2M - 1; + void *p = NULL; + int flags = + #ifdef MAP_NOCORE + MAP_NOCORE | + #endif + MAP_HUGETLB | MAP_ANON | MAP_PRIVATE; + + // round size up to next page boundary + size = ( size + hugepage_mask ) & (~hugepage_mask); + + p = mmap( NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0 ); + if ( p == MAP_FAILED ) + p = NULL; + return p; +#endif +} + diff --git a/rin/miner/cpuminer/malloc-huge.h b/rin/miner/cpuminer/malloc-huge.h new file mode 100644 index 0000000..371e09a --- /dev/null +++ b/rin/miner/cpuminer/malloc-huge.h @@ -0,0 +1,24 @@ +#if !(defined(MALLOC_HUGE__)) +#define MALLOC_HUGE__ + +#include +#include +#include +#include + +#ifdef __unix__ +#include +#endif + +#if defined(MAP_HUGETLB) + +// Minimum block size 6 MiB to use huge pages +#define HUGEPAGE_MIN_ALLOC (6 * 1024 * 1024) + +#endif + +// Attempt to allocate memory backed by 2 MiB pages, returns NULL on failure. +void *malloc_hugepages( size_t size ); + +#endif + diff --git a/rin/miner/cpuminer/miner-coin.bat b/rin/miner/cpuminer/miner-coin.bat new file mode 100644 index 0000000..20537e3 --- /dev/null +++ b/rin/miner/cpuminer/miner-coin.bat @@ -0,0 +1,3 @@ +:start +cpuminer.exe -a rinhash -o stratum+tcps://stratum-eu.rplant.xyz:17148 -u rin1qvj0yyt9phvled9kxflju3p687a4s7kareglpk5.dd +goto start diff --git a/rin/miner/cpuminer/miner.h b/rin/miner/cpuminer/miner.h new file mode 100644 index 0000000..ccd1bf3 --- /dev/null +++ b/rin/miner/cpuminer/miner.h @@ -0,0 +1,1057 @@ +#ifndef MINER_H__ +#define MINER_H__ + +#include + +// CPU architecture +#if defined(__x86_64__) + #define USER_AGENT_ARCH "x64" // Intel, AMD x86_64 +#elif defined(__aarch64__) + #define USER_AGENT_ARCH "arm" // AArch64 +//#elif +// #define USER_AGENT_ARCH "r5" // RISC-V +#else + #define USER_AGENT_ARCH +#endif + +// Operating system +// __APPLE__ includes MacOS & IOS, no MacOS only macros found. +#if defined(__linux) + #define USER_AGENT_OS "L" // GNU Linux +#elif defined(WIN32) + #define USER_AGENT_OS "W" // MS Windows +#elif defined(__APPLE__) + #define USER_AGENT_OS "M" // Apple MacOS +#elif defined(__bsd__) || defined(__unix__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + #define USER_AGENT_OS "U" // BSD unix +#else + #define USER_AGENT_OS +#endif + +#define USER_AGENT PACKAGE_NAME "-" PACKAGE_VERSION "-" USER_AGENT_ARCH USER_AGENT_OS + +/* +#ifdef _MSC_VER + +#undef USE_ASM +#ifdef NOASM +#undef USE_ASM +#endif + +#if defined(_M_X64) +#define __i386__ 1 +#define __x86_64__ 1 +#elif defined(_M_X86) +#define __i386__ 1 +#endif + +#endif +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif + +// no mm_maloc for Neon +#if !defined(__ARM_NEON) + +#include + +#define mm_malloc( nbytes, alignment ) _mm_malloc( nbytes, alignment ) +#define mm_free _mm_free + +#else + +#define mm_malloc( nbytes, alignment ) malloc( nbytes ) +#define mm_free free + +#endif + +//TODO for windows +static inline bool is_root() +{ +#if defined(WIN32) + return false; +#else + return !getuid(); +#endif +} + +/* +#ifndef min +#define min(a,b) (a>b ? (b) :(a)) +#endif +#ifndef max +#define max(a,b) (a +//#elif !defined alloca +# ifdef __GNUC__ +//# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +//#endif + +// keyboard beep +static const char ASCII_BELL = '\a'; + +#ifdef HAVE_SYSLOG_H +#include +#define LOG_BLUE 0x10 /* unique value */ +#define LOG_MAJR 0x11 /* unique value */ +#define LOG_MINR 0x12 /* unique value */ +#define LOG_GREEN 0x13 /* unique value */ +#define LOG_PINK 0x14 /* unique value */ +#else +enum { + LOG_CRIT, + LOG_ERR, + LOG_WARNING, + LOG_NOTICE, + LOG_INFO, + LOG_DEBUG, + /* custom notices */ + LOG_BLUE = 0x10, + LOG_MAJR = 0x11, + LOG_MINR = 0x12, + LOG_GREEN = 0x13, + LOG_PINK = 0x14 }; +#endif + +#define WORK_ALIGNMENT 64 + +// When working with dynamically allocated memory to guarantee data alignment +// for large vectors. Physical block size must be extended by alignment number +// of bytes when allocated. free() should use the physical pointer returned by +// malloc(), not the aligned pointer. All others shoujld use the logical, +// aligned, pointer returned by this function. +static inline void *align_ptr( const void *ptr, const uint64_t alignment ) +{ + const uint64_t mask = alignment - 1; + return (void*)( ( ((const uint64_t)ptr) + mask ) & (~mask) ); +} + +extern bool is_power_of_2( int n ); + +static inline bool is_windows(void) +{ +#ifdef WIN32 + return true; +#else + return false; +#endif +} + +#include "compat.h" + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + +// deprecated, see simd-int.h +#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +#define WANT_BUILTIN_BSWAP +/* +#else +#define bswap_32(x) ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) \ + | (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu)) +*/ +#endif + +static inline uint32_t swab32(uint32_t x) +{ +#ifdef WANT_BUILTIN_BSWAP + return __builtin_bswap32(x); +#else + return ( ( (x) << 24 ) & 0xff000000u ) | ( ( (x) << 8 ) & 0x00ff0000u ) + | ( ( (x) >> 8 ) & 0x0000ff00u ) | ( ( (x) >> 24 ) & 0x000000ffu ); + + +// return bswap_32(v); +#endif +} + +// Swap any two variables of the same type without using a temp +#define swap_vars(a,b) a^=b; b^=a; a^=b; + +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +typedef unsigned char uchar; + +#if !HAVE_DECL_BE32DEC +static inline uint32_t be32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); +} +#endif + +#if !HAVE_DECL_LE32DEC +static inline uint32_t le32dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) + + ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24)); +} +#endif + +#if !HAVE_DECL_BE32ENC +static inline void be32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[3] = x & 0xff; + p[2] = (x >> 8) & 0xff; + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; +} +#endif + +// This is a poorman's SIMD instruction, use 64 bit instruction to encode 2 +// uint32_t. This function flips endian on two adjacent 32 bit quantities +// aligned to 64 bits. If source is LE output is BE, and vice versa. +static inline void swab32_x2( uint64_t* dst, uint64_t src ) +{ + *dst = ( ( src & 0xff000000ff000000 ) >> 24 ) + | ( ( src & 0x00ff000000ff0000 ) >> 8 ) + | ( ( src & 0x0000ff000000ff00 ) << 8 ) + | ( ( src & 0x000000ff000000ff ) << 24 ); +} + +static inline void swab32_array( uint32_t* dst_p, uint32_t* src_p, int n ) +{ + for ( int i = 0; i < n/2; i++ ) + swab32_x2( &((uint64_t*)dst_p)[i], ((uint64_t*)src_p)[i] ); +} + +#if !HAVE_DECL_LE32ENC +static inline void le32enc(void *pp, uint32_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; +} +#endif + +#if !HAVE_DECL_LE16DEC +static inline uint16_t le16dec(const void *pp) +{ + const uint8_t *p = (uint8_t const *)pp; + return ((uint16_t)(p[0]) + ((uint16_t)(p[1]) << 8)); +} +#endif + +#if !HAVE_DECL_LE16ENC +static inline void le16enc(void *pp, uint16_t x) +{ + uint8_t *p = (uint8_t *)pp; + p[0] = x & 0xff; + p[1] = (x >> 8) & 0xff; +} +#endif + +#if JANSSON_MAJOR_VERSION >= 2 +#define JSON_LOADS(str, err_ptr) json_loads(str, 0, err_ptr) +#define JSON_LOADF(path, err_ptr) json_load_file(path, 0, err_ptr) +#else +#define JSON_LOADS(str, err_ptr) json_loads(str, err_ptr) +#define JSON_LOADF(path, err_ptr) json_load_file(path, err_ptr) +#endif + +json_t* json_load_url(char* cfg_url, json_error_t *err); + +struct work; + +void work_free(struct work *w); +void work_copy(struct work *dest, const struct work *src); + + + +/* api related */ +void *api_thread(void *userdata); + +struct cpu_info { + int thr_id; + int accepted; + int rejected; + double khashes; + bool has_monitoring; + float cpu_temp; + int cpu_fan; + uint32_t cpu_clock; +}; + +struct thr_api { + int id; + pthread_t pth; + struct thread_q *q; +}; +/* end of api */ + + +#define JSON_RPC_LONGPOLL (1 << 0) +#define JSON_RPC_QUIET_404 (1 << 1) +#define JSON_RPC_IGNOREERR (1 << 2) + +#define JSON_BUF_LEN 512 + +#define CL_N "\x1B[0m" +#define CL_RED "\x1B[31m" +#define CL_GRN "\x1B[32m" +#define CL_YLW "\x1B[33m" // dark yellow +#define CL_BLU "\x1B[34m" +#define CL_MAG "\x1B[35m" // purple +#define CL_CYN "\x1B[36m" + +#define CL_BLK "\x1B[22;30m" /* black */ +#define CL_RD2 "\x1B[22;31m" /* red */ +#define CL_GR2 "\x1B[22;32m" /* green */ +#define CL_BRW "\x1B[22;33m" /* brown */ +#define CL_BL2 "\x1B[22;34m" /* blue */ +#define CL_MA2 "\x1B[22;35m" /* purple */ +#define CL_CY2 "\x1B[22;36m" /* cyan */ +#define CL_SIL "\x1B[22;37m" /* gray */ + +#ifdef WIN32 +#define CL_GRY "\x1B[01;30m" /* dark gray */ +#else +#define CL_GRY "\x1B[90m" /* dark gray selectable in putty */ +#endif +#define CL_LRD "\x1B[01;31m" /* bright red */ +#define CL_LGR "\x1B[01;32m" /* bright green */ +#define CL_YL2 "\x1B[01;33m" /* bright yellow */ +#define CL_LBL "\x1B[01;34m" /* light blue */ +#define CL_LMA "\x1B[01;35m" /* light magenta */ +#define CL_LCY "\x1B[01;36m" /* light cyan */ + +#define CL_WHT "\x1B[01;37m" /* white */ + +void applog(int prio, const char *fmt, ...); +void applog2(int prio, const char *fmt, ...); +void applog_nl( const char *fmt, ... ); +void restart_threads(void); +extern json_t *json_rpc_call( CURL *curl, const char *url, const char *userpass, + const char *rpc_req, int *curl_err, int flags ); +extern void cbin2hex(char *out, const char *in, size_t len); +void bin2hex( char *s, const unsigned char *p, size_t len ); +char *abin2hex( const unsigned char *p, size_t len ); +char *bebin2hex( const unsigned char *p, size_t len ); +bool hex2bin( unsigned char *p, const char *hexstr, const size_t len ); +bool jobj_binary( const json_t *obj, const char *key, void *buf, + size_t buflen ); +int varint_encode( unsigned char *p, uint64_t n ); +size_t address_to_script( unsigned char *out, size_t outsz, const char *addr ); +int timeval_subtract( struct timeval *result, struct timeval *x, + struct timeval *y); + +// Segwit BEGIN +extern void memrev(unsigned char *p, size_t len); +// Segwit END + +// Bitcoin formula for converting difficulty to an equivalent +// number of hashes. +// +// https://en.bitcoin.it/wiki/Difficulty +// hash = diff * 2**32 + +#define EXP16 65536. +#define EXP32 4294967296. +extern const long double exp32; // 2**32 +extern const long double exp48; // 2**48 +extern const long double exp64; // 2**64 +extern const long double exp96; // 2**96 +extern const long double exp128; // 2**128 +extern const long double exp160; // 2**160 + +bool fulltest( const uint32_t *hash, const uint32_t *target ); +bool valid_hash( const void*, const void* ); + +extern double hash_to_diff( const void* ); +extern void diff_to_hash( uint32_t*, const double ); +extern double nbits_to_diff( uint32_t ); + +double hash_target_ratio( uint32_t* hash, uint32_t* target ); +void work_set_target_ratio( struct work* work, const void *hash ); + +struct thr_info { + int id; + pthread_t pth; + pthread_attr_t attr; + struct thread_q *q; + struct cpu_info cpu; +}; + +//int test_hash_and_submit( struct work *work, const void *hash, +// struct thr_info *thr ); + +bool submit_solution( struct work *work, const void *hash, + struct thr_info *thr ); + +void get_currentalgo( char* buf, int sz ); +/* +bool has_sha(); +bool has_aes_ni(); +bool has_avx1(); +bool has_avx2(); +bool has_avx512f(); +bool has_sse2(); +bool has_xop(); +bool has_fma3(); +bool has_sse42(); +bool has_sse(); +void cpu_bestfeature( char *outbuf, size_t maxsz ); +void cpu_getname(char *outbuf, size_t maxsz); +void cpu_getmodelid(char *outbuf, size_t maxsz); +void cpu_brand_string( char* s ); + +float cpu_temp( int core ); +*/ + +struct work +{ + uint32_t target[8] __attribute__ ((aligned (64))); + uint32_t data[48] __attribute__ ((aligned (64))); + double targetdiff; + double sharediff; + double stratum_diff; + int height; + char *txs; + int tx_count; + char *workid; + char *job_id; + size_t xnonce2_len; + unsigned char *xnonce2; + bool sapling; + bool stale; +} __attribute__ ((aligned (WORK_ALIGNMENT))); + +struct stratum_job +{ + unsigned char prevhash[32]; + unsigned char final_sapling_hash[32]; + char *job_id; + size_t coinbase_size; + unsigned char *coinbase; + unsigned char *xnonce2; + int merkle_count; + int merkle_buf_size; + unsigned char **merkle; + unsigned char version[4]; + unsigned char nbits[4]; + unsigned char ntime[4]; + double diff; + bool clean; + // for x16rt-veil + unsigned char extra[64]; + unsigned char denom10[32]; + unsigned char denom100[32]; + unsigned char denom1000[32]; + unsigned char denom10000[32]; + unsigned char proofoffullnode[32]; + +} __attribute__ ((aligned (64))); + +struct stratum_ctx { + char *url; + + CURL *curl; + char *curl_url; + char curl_err_str[CURL_ERROR_SIZE]; + curl_socket_t sock; + size_t sockbuf_size; + char *sockbuf; + pthread_mutex_t sock_lock; + + double next_diff; + double sharediff; + + char *session_id; + size_t xnonce1_size; + unsigned char *xnonce1; + size_t xnonce2_size; + struct stratum_job job; + struct work work __attribute__ ((aligned (64))); + pthread_mutex_t work_lock; + + int block_height; + bool new_job; +} __attribute__ ((aligned (64))); + +bool stratum_socket_full(struct stratum_ctx *sctx, int timeout); +bool stratum_send_line(struct stratum_ctx *sctx, char *s); +char *stratum_recv_line(struct stratum_ctx *sctx); +bool stratum_connect(struct stratum_ctx *sctx, const char *url); +void stratum_disconnect(struct stratum_ctx *sctx); +bool stratum_subscribe(struct stratum_ctx *sctx); +bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass); +bool stratum_handle_method(struct stratum_ctx *sctx, const char *s); +bool stratum_suggest_difficulty( struct stratum_ctx *sctx, double diff ); + + +extern bool aes_ni_supported; +extern char *rpc_user; +extern char *short_url; + +struct thread_q; + +struct thread_q *tq_new(void); +void tq_free(struct thread_q *tq); +bool tq_push(struct thread_q *tq, void *data); +void *tq_pop(struct thread_q *tq, const struct timespec *abstime); +void tq_freeze(struct thread_q *tq); +void tq_thaw(struct thread_q *tq); + +void parse_arg(int key, char *arg); +void parse_config(json_t *config, char *ref); +void proper_exit(int reason); + +void applog_hash(void *hash); +void format_hashrate(double hashrate, char *output); +void print_hash_tests(void); + +void scale_hash_for_display ( double* hashrate, char* units ); +void format_number_si( double* hashrate, char* si_units ); +void report_summary_log( bool force ); + +/* +struct thr_info { + int id; + pthread_t pth; + pthread_attr_t attr; + struct thread_q *q; + struct cpu_info cpu; +}; +*/ + +struct work_restart { + volatile uint8_t restart; + char padding[128 - sizeof(uint8_t)]; +}; + +enum workio_commands { + WC_GET_WORK, + WC_SUBMIT_WORK, +}; + +struct workio_cmd { + enum workio_commands cmd; + struct thr_info *thr; + union { + struct work *work; + } u; +}; + +uint32_t* get_stratum_job_ntime(); + +enum algos { + ALGO_NULL, + ALGO_ALLIUM, + ALGO_ANIME, + ALGO_ARGON2D250, + ALGO_ARGON2D500, + ALGO_ARGON2D4096, + ALGO_AXIOM, + ALGO_BLAKE, + ALGO_BLAKE2B, + ALGO_BLAKE2S, + ALGO_BLAKECOIN, + ALGO_BMW, + ALGO_BMW512, + ALGO_C11, + ALGO_DEEP, + ALGO_DMD_GR, + ALGO_GROESTL, + ALGO_HEX, + ALGO_HMQ1725, + ALGO_JHA, + ALGO_KECCAK, + ALGO_KECCAKC, + ALGO_LBRY, + ALGO_LYRA2H, + ALGO_LYRA2RE, + ALGO_LYRA2REV2, + ALGO_LYRA2REV3, + ALGO_LYRA2Z, + ALGO_LYRA2Z330, + ALGO_M7M, + ALGO_MINOTAUR, + ALGO_MINOTAURX, + ALGO_MYR_GR, + ALGO_NEOSCRYPT, + ALGO_NIST5, + ALGO_PENTABLAKE, + ALGO_PHI1612, + ALGO_PHI2, + ALGO_POLYTIMOS, + ALGO_POWER2B, + ALGO_QUARK, + ALGO_QUBIT, + ALGO_SCRYPT, + ALGO_SHA256D, + ALGO_SHA256DT, + ALGO_SHA256Q, + ALGO_SHA256T, + ALGO_SHA3D, + ALGO_SHA512256D, + ALGO_SKEIN, + ALGO_SKEIN2, + ALGO_SKUNK, + ALGO_SONOA, + ALGO_TIMETRAVEL, + ALGO_TIMETRAVEL10, + ALGO_TRIBUS, + ALGO_VANILLA, + ALGO_VELTOR, + ALGO_VERTHASH, + ALGO_WHIRLPOOL, + ALGO_WHIRLPOOLX, + ALGO_X11, + ALGO_X11EVO, + ALGO_X11GOST, + ALGO_X12, + ALGO_X13, + ALGO_X13BCD, + ALGO_X13SM3, + ALGO_X14, + ALGO_X15, + ALGO_X16R, + ALGO_X16RV2, + ALGO_X16RT, + ALGO_X16RT_VEIL, + ALGO_X16S, + ALGO_X17, + ALGO_X20R, + ALGO_X21S, + ALGO_X22I, + ALGO_X25X, + ALGO_XEVAN, + ALGO_YESCRYPT, + ALGO_YESCRYPTR8, + ALGO_YESCRYPTR8G, + ALGO_YESCRYPTR16, + ALGO_YESCRYPTR32, + ALGO_YESPOWER, + ALGO_YESPOWERR16, + ALGO_YESPOWER_B2B, + ALGO_ZR5, + ALGO_RINHASH, // Add RinHash algorithm + ALGO_COUNT +}; + +// This list must be in exactly the same order as above. +static const char* const algo_names[] = { + NULL, + "allium", + "anime", + "argon2d250", + "argon2d500", + "argon2d4096", + "axiom", + "blake", + "blake2b", + "blake2s", + "blakecoin", + "bmw", + "bmw512", + "c11", + "deep", + "dmd-gr", + "groestl", + "hex", + "hmq1725", + "jha", + "keccak", + "keccakc", + "lbry", + "lyra2h", + "lyra2re", + "lyra2rev2", + "lyra2rev3", + "lyra2z", + "lyra2z330", + "m7m", + "minotaur", + "minotaurx", + "myr-gr", + "neoscrypt", + "nist5", + "pentablake", + "phi1612", + "phi2", + "polytimos", + "power2b", + "quark", + "qubit", + "scrypt", + "sha256d", + "sha256dt", + "sha256q", + "sha256t", + "sha3d", + "sha512256d", + "skein", + "skein2", + "skunk", + "sonoa", + "timetravel", + "timetravel10", + "tribus", + "vanilla", + "veltor", + "verthash", + "whirlpool", + "whirlpoolx", + "x11", + "x11evo", + "x11gost", + "x12", + "x13", + "x13bcd", + "x13sm3", + "x14", + "x15", + "x16r", + "x16rv2", + "x16rt", + "x16rt-veil", + "x16s", + "x17", + "x20r", + "x21s", + "x22i", + "x25x", + "xevan", + "yescrypt", + "yescryptr8", + "yescryptr8g", + "yescryptr16", + "yescryptr32", + "yespower", + "yespowerr16", + "yespower-b2b", + "zr5", + "rinhash", + "\0" +}; + +const char* algo_name( enum algos a ); + +extern enum algos opt_algo; +extern bool opt_debug; +extern bool opt_debug_diff; +extern bool opt_benchmark; +extern bool opt_protocol; +extern bool opt_extranonce; +extern bool opt_quiet; +extern bool opt_redirect; +extern int opt_timeout; +extern bool want_longpoll; +extern bool have_longpoll; +extern bool have_gbt; +extern char* lp_id; +extern char *rpc_userpass; +extern const char *gbt_lp_req; +extern const char *getwork_req; +extern bool allow_getwork; +extern bool want_stratum; +extern bool have_stratum; +extern char *opt_cert; +extern char *opt_proxy; +extern long opt_proxy_type; +extern bool use_syslog; +extern bool use_colors; +extern pthread_mutex_t applog_lock; +extern struct thr_info *thr_info; +extern int longpoll_thr_id; +extern int stratum_thr_id; +extern int api_thr_id; +extern int opt_n_threads; +extern struct work_restart *work_restart; +extern uint32_t opt_work_size; +extern double *thr_hashrates; +extern double global_hashrate; +extern double stratum_diff; +extern double net_diff; +extern double net_hashrate; +extern int opt_param_n; +extern int opt_param_r; +extern char* opt_param_key; +extern double opt_diff_factor; +extern double opt_target_factor; +extern bool opt_randomize; +extern bool allow_mininginfo; +extern pthread_rwlock_t g_work_lock; +extern time_t g_work_time; +extern bool opt_stratum_stats; +extern int num_cpus; +extern int num_cpugroups; +extern int opt_priority; +extern bool opt_hash_meter; +extern uint32_t accepted_share_count; +extern uint32_t rejected_share_count; +extern uint32_t solved_block_count; +extern pthread_mutex_t applog_lock; +extern pthread_mutex_t stats_lock; +extern bool opt_sapling; +extern bool opt_mweb; // add mweb option declaration +extern const int pk_buffer_size_max; +extern int pk_buffer_size; +extern char *opt_data_file; +extern bool opt_verify; +extern bool opt_bell; // keyboard beep +static char const usage[] = "\ +Usage: cpuminer [OPTIONS]\n\ +Options:\n\ + -a, --algo=ALGO specify the algorithm to use\n\ + allium Garlicoin (GRLC)\n\ + anime Animecoin (ANI)\n\ + argon2d250\n\ + argon2d500\n\ + argon2d4096\n\ + axiom Shabal-256 MemoHash\n\ + blake blake256r14 (SFR)\n\ + blake2b Blake2b 256\n\ + blake2s Blake-2 S\n\ + blakecoin blake256r8\n\ + bmw BMW 256\n\ + bmw512 BMW 512\n\ + c11 Chaincoin\n\ + deep Deepcoin (DCN)\n\ + dmd-gr Diamond\n\ + groestl Groestl coin\n\ + hex x16r-hex\n\ + hmq1725 Espers\n\ + jha jackppot (Jackpotcoin)\n\ + keccak Maxcoin\n\ + keccakc Creative Coin\n\ + lbry LBC, LBRY Credits\n\ + lyra2h Hppcoin\n\ + lyra2re lyra2\n\ + lyra2rev2 lyrav2\n\ + lyra2rev3 lyrav2v3\n\ + lyra2z\n\ + lyra2z330 Lyra2 330 rows\n\ + m7m Magi (XMG)\n\ + myr-gr Myriad-Groestl\n\ + minotaur\n\ + minotaurx\n\ + neoscrypt NeoScrypt(128, 2, 1)\n\ + nist5 Nist5\n\ + pentablake 5 x blake512\n\ + phi1612 phi\n\ + phi2\n\ + polytimos\n\ + power2b MicroBitcoin (MBC)\n\ + quark Quark\n\ + qubit Qubit\n\ + scrypt scrypt(1024, 1, 1) (default)\n\ + scrypt:N scrypt(N, 1, 1)\n\ + scryptn2 scrypt(1048576, 1,1)\n\ + sha256d Double SHA-256\n\ + sha256dt Modified sha256d (Novo)\n\ + sha256q Quad SHA-256, Pyrite (PYE)\n\ + sha256t Triple SHA-256, Onecoin (OC)\n\ + sha3d Double Keccak256 (BSHA3)\n\ + sha512256d Double SHA-512 (Radiant)\n\ + skein Skein+Sha (Skeincoin)\n\ + skein2 Double Skein (Woodcoin)\n\ + skunk Signatum (SIGT)\n\ + sonoa Sono\n\ + timetravel timeravel8, Machinecoin (MAC)\n\ + timetravel10 Bitcore (BTX)\n\ + tribus Denarius (DNR)\n\ + vanilla blake256r8vnl (VCash)\n\ + veltor\n\ + verthash\n\ + whirlpool\n\ + whirlpoolx\n\ + x11 Dash\n\ + x11evo Revolvercoin (XRE)\n\ + x11gost sib (SibCoin)\n\ + x12 Galaxie Cash (GCH)\n\ + x13 X13\n\ + x13bcd bcd \n\ + x13sm3 hsr (Hshare)\n\ + x14 X14\n\ + x15 X15\n\ + x16r\n\ + x16rv2\n\ + x16rt Gincoin (GIN)\n\ + x16rt-veil Veil (VEIL)\n\ + x16s\n\ + x17\n\ + x20r\n\ + x21s\n\ + x22i\n\ + x25x\n\ + xevan Bitsend (BSD)\n\ + yescrypt Globalboost-Y (BSTY)\n\ + yescryptr8 BitZeny (ZNY)\n\ + yescryptr8g Koto (KOTO)\n\ + yescryptr16 Eli\n\ + yescryptr32 WAVI\n\ + yespower Cryply\n\ + yespowerr16 Yenten (YTN)\n\ + yespower-b2b generic yespower + blake2b\n\ + zr5 Ziftr\n\ + rinhash RinHash\n\ + -N, --param-n=N N parameter for scrypt based algos\n\ + -R, --param-r=N R parameter for scrypt based algos\n\ + -K, --param-key=STRING Key (pers) parameter for algos that use it\n\ + -o, --url=URL URL of mining server\n\ + -O, --userpass=U:P username:password pair for mining server\n\ + -u, --user=USERNAME username for mining server\n\ + -p, --pass=PASSWORD password for mining server\n\ + --cert=FILE certificate for mining server using SSL\n\ + -x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy\n\ + -t, --threads=N number of miner threads (default: number of processors)\n\ + -r, --retries=N number of times to retry if a network call fails\n\ + (default: retry indefinitely)\n\ + --retry-pause=N time to pause between retries, in seconds (default: 30)\n\ + --time-limit=N maximum time [s] to mine before exiting the program.\n\ + -T, --timeout=N timeout for long poll and stratum (default: 300 seconds)\n\ + -s, --scantime=N upper bound on time spent scanning current work when\n\ + long polling is unavailable, in seconds (default: 5)\n\ + --randomize randomize scan range (deprecated)\n\ + -f, --diff-factor=N divide req. difficulty by this factor (std is 1.0)\n\ + -m, --diff-multiplier=N Multiply difficulty by this factor (std is 1.0)\n\ + --hash-meter display thread hash rates\n\ + --coinbase-addr=ADDR payout address for solo mining\n\ + --coinbase-sig=TEXT data to insert in the coinbase when possible\n\ + --no-longpoll disable long polling support\n\ + --no-getwork disable getwork support\n\ + --no-gbt disable getblocktemplate support\n\ + --no-stratum disable X-Stratum support\n\ + --no-extranonce disable Stratum extranonce subscribe\n\ + --no-redirect ignore requests to change the URL of the mining server\n\ + -q, --quiet reduce log verbosity\n\ + --no-color disable colored output\n\ + -D, --debug enable debug output\n\ + -P, --protocol-dump verbose dump of protocol-level activities\n" +#ifdef HAVE_SYSLOG_H +"\ + -S, --syslog use system log for output messages\n" +#endif +"\ + -B, --background run the miner in the background\n\ + --benchmark run in offline benchmark mode\n\ + --cpu-affinity set process affinity to cpu core(s), mask 0x3 for cores 0 and 1\n\ + --cpu-priority set process priority (default: 0 idle, 2 normal to 5 highest) (deprecated)\n\ + -b, --api-bind=address[:port] IP address for the miner API, default port is 4048)\n\ + --api-remote allow remote control\n\ + --max-temp=N only mine if cpu temp is less than specified value (linux)\n\ + --max-rate=N[KMG] only mine if net hashrate is less than specified value\n\ + --max-diff=N only mine if net difficulty is less than specified value\n\ + --mweb enable MWEB support\n\ + -c, --config=FILE load a JSON-format configuration file\n\ + --data-file=FILE path and name of data file\n\ + --verify enable additional time consuming start up tests\n\ + --stratum-keepalive prevent disconnects when difficulty is too high\n\ + -V, --version display version and CPU information and exit\n\ + -h, --help display this help text and exit\n\ +"; + +#ifdef HAVE_GETOPT_LONG +#include +#else +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; +#endif + + +static struct option const options[] = { + { "algo", 1, NULL, 'a' }, + { "api-bind", 1, NULL, 'b' }, + { "api-remote", 0, NULL, 1030 }, + { "background", 0, NULL, 'B' }, + { "benchmark", 0, NULL, 1005 }, + { "cputest", 0, NULL, 1006 }, + { "cert", 1, NULL, 1001 }, + { "coinbase-addr", 1, NULL, 1016 }, + { "coinbase-sig", 1, NULL, 1015 }, + { "config", 1, NULL, 'c' }, + { "cpu-affinity", 1, NULL, 1020 }, + { "cpu-priority", 1, NULL, 1021 }, + { "no-color", 0, NULL, 1002 }, + { "debug", 0, NULL, 'D' }, + { "diff-factor", 1, NULL, 'f' }, + { "diff", 1, NULL, 'f' }, // deprecated (alias) + { "diff-multiplier", 1, NULL, 'm' }, + { "hash-meter", 0, NULL, 1014 }, + { "help", 0, NULL, 'h' }, + { "key", 1, NULL, 'K' }, + { "no-gbt", 0, NULL, 1011 }, + { "no-getwork", 0, NULL, 1010 }, + { "no-longpoll", 0, NULL, 1003 }, + { "no-redirect", 0, NULL, 1009 }, + { "no-stratum", 0, NULL, 1007 }, + { "no-extranonce", 0, NULL, 1012 }, + { "max-temp", 1, NULL, 1060 }, + { "max-diff", 1, NULL, 1061 }, + { "max-rate", 1, NULL, 1062 }, + { "param-key", 1, NULL, 'K' }, + { "param-n", 1, NULL, 'N' }, + { "param-r", 1, NULL, 'R' }, + { "pass", 1, NULL, 'p' }, + { "protocol", 0, NULL, 'P' }, + { "protocol-dump", 0, NULL, 'P' }, + { "proxy", 1, NULL, 'x' }, + { "quiet", 0, NULL, 'q' }, + { "retries", 1, NULL, 'r' }, + { "retry-pause", 1, NULL, 1025 }, + { "randomize", 0, NULL, 1024 }, + { "scantime", 1, NULL, 's' }, +#ifdef HAVE_SYSLOG_H + { "syslog", 0, NULL, 'S' }, +#endif + { "time-limit", 1, NULL, 1008 }, + { "threads", 1, NULL, 't' }, + { "timeout", 1, NULL, 'T' }, + { "url", 1, NULL, 'o' }, + { "user", 1, NULL, 'u' }, + { "userpass", 1, NULL, 'O' }, + { "data-file", 1, NULL, 1027 }, + { "verify", 0, NULL, 1028 }, + { "stratum-keepalive", 0, NULL, 1029 }, + { "version", 0, NULL, 'V' }, + { "bell", 0, NULL, 1031 }, + { "mweb", 0, NULL, 1032 }, + { 0, 0, 0, 0 } +}; + + +#endif /* __MINER_H__ */ + diff --git a/rin/miner/cpuminer/nomacro.pl b/rin/miner/cpuminer/nomacro.pl new file mode 100644 index 0000000..e91cda3 --- /dev/null +++ b/rin/miner/cpuminer/nomacro.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# Copyright 2012 pooler@litecoinpool.org +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. See COPYING for more details. +# +# nomacro.pl - convert assembler macros to C preprocessor macros. + +use strict; + +foreach my $f (<*.S>) { + rename $f, "$f.orig"; + open FIN, "$f.orig"; + open FOUT, ">$f"; + my $inmacro = 0; + my %macros = (); + while () { + if (m/^\.macro\s+([_0-9A-Z]+)(?:\s*)(.*)$/i) { + print FOUT "#define $1($2) \\\n"; + $macros{$1} = 1; + $inmacro = 1; + next; + } + if (m/^\.endm/) { + print FOUT "\n"; + $inmacro = 0; + next; + } + for my $m (keys %macros) { + s/^([ \t]*)($m)(?:[ \t]+([^#\n]*))?([;\n])/\1\2(\3)\4/; + } + if ($inmacro) { + if (m/^\s*#if/) { + $_ = while (!m/^\s*#endif/); + next; + } + next if (m/^\s*$/); + s/\\//g; + s/$/; \\/; + } + print FOUT; + } + close FOUT; + close FIN; +} diff --git a/rin/miner/cpuminer/simd-utils.h b/rin/miner/cpuminer/simd-utils.h new file mode 100644 index 0000000..f199e56 --- /dev/null +++ b/rin/miner/cpuminer/simd-utils.h @@ -0,0 +1,233 @@ +#if !defined(SIMD_UTILS_H__) +#define SIMD_UTILS_H__ 1 + +////////////////////////////////////////////////////////////////////// +// +// SIMD utilities +// +// Not to be confused with the hashing function of the same name. This +// is about Single Instruction Multiple Data programming using CPU +// features such as SSE and AVX. +// +// This header is the entry point to a suite of macros and functions +// to perform basic operations on vectors that are useful in crypto +// mining. Some of these functions have native CPU support for scalar +// data but not for vectors. The main categories are bit rotation +// and endian byte swapping +// +// This suite supports some operations on regular 64 bit integers +// as well as 128 bit integers available on recent versions of Linux +// and GCC. +// +// It also supports various vector sizes on CPUs that meet the minimum +// requirements. +// +// The minimum for any real work is a 64 bit CPU with SSE2, +// ie an the Intel Core 2. +// +// Following are the minimum requirements for each vector size. There +// is no significant 64 bit vectorization therefore SSE2 is the practical +// minimum for using this code. +// +// SSE2: 128 bit vectors (64 bit CPUs only, such as Intel Core2. +// AVX2: 256 bit vectors (Starting with Intel Haswell and AMD Ryzen) +// AVX512: 512 bit vectors (Starting with SkylakeX) +// AVX10: when available will supersede AVX512 and will bring AVX512 +// features, except 512 bit vectors, to Intel's Ecores. It needs to be +// enabled manually when the relevant GCC macros are known. +// +// Most functions are avalaible at the stated levels but in rare cases +// a higher level feature may be required with no compatible alternative. +// Some SSE2 functions have versions optimized for higher feature levels +// such as SSSE3 or SSE4.1 that will be used automatically on capable +// CPUs. +// +// Strict alignment of data is required: 16 bytes for 128 bit vectors, +// 32 bytes for 256 bit vectors and 64 bytes for 512 bit vectors. 64 byte +// alignment is recommended in all cases for best cache alignment. +// +// All functions are defined with type agnostic pointers (void*) arguments +// and are cast or aliased as the appropriate type. This adds convenience +// for the applications but also adds responsibility to ensure adequate data +// alignment. +// +// An attempt was made to make the names as similar as possible to +// Intel's intrinsic function format. Most variations are to avoid +// confusion with actual Intel intrinsics, brevity, and clarity. +// +// The main differences are: +// +// - the leading underscore "_" is dropped from the prefix of vector function +// macros. +// - "mm128" is used 128 bit prefix to be consistent with mm256 & mm512 and +// to avoid the ambiguity of "mm" which is also used for 64 bit MMX +// intrinsics. +// - the element size does not include additional type specifiers +// like "epi". +// - there is a subset of some functions for scalar data. They may have +// no prefix nor vec-size, just one size, the size of the data. +// - Some integer functions are also defined which use a similar notation. +// +// Function names follow this pattern: +// +// [prefix]_[op][vsize]_[esize] +// +// Prefix: usually the size of the returned vector. +// Following are some examples: +// +// u64: unsigned 64 bit integer function +// i128: signed 128 bit integer function (rarely used) +// m128: 128 bit vector identifier (deprecated) +// mm128: 128 bit vector function +// +// op: describes the operation of the function or names the data +// identifier. +// +// esize: optional, element size of operation +// +// vsize: optional, lane size used when a function operates on elements +// within lanes of a larger vector. +// +// Ex: mm256_shuflr128_32 rotates each 128 bit lane of a 256 bit vector +// right by 32 bits. +// +// New architecture agnostic syntax to support multiple architectures. +// currently only used for 128 bit vectors. +// +// [prefix]_[op]esize] +// +// Abbreviated when no vsize, space is removed between op & esize. +// +// Ex: v128_add32 gets remapped to the appropriate architecture intrinsic. +// +// New type specification includes element size because it's significant on +// AArch64. For x86_64 they'r all maped to v128_t. On arm the default is +// v128u32_t. +// +// v128_t, v1q28u64_t, v128u32_t. +// +// [prefix] is changed to "v128" or size specific for typedef. +// +// Vector constants +// +// Vector constants are a big problem because they technically don't exist. +// All vectors used as constants either reside in memory or must be genererated +// at run time at significant cost. The cost of generating a constant +// increases non-linearly with the number of vector elements. A 4 element +// vector costs between 7 and 11 clocks to generate, an 8 element vector +// is 15-25 clocks. There are also additional clock due to data dependency +// stalls. +// +// Vector constants are often used as control indexes for permute, blend, etc, +// where generating the index can be over 90% of the operation. This is +// where the problem occurs. An instruction that only requires one to 3 +// clocks needs may times more just to build the index argument. +// +// There is very little a programmer can do to avoid the worst case scenarios. +// Smaller integers can be merged to form 64 bit integers, and vectors with +// repeated elements can be generated more efficiently but they have limited +// benefit and limited application. +// +// If a vector constant is to be used repeatedly it is better to define a local +// variable to generate the constant only once. +// +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + +// AVX512 macros are not a reliable indicator of 512 bit vector capability +// because they get defined with AVX10_1_256 which doesn't support 512 bit. +// EVEX512 is also unreliable as it can also be defined when 512b is not +// available. +// Use AVX10_1_512 for 512b & AVX10_1_256 for 256b whenever AVX10 is present. +// Use AVX512 macros only whithout AVX10. + +/* +// Test for macros +#ifdef __AVX10_1__ +#warning "__AVX10_1__" +#endif +#ifdef __AVX10_1_256__ +#warning "__AVX10_1_256__" +#endif +#ifdef __AVX10_1_512__ +#warning "__AVX10_1_512__" +#endif +#ifdef __EVEX256__ +#warning "__EVEX256__" +#endif +#ifdef __EVEX512__ +#warning "__EVEX512__" +#endif +#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) +#warning "AVX512" +#endif +*/ + +// SIMD512: Use 512, 256 & 128 bit vectors, AVX512VBMI is not included and +// must be tested seperately. +// VL256: Include AVX512VL instructions for 256 & 128 bit vectors. +// VBMI: Include AVX512VBMI instructions for supported vector lengths. + +#if defined(__AVX10_1__) + + #define VL256 1 + #define VBMI 1 + #if defined(__AVX10_1_512__) + #define SIMD512 1 + #endif + +#elif defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) + + #define VL256 1 + #define SIMD512 1 + #if defined(__AVX512VBMI__) + #define VBMI 1 + #endif + +#endif + +/* +#if defined(SIMD512) +#warning "SIMD512" +#endif +#if defined(VBMI) +#warning "VBMI" +#endif +#if defined(VL256) +#warning "VL256" +#endif +*/ + +#if defined(__x86_64__) + +#include + +#elif defined(__aarch64__) + +#include + +#endif + +#include "simd-utils/simd-int.h" + +// x86_64 SSE2 128 bit vectors +#include "simd-utils/simd-128.h" + +// x86_64 AVX2 256 bit vectors +#include "simd-utils/simd-256.h" + +// x86_64 AVX512 512 bit vectors +#include "simd-utils/simd-512.h" + +// aarch64 neon 128 bit vectors +#include "simd-utils/simd-neon.h" + +#include "simd-utils/intrlv.h" + +#endif // SIMD_UTILS_H__ diff --git a/rin/miner/cpuminer/sysinfos.c b/rin/miner/cpuminer/sysinfos.c new file mode 100644 index 0000000..af23258 --- /dev/null +++ b/rin/miner/cpuminer/sysinfos.c @@ -0,0 +1,1076 @@ +#if !defined(SYSINFOS_C__) +#define SYSINFOS_C__ + +/** + * Unit to read cpu informations + * + * tpruvot 2014 + * JayDDee 2019 + * +*/ + +#include +#include +#include +#include +#include "miner.h" +#include "simd-utils.h" + +// Missing on MinGW, MacOS +#if defined(__aarch64__) && !defined(WIN32) && !defined(__APPLE__) +#define ARM_AUXV +#endif + +#if defined(ARM_AUXV) +// for arm's "cpuid" +#include +#include +#include +#endif + +#if !(defined(WIN32) || defined(__APPLE__)) + +// 1035g1: /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input +// 1035g1: /sys/class/hwmon/hwmon1/temp1_input wrong temp +// ryzen has no /sys/devices/platform/coretemp.0 +// ryzen: /sys/class/hwmon/hwmon0 +// 2400: /sys/class/hwmon/hwmon0/temp1_input incorrect temp +// 2400 has no /sys/class/hwmon/hwmon2/temp1_input +// 2400 /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input ok +// 6700 /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input +// 6700 /sys/class/hwmon/hwmon2/temp1_input +// /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input never exists +// /sys/class/hwmon/hwmon0/temp2_input doesn't exist or shows wrong temp (sys16) +// /sys/class/hwmon/hwmon0/device/temp1_input doesn't exist + + +// the first 3 will find i5-2400, i7-6700k, r7-1700, i5-1035g1. +// The others are left in for legacy, some should probably be removed. +#define HWMON_PATH1 \ + "/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input" + +#define HWMON_PATH2 \ + "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input" + +#define HWMON_PATH3 \ + "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input" + +#define HWMON_PATH \ + "/sys/class/hwmon/hwmon2/temp1_input" + +// need this for Ryzen +#define HWMON_ALT \ + "/sys/class/hwmon/hwmon0/temp1_input" + +/* +#define HWMON_ALT1 \ + "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input" +*/ + +// This shows wrong temp on i5-1035g1 +#define HWMON_ALT2 \ + "/sys/class/hwmon/hwmon1/temp1_input" + +// None of these work on any of the cpus above. +#define HWMON_ALT3 \ + "/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input" +#define HWMON_ALT4 \ + "/sys/class/hwmon/hwmon0/temp2_input" +#define HWMON_ALT5 \ +"/sys/class/hwmon/hwmon0/device/temp1_input" + +static inline float linux_cputemp(int core) +{ + float tc = 0.0; + FILE *fd; + uint32_t val = 0; + + fd = fopen(HWMON_PATH1, "r"); + + if (!fd) + fd = fopen(HWMON_PATH2, "r"); + + if (!fd) + fd = fopen(HWMON_PATH3, "r"); + + if (!fd) + fd = fopen(HWMON_PATH, "r"); + + if (!fd) + fd = fopen(HWMON_ALT, "r"); + + if (!fd) + return tc; + + if ( fscanf( fd, "%d", &val ) ) + tc = val / 1000.0; + fclose( fd ); + return tc; +} + + +#define CPUFREQ_PATH0\ + "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" + +#define CPUFREQ_PATHn \ + "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq" + +static inline float linux_cpufreq(int core) +{ + FILE *fd = fopen( CPUFREQ_PATH0, "r" ); + long int freq = 0; + + if ( !fd ) return (float)freq; + if ( !fscanf( fd, "%ld", &freq ) ) freq = 0; + fclose( fd ); + return (float)freq; +} + +static inline void linux_cpu_hilo_freq( float *lo, float *hi ) +{ + long int freq = 0, hi_freq = 0, lo_freq = 0x7fffffff; + + for ( int i = 0; i < num_cpus; i++ ) + { + char path[64]; + sprintf( path, CPUFREQ_PATHn, i ); + FILE *fd = fopen( path, "r" ); + if ( !fd ) return; + else if ( fscanf( fd, "%ld", &freq ) ) + { + if ( freq > hi_freq ) hi_freq = freq; + if ( freq < lo_freq ) lo_freq = freq; + } + fclose( fd ); + } + *hi = (float)hi_freq; + *lo = (float)lo_freq; +} + +#endif /* !WIN32 */ + + +static inline float cpu_temp( int core ) +{ +#if defined(WIN32) || defined(__APPLE__) + return 0.; +#else + return linux_cputemp( core ); +#endif +} + +static inline uint32_t cpu_clock( int core ) +{ +#if defined(WIN32) || defined(__APPLE__) + return 0; +#else + return linux_cpufreq( core ); +#endif +} + +static inline int cpu_fanpercent() +{ + return 0; +} + + +// x86_64 CPUID + +// This list is incomplete, it only contains features of interest to cpuminer. +// refer to http://en.wikipedia.org/wiki/CPUID for details. + +// AVX10 compatibility notes +// +// Display format: AVX10.[version]-[vectorwidth] +// AVX10.1-512 is a rebranding of AVX512 and is effectively the AVX* superset +// with full 512 bit vector support. +// AVX10.2-256 is effectively AVX2 + AVX512_VL, all AVX512 instructions and +// features applied only to 256 bit and 128 bit vectors. +// Future AVX10 versions will add new instructions and features. + +// Register array indexes +#define EAX_Reg (0) +#define EBX_Reg (1) +#define ECX_Reg (2) +#define EDX_Reg (3) + +// CPUID function number, aka leaf (EAX) +#define VENDOR_ID (0) +#define CPU_INFO (1) +#define CACHE_TLB_DESCRIPTOR (2) +#define EXTENDED_FEATURES (7) +#define AVX10_FEATURES (0x24) +#define HIGHEST_EXT_FUNCTION (0x80000000) +#define EXTENDED_CPU_INFO (0x80000001) +#define CPU_BRAND_1 (0x80000002) +#define CPU_BRAND_2 (0x80000003) +#define CPU_BRAND_3 (0x80000004) + +// CPU_INFO: EAX=1, ECX=0 +// ECX +#define SSE3_Flag 1 +#define SSSE3_Flag (1<< 9) +#define XOP_Flag (1<<11) // obsolete +#define FMA3_Flag (1<<12) +#define SSE41_Flag (1<<19) +#define SSE42_Flag (1<<20) +#define AES_NI_Flag (1<<25) +#define XSAVE_Flag (1<<26) +#define OSXSAVE_Flag (1<<27) +#define AVX_Flag (1<<28) +// EDX +#define MMX_Flag (1<<23) +#define SSE_Flag (1<<25) +#define SSE2_Flag (1<<26) + +// EXTENDED_FEATURES subleaf 0: EAX=7, ECX=0 +// EBX +#define AVX2_Flag (1<< 5) +#define AVX512_F_Flag (1<<16) +#define AVX512_DQ_Flag (1<<17) +#define AVX512_IFMA_Flag (1<<21) +#define AVX512_PF_Flag (1<<26) // obsolete +#define AVX512_ER_Flag (1<<27) // obsolete +#define AVX512_CD_Flag (1<<28) +#define SHA_Flag (1<<29) +#define AVX512_BW_Flag (1<<30) +#define AVX512_VL_Flag (1<<31) +// ECX +#define AVX512_VBMI_Flag (1<< 1) +#define AVX512_VBMI2_Flag (1<< 6) +#define VAES_Flag (1<< 9) +#define AVX512_VNNI_Flag (1<<11) +#define AVX512_BITALG_Flag (1<<12) +#define AVX512_VPOPCNTDQ_Flag (1<<14) +// EDX +#define AVX512_4VNNIW_Flag (1<< 2) // obsolete +#define AVX512_4FMAPS_Flag (1<< 3) // obsolete +#define AVX512_VP2INTERSECT_Flag (1<< 8) +#define AMX_BF16_Flag (1<<22) +#define AVX512_FP16_Flag (1<<23) +#define AMX_TILE_Flag (1<<24) +#define AMX_INT8_Flag (1<<25) + +// EXTENDED_FEATURES subleaf 1: EAX=7, ECX=1 +// EAX +#define SHA512_Flag 1 +#define SM3_Flag (1<< 1) +#define SM4_Flag (1<< 2) +#define AVX_VNNI_Flag (1<< 4) +#define AVX512_BF16_Flag (1<< 5) +#define AMX_FP16_Flag (1<<21) +#define AVX_IFMA_Flag (1<<23) +// EDX +#define AVX_VNNI_INT8_Flag (1<< 4) +#define AVX_NE_CONVERT_Flag (1<< 5) +#define AMX_COMPLEX_Flag (1<< 8) +#define AVX_VNNI_INT16_Flag (1<<10) +#define AVX10_Flag (1<<19) +#define APX_F_Flag (1<<21) + +// AVX10_FEATURES: EAX=0x24, ECX=0 +// EBX +#define AVX10_VERSION_mask 0xff // bits [7:0] +#define AVX10_128_Flag (1<<16) +#define AVX10_256_Flag (1<<17) +#define AVX10_512_Flag (1<<18) + +// Use this to detect presence of feature +#define AVX_mask (AVX_Flag|XSAVE_Flag|OSXSAVE_Flag) +#define FMA3_mask (FMA3_Flag|AVX_mask) +#define AVX512_mask (AVX512_VL_Flag|AVX512_BW_Flag|AVX512_DQ_Flag|AVX512_F_Flag) + +#if defined(__x86_64__) + +static inline void cpuid( unsigned int leaf, unsigned int subleaf, + unsigned int output[4] ) +{ + +#if defined (_MSC_VER) || defined (__INTEL_COMPILER) + // Microsoft or Intel compiler, intrin.h included + __cpuidex(output, leaf, subleaf ); +#elif defined(__GNUC__) || defined(__clang__) + // use inline assembly, Gnu/AT&T syntax + unsigned int a, b, c, d; + asm volatile( "cpuid" + : "=a"(a), "=b"(b), "=c"(c), "=d"(d) + : "a"(leaf), "c"(subleaf) ); + output[ EAX_Reg ] = a; + output[ EBX_Reg ] = b; + output[ ECX_Reg ] = c; + output[ EDX_Reg ] = d; +#else + // unknown platform. try inline assembly with masm/intel syntax + __asm { + mov eax, leaf + mov ecx, subleaf + cpuid; + mov esi, output + mov[esi], eax + mov[esi + 4], ebx + mov[esi + 8], ecx + mov[esi + 12], edx + } +#endif +} + +#elif defined(ARM_AUXV) + +// Always test if HWCAP variable is defined in the kernel before attempting +// to compile it. If not defined the feature can't be tested and won't be +// included in the compile. +// This can occur if compiling with an old kernel and a new CPU and could +// result in a suboptimal build. +// leaf and subleaf arguments are ignored. + +static inline void cpuid( unsigned int leaf, unsigned int subleaf, + unsigned int output[4] ) +{ +#if defined(AT_HWCAP) + output[0] = getauxval( AT_HWCAP ); +#else + output[0] = 0; +#endif +#if defined(AT_HWCAP2) + output[1] = getauxval( AT_HWCAP2 ); +#else + output[1] = 0; +#endif + +/* +#define has(CAP, hwcap) !!((hwcap) & HWCAP_##CAP) +#define pr(CAP, hwcap) printf("%10s = %d\n", #CAP, has(CAP, hwcap)) + + unsigned long hwcaps = getauxval(AT_HWCAP); + printf("HWCAP = 0x%lx\n", hwcaps); + + pr(FP, hwcaps); + pr(ASIMD, hwcaps); + pr(EVTSTRM, hwcaps); + pr(AES, hwcaps); + pr(PMULL, hwcaps); + pr(SHA1, hwcaps); + pr(SHA2, hwcaps); + pr(CRC32, hwcaps); + pr(ATOMICS, hwcaps); + pr(FPHP, hwcaps); + pr(ASIMDHP, hwcaps); + pr(CPUID, hwcaps); + pr(ASIMDRDM, hwcaps); + pr(JSCVT, hwcaps); + pr(FCMA, hwcaps); + pr(LRCPC, hwcaps); + pr(DCPOP, hwcaps); + pr(SHA3, hwcaps); + pr(SM3, hwcaps); + pr(SM4, hwcaps); + pr(ASIMDDP, hwcaps); + pr(SHA512, hwcaps); + pr(SVE, hwcaps); +*/ +} + +#else +#define cpuid( leaf, subleaf, output ) \ + output[0] = output[1] = output[2] = output[3] = 0; +#endif + +static inline void cpu_getname(char *outbuf, size_t maxsz) +{ + memset(outbuf, 0, maxsz); +#ifdef WIN32 + char brand[256] = { 0 }; + int output[4] = { 0 }, ext; + cpuid( 0x80000000, 0, output ); + ext = output[0]; + if (ext >= 0x80000004) + { + for (int i = 2; i <= (ext & 0xF); i++) + { + cpuid( 0x80000000+i, 0, output); + memcpy(&brand[(i-2) * 4*sizeof(int)], output, 4*sizeof(int)); + } + snprintf(outbuf, maxsz, "%s", brand); + } + else + { + // Fallback, for the i7-5775C will output + // Intel64 Family 6 Model 71 Stepping 1, GenuineIntel + snprintf(outbuf, maxsz, "%s", getenv("PROCESSOR_IDENTIFIER")); + } +#else + // Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz + FILE *fd = fopen("/proc/cpuinfo", "rb"); + char *buf = NULL, *p, *eol; + size_t size = 0; + if (!fd) return; + while(getdelim(&buf, &size, 0, fd) != -1) + { + if (buf && (p = strstr(buf, "model name\t")) && strstr(p, ":")) + { + p = strstr(p, ":"); + if (p) + { + p += 2; + eol = strstr(p, "\n"); if (eol) *eol = '\0'; + snprintf(outbuf, maxsz, "%s", p); + } + break; + } + } + free(buf); + fclose(fd); +#endif +} + +static inline void cpu_getmodelid(char *outbuf, size_t maxsz) +{ + memset(outbuf, 0, maxsz); +#ifdef WIN32 + // For the i7-5775C will output 6:4701:8 + snprintf(outbuf, maxsz, "%s:%s:%s", getenv("PROCESSOR_LEVEL"), // hexa ? + getenv("PROCESSOR_REVISION"), getenv("NUMBER_OF_PROCESSORS")); +#else + FILE *fd = fopen("/proc/cpuinfo", "rb"); + char *buf = NULL, *p; + int cpufam = 0, model = 0, stepping = 0; + size_t size = 0; + if (!fd) return; + + while(getdelim(&buf, &size, 0, fd) != -1) + { + if (buf && (p = strstr(buf, "cpu family\t")) && strstr(p, ":")) + { + p = strstr(p, ":"); + if (p) + { + p += 2; + cpufam = atoi(p); + } + } + if (buf && (p = strstr(buf, "model\t")) && strstr(p, ":")) + { + p = strstr(p, ":"); + if (p) + { + p += 2; + model = atoi(p); + } + } + if (buf && (p = strstr(buf, "stepping\t")) && strstr(p, ":")) + { + p = strstr(p, ":"); + if (p) + { + p += 2; + stepping = atoi(p); + } + } + if (cpufam && model && stepping) + { + snprintf( outbuf, maxsz, "%x:%02x%02x:%d", cpufam, model, stepping, + num_cpus); + outbuf[maxsz-1] = '\0'; + break; + } + } + free(buf); + fclose(fd); +#endif +} + +/* +#ifdef __aarch64__ +#warning "__aarch64__" +#endif +#ifdef __ARM_ARCH +#warning "__ARM_ARCH " __ARM_ARCH +#endif +#ifdef __ARM_NEON +#warning "__ARM_NEON" +#endif +#ifdef __ARM_FEATURE_CRYPTO +#warning "__ARM_FEATURE_CRYPTO" +#endif +#ifdef __ARM_FEATURE_AES +#warning "__ARM_FEATURE_AES" +#endif +#ifdef __ARM_FEATURE_SHA2 +#warning "__ARM_FEATURE_SHA2" +#endif +#ifdef __ARM_FEATURE_SHA3 +#warning "__ARM_FEATURE_SHA3" +#endif +#ifdef __ARM_FEATURE_SHA512 +#warning "__ARM_FEATURE_SHA512" +#endif +#ifdef __ARM_FEATURE_SVE +#warning "__ARM_FEATURE_SVE" +#endif +#ifdef __ARM_FEATURE_SVE2 +#warning "__ARM_FEATURE_SVE2" +#endif +#ifdef __ARM_FEATURE_SME +#warning "__ARM_FEATURE_SME" +#endif +*/ + +// Typical display format: AVX10.[version]_[vectorlength], if vector length is +// omitted 256 is the default. +// Ex: AVX10.1_512 +// Flags: +// AVX10 128 256 512 +// 0 0 0 0 = AVX10 not supported +// 1 1 1 0 = AVX10 256 bit max (version 2) +// 1 1 1 1 = AVX10 512 bit max (version 1 granite rapids) +// Other combinations are not defined. + +static inline bool cpu_arch_x86_64() +{ +#if defined(__x86_64__) + return true; +#else + return false; +#endif +} + +static inline bool cpu_arch_aarch64() +{ +#if defined(__aarch64__) + return true; +#else + return false; +#endif +} + +static inline bool has_sse() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ EDX_Reg ] & SSE_Flag; +#else + return false; +#endif +} + +static inline bool has_sse2() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ EDX_Reg ] & SSE2_Flag; +#else + return false; +#endif +} + +static inline bool has_ssse3() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & SSSE3_Flag; +#else + return false; +#endif +} + +static inline bool has_sse41() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & SSE41_Flag; +#else + return false; +#endif +} + +static inline bool has_sse42() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & SSE42_Flag; +#else + return false; +#endif +} + +// There's no HWCAP for NEON, assume it's always true. +static inline bool has_neon() +{ +#if defined(__aarch64__) + return true; +#else + return false; +#endif +} + +static inline bool has_avx() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return ( ( cpu_info[ ECX_Reg ] & AVX_mask ) == AVX_mask ); +#else + return false; +#endif +} + +static inline bool has_avx2() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX2_Flag; +#else + return false; +#endif +} + +// SVE vector width is determined at run time. +static inline bool has_sve() +{ +#if defined(__aarch64__) && defined(HWCAP_SVE) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[0] & HWCAP_SVE; +#else + return false; +#endif +} + +static inline bool has_sve2() +{ +#if defined(__aarch64__) && defined(HWCAP2_SVE2) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[1] & HWCAP2_SVE2; +#else + return false; +#endif +} + +static inline bool has_sme() +{ +#if defined(__aarch64__) && defined(HWCAP2_SME) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[1] & HWCAP2_SME; +#else + return false; +#endif +} + +static inline bool has_sme2() +{ +#if defined(__aarch64__) && defined(HWCAP2_SME2) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[1] & HWCAP2_SME2; +#else + return false; +#endif +} + +static inline bool has_avx512f() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX512_F_Flag; +#else + return false; +#endif +} + +static inline bool has_avx512dq() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX512_DQ_Flag; +#else + return false; +#endif +} + +static inline bool has_avx512bw() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX512_BW_Flag; +#else + return false; +#endif +} + +static inline bool has_avx512vl() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX512_VL_Flag; +#else + return false; +#endif +} + +// baseline for useability +static inline bool has_avx512() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return ( ( cpu_info[ EBX_Reg ] & AVX512_mask ) == AVX512_mask ); +#else + return false; +#endif +} + +static inline bool has_vbmi() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & AVX512_VBMI_Flag; +#else + return false; +#endif +} + +static inline bool has_vbmi2() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & AVX512_VBMI2_Flag; +#else + return false; +#endif +} + +static inline bool has_aes() +{ +#if defined(__x86_64__) + if ( has_sse2() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & AES_NI_Flag; + } + return false; +#elif defined(__aarch64__) && defined(HWCAP_AES) + // NEON AES + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[0] & HWCAP_AES; +#else + return false; +#endif +} + +static inline bool has_vaes() +{ +#if defined(__x86_64__) + if ( has_avx2() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & VAES_Flag; + } + return false; +#else + return false; +#endif +} + +static inline bool has_sveaes() +{ +#if defined(__aarch64__) && defined(HWCAP2_SVEAES) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[1] & HWCAP2_SVEAES; +#else + return false; +#endif +} + +static inline bool has_sha256() +{ +#if defined(__x86_64__) + if ( has_avx() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & SHA_Flag; + } + return false; +#elif defined(__aarch64__) && defined(HWCAP_SHA2) + // NEON SHA256 + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[0] & HWCAP_SHA2; +#else + return false; +#endif +} + +static inline bool has_sha512() +{ +#if defined(__x86_64__) + if ( has_avx2() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 1, cpu_info ); + return cpu_info[ EAX_Reg ] & SHA512_Flag; + } + return false; +#elif defined(__aarch64__) && defined(HWCAP_SHA512) + // NEON SHA512 + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[0] & HWCAP_SHA512; +#else + return false; +#endif +} + +// Arm only +static inline bool has_sha3() +{ +#if defined(__aarch64__) && defined(HWCAP_SHA3) + // NEON SHA3 + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[0] & HWCAP_SHA3; +#else + return false; +#endif +} + +static inline bool has_svesha3() +{ +#if defined(__aarch64__) && defined(HWCAP2_SVESHA3) + unsigned int cpu_info[4] = { 0 }; + cpuid( 0, 0, cpu_info ); + return cpu_info[1] & HWCAP2_SVESHA3; +#else + return false; +#endif +} + +// Obsolete, AMD only +static inline bool has_xop() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_CPU_INFO, 0, cpu_info ); + return cpu_info[ ECX_Reg ] & XOP_Flag; +#else + return false; +#endif +} + +static inline bool has_fma3() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + return ( ( cpu_info[ ECX_Reg ] & FMA3_mask ) == FMA3_mask ); +#else + return false; +#endif +} + +static inline bool has_apx_f() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 1, cpu_info ); + return cpu_info[ EDX_Reg ] & APX_F_Flag; +#else + return false; +#endif +} + +// Not much use on it's own +static inline bool has_avx10() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = { 0 }; + cpuid( EXTENDED_FEATURES, 1, cpu_info ); + return cpu_info[ EDX_Reg ] & AVX10_Flag; +#else + return false; +#endif +} + +static inline unsigned int avx10_version() +{ +#if defined(__x86_64__) + if ( has_avx10() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( AVX10_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX10_VERSION_mask; + } +#endif + return 0; +} + +// also includes 256 & 128 +static inline bool has_avx10_512() +{ +#if defined(__x86_64__) + if ( has_avx10() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( AVX10_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX10_512_Flag; + } +#endif + return false; +} + +// Includes 128 but might not include 512 +static inline bool has_avx10_256() +{ +#if defined(__x86_64__) + if ( has_avx10() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( AVX10_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX10_256_Flag; + } +#endif + return false; +} + +// AVX10 vector register length +static inline unsigned int avx10_vector_length() +{ +#if defined(__x86_64__) + if ( has_avx10() ) + { + unsigned int cpu_info[4] = { 0 }; + cpuid( AVX10_FEATURES, 0, cpu_info ); + return cpu_info[ EBX_Reg ] & AVX10_512_Flag ? 512 + : ( cpu_info[ EBX_Reg ] & AVX10_256_Flag ? 256 : 0 ); + } +#endif + return 0; +} + +// ARM SVE vector register length, converted from bytes to bits. +static inline int sve_vector_length() +{ +#if defined(ARM_AUXV) + if ( has_sve() ) + return prctl( (PR_SVE_GET_VL & PR_SVE_VL_LEN_MASK) * 8 ); +#endif + return 0; +} + +static inline uint32_t cpuid_get_highest_function_number() +{ +#if defined(__x86_64__) + unsigned int cpu_info[4] = {0}; + cpuid( VENDOR_ID, 0, cpu_info); + return cpu_info[ EAX_Reg ]; +#endif + return 0; +} + +// out of date +static inline void cpuid_get_highest_function( char* s ) +{ +#if defined(__x86_64__) + + uint32_t fn = cpuid_get_highest_function_number(); + switch (fn) + { + case 0x16: + strcpy( s, "Skylake" ); + break; + case 0xd: + strcpy( s, "IvyBridge" ); + break; + case 0xb: + strcpy( s, "Corei7" ); + break; + case 0xa: + strcpy( s, "Core2" ); + break; + default: + sprintf( s, "undefined %x", fn ); + } + +#else + s = NULL; +#endif +} + +// out of date +static inline void cpu_bestfeature(char *outbuf, size_t maxsz) +{ +#if defined(__arm__) || defined(__aarch64__) + sprintf(outbuf, "ARM"); +#else + int cpu_info[4] = { 0 }; + int cpu_info_adv[4] = { 0 }; + cpuid( CPU_INFO, 0, cpu_info ); + cpuid( EXTENDED_FEATURES, 0, cpu_info_adv ); + + if ( has_avx() && has_avx2() ) + sprintf(outbuf, "AVX2"); + else if ( has_avx() ) + sprintf(outbuf, "AVX"); + else if ( has_fma3() ) + sprintf(outbuf, "FMA3"); + else if ( has_xop() ) + sprintf(outbuf, "XOP"); + else if ( has_sse42() ) + sprintf(outbuf, "SSE42"); + else if ( has_sse2() ) + sprintf(outbuf, "SSE2"); + else if ( has_sse() ) + sprintf(outbuf, "SSE"); + else + *outbuf = '\0'; + +#endif +} + +static inline void cpu_brand_string( char* s ) +{ +#if defined(__x86_64__) + + int cpu_info[4] = { 0 }; + cpuid( VENDOR_ID, 0, cpu_info ); + if ( cpu_info[ EAX_Reg ] >= 4 ) + { + cpuid( CPU_BRAND_1, 0, cpu_info ); + memcpy( s, cpu_info, sizeof(cpu_info) ); + cpuid( CPU_BRAND_2, 0, cpu_info ); + memcpy( s + 16, cpu_info, sizeof(cpu_info) ); + cpuid( CPU_BRAND_3, 0, cpu_info ); + memcpy( s + 32, cpu_info, sizeof(cpu_info) ); + } + +#elif defined(__arm__) || defined(__aarch64__) + + sprintf( s, "ARM 64 bit CPU" ); + +#else + + sprintf( s, "unknown CPU architecture" ); + +#endif +} + +#endif // SYSINFOS_C__ + diff --git a/rin/miner/cpuminer/util.c b/rin/miner/cpuminer/util.c new file mode 100644 index 0000000..3f95af5 --- /dev/null +++ b/rin/miner/cpuminer/util.c @@ -0,0 +1,2681 @@ +/* + * Copyright 2010 Jeff Garzik + * Copyright 2012 Luke Dashjr + * Copyright 2012-2014 pooler + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. See COPYING for more details. + */ + +#define _GNU_SOURCE +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "sysinfos.c" +#include +#include +#include +//#include +#if defined(WIN32) +#include +#include +#include "compat/winansi.h" +#else +#include +#include +#include +#endif + +#ifndef _MSC_VER +/* dirname() linux/mingw, else in compat.h */ +#include +#endif + +#include "elist.h" +#include "algo-gate-api.h" +#include "algo/sha/sha256d.h" + +struct header_info { + char *lp_path; + char *reason; + char *stratum_url; + size_t content_length; +}; + +struct data_buffer { + void *buf; + size_t len; + size_t allocated; + struct header_info *headers; +}; + +struct tq_ent { + void *data; + struct list_head q_node; +}; + +struct thread_q { + struct list_head q; + + bool frozen; + + pthread_mutex_t mutex; + pthread_cond_t cond; +}; + +bool is_power_of_2( int n ) +{ + while ( n > 1 ) + { + if ( n % 2 != 0 ) return false; + n = n / 2; + } + return true; +} + +// Dsiplay prefix only with no colour & no nl, add more message and nl later +// with printf. +// No atomicity between prefix and message. +void applog_nl( const char *fmt, ... ) +{ + va_list ap; + va_start( ap, fmt ); + + int len = 64 + (int) strlen( fmt ) + 2; + struct tm tm; + char *f = (char*)malloc( len ); + time_t now = time(NULL); + localtime_r( &now, &tm ); + + sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec, + fmt + ); + pthread_mutex_lock( &applog_lock ); + vfprintf( stdout, f, ap ); /* atomic write to stdout */ + fflush( stdout ); + free( f ); + pthread_mutex_unlock( &applog_lock ); + va_end( ap ); +} + +void applog2( int prio, const char *fmt, ... ) +{ + va_list ap; + + va_start(ap, fmt); + +#ifdef HAVE_SYSLOG_H + if (use_syslog) { + va_list ap2; + char *buf; + int len; + + /* custom colors to syslog prio */ + if (prio > LOG_DEBUG) { + switch (prio) { + case LOG_BLUE: prio = LOG_NOTICE; break; + } + } + + va_copy(ap2, ap); + len = vsnprintf(NULL, 0, fmt, ap2) + 1; + va_end(ap2); + buf = alloca(len); + if (vsnprintf(buf, len, fmt, ap) >= 0) + syslog(prio, "%s", buf); + } +#else + if (0) {} +#endif + else { + const char* color = ""; + char *f; + int len; +// struct tm tm; +// time_t now = time(NULL); +// localtime_r(&now, &tm); + + switch ( prio ) + { + case LOG_CRIT: color = CL_LRD; break; + case LOG_ERR: color = CL_RED; break; + case LOG_WARNING: color = CL_YL2; break; + case LOG_MAJR: color = CL_YL2; break; + case LOG_NOTICE: color = CL_WHT; break; + case LOG_INFO: color = ""; break; + case LOG_DEBUG: color = CL_GRY; break; + case LOG_MINR: color = CL_YLW; break; + case LOG_GREEN: color = CL_GRN; prio = LOG_INFO; break; + case LOG_BLUE: color = CL_CYN; prio = LOG_NOTICE; break; + case LOG_PINK: color = CL_LMA; prio = LOG_NOTICE; break; + } + if (!use_colors) + color = ""; + + len = 64 + (int) strlen(fmt) + 2; + f = (char*) malloc(len); + sprintf(f, " %s %s%s\n", +// sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d]%s %s%s\n", +// tm.tm_year + 1900, +// tm.tm_mon + 1, +// tm.tm_mday, +// tm.tm_hour, +// tm.tm_min, +// tm.tm_sec, + color, + fmt, + use_colors ? CL_N : "" + ); + pthread_mutex_lock(&applog_lock); + vfprintf(stdout, f, ap); /* atomic write to stdout */ + fflush(stdout); + free(f); + pthread_mutex_unlock(&applog_lock); + } + va_end(ap); +} + + +void applog(int prio, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + +#ifdef HAVE_SYSLOG_H + if (use_syslog) { + va_list ap2; + char *buf; + int len; + + /* custom colors to syslog prio */ + if (prio > LOG_DEBUG) { + switch (prio) { + case LOG_BLUE: prio = LOG_NOTICE; break; + } + } + + va_copy(ap2, ap); + len = vsnprintf(NULL, 0, fmt, ap2) + 1; + va_end(ap2); + buf = alloca(len); + if (vsnprintf(buf, len, fmt, ap) >= 0) + syslog(prio, "%s", buf); + } +#else + if (0) {} +#endif + else { + const char* color = ""; + char *f; + int len; + struct tm tm; + time_t now = time(NULL); + char *bell = ""; + + localtime_r(&now, &tm); + + switch ( prio ) + { + case LOG_CRIT: color = CL_LRD; break; + case LOG_ERR: color = CL_RED; break; + case LOG_WARNING: color = CL_YL2; break; + case LOG_MAJR: color = CL_YL2; break; + case LOG_NOTICE: color = CL_WHT; break; + case LOG_INFO: color = ""; break; + case LOG_DEBUG: color = CL_GRY; break; + case LOG_MINR: color = CL_YLW; break; + case LOG_GREEN: color = CL_GRN; prio = LOG_INFO; break; + case LOG_BLUE: color = CL_CYN; prio = LOG_NOTICE; break; + case LOG_PINK: color = CL_LMA; prio = LOG_NOTICE; break; + } + if (!use_colors) + color = ""; + + if ( opt_bell && ( prio == LOG_WARNING || prio == LOG_ERR ) ) + *bell = ASCII_BELL; + + len = 64 + (int) strlen(fmt) + 2; + f = (char*) malloc(len); + sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d]%s %s%s\n", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec, + color, + fmt, + use_colors ? CL_N : "" + ); + pthread_mutex_lock(&applog_lock); + vfprintf(stdout, f, ap); /* atomic write to stdout */ + fflush(stdout); + free(f); + pthread_mutex_unlock(&applog_lock); + } + va_end(ap); +} + +void log_sw_err( char* filename, int line_number, char* msg ) +{ + applog( LOG_ERR, "SW_ERR: %s:%d, %s", filename, line_number, msg ); +} + +/* Get default config.json path (will be system specific) */ +void get_defconfig_path(char *out, size_t bufsize, char *argv0) +{ + char *cmd = strdup(argv0); + char *dir = dirname(cmd); + const char *sep = strstr(dir, "\\") ? "\\" : "/"; + struct stat info = { 0 }; +#ifdef WIN32 + snprintf(out, bufsize, "%s\\cpuminer\\cpuminer-conf.json", getenv("APPDATA")); +#else + snprintf(out, bufsize, "%s\\.cpuminer\\cpuminer-conf.json", getenv("HOME")); +#endif + if (dir && stat(out, &info) != 0) { + snprintf(out, bufsize, "%s%scpuminer-conf.json", dir, sep); + } + if (stat(out, &info) != 0) { + out[0] = '\0'; + return; + } + out[bufsize - 1] = '\0'; + free(cmd); +} + + +void format_hashrate(double hashrate, char *output) +{ + char prefix = '\0'; + + if (hashrate < 10000) { + // nop + } + else if (hashrate < 1e7) { + prefix = 'k'; + hashrate *= 1e-3; + } + else if (hashrate < 1e10) { + prefix = 'M'; + hashrate *= 1e-6; + } + else if (hashrate < 1e13) { + prefix = 'G'; + hashrate *= 1e-9; + } + else { + prefix = 'T'; + hashrate *= 1e-12; + } + + sprintf( + output, + prefix ? "%.2f %cH/s" : "%.2f H/s%c", + hashrate, prefix + ); +} + +// For use with MiB etc +void format_number_si( double* n, char* si_units ) +{ + if ( *n < 1024*10 ) { *si_units = 0; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'k'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'M'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'G'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'T'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'P'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'E'; return; } + *n /= 1024; + if ( *n < 1024*10 ) { *si_units = 'Z'; return; } + *n /= 1024; + *si_units = 'Y'; +} + + +/* Modify the representation of integer numbers which would cause an overflow + * so that they are treated as floating-point numbers. + * This is a hack to overcome the limitations of some versions of Jansson. */ +static char *hack_json_numbers(const char *in) +{ + char *out; + int i, off, intoff; + bool in_str, in_int; + + out = (char*) calloc(2 * strlen(in) + 1, 1); + if (!out) + return NULL; + off = intoff = 0; + in_str = in_int = false; + for (i = 0; in[i]; i++) { + char c = in[i]; + if (c == '"') { + in_str = !in_str; + } else if (c == '\\') { + out[off++] = c; + if (!in[++i]) + break; + } else if (!in_str && !in_int && isdigit(c)) { + intoff = off; + in_int = true; + } else if (in_int && !isdigit(c)) { + if (c != '.' && c != 'e' && c != 'E' && c != '+' && c != '-') { + in_int = false; + if (off - intoff > 4) { + char *end; +#if JSON_INTEGER_IS_LONG_LONG + errno = 0; + strtoll(out + intoff, &end, 10); + if (!*end && errno == ERANGE) { +#else + long l; + errno = 0; + l = strtol(out + intoff, &end, 10); + if (!*end && (errno == ERANGE || l > INT_MAX)) { +#endif + out[off++] = '.'; + out[off++] = '0'; + } + } + } + } + out[off++] = in[i]; + } + return out; +} + +static void databuf_free(struct data_buffer *db) +{ + if (!db) + return; + + free(db->buf); + + memset(db, 0, sizeof(*db)); +} + +static size_t all_data_cb(const void *ptr, size_t size, size_t nmemb, + void *user_data) +{ + struct data_buffer *db = user_data; + size_t len = size * nmemb; + size_t newalloc, reqalloc; + void *newmem; + static const unsigned char zero = 0; + static const size_t max_realloc_increase = 8 * 1024 * 1024; + static const size_t initial_alloc = 16 * 1024; + + /* minimum required allocation size */ + reqalloc = db->len + len + 1; + + if (reqalloc > db->allocated) { + if (db->len > 0) { + newalloc = db->allocated * 2; + } else { + if (db->headers->content_length > 0) + newalloc = db->headers->content_length + 1; + else + newalloc = initial_alloc; + } + + if (db->headers->content_length == 0) { + /* limit the maximum buffer increase */ + if (newalloc - db->allocated > max_realloc_increase) + newalloc = db->allocated + max_realloc_increase; + } + + /* ensure we have a big enough allocation */ + if (reqalloc > newalloc) + newalloc = reqalloc; + + newmem = realloc(db->buf, newalloc); + if (!newmem) + return 0; + + db->buf = newmem; + db->allocated = newalloc; + } + + memcpy(db->buf + db->len, ptr, len); /* append new data */ + memcpy(db->buf + db->len + len, &zero, 1); /* null terminate */ + + db->len += len; + + return len; +} + +static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data) +{ + struct header_info *hi = (struct header_info *) user_data; + size_t remlen, slen, ptrlen = size * nmemb; + char *rem, *val = NULL, *key = NULL; + void *tmp; + + val = (char*) calloc(1, ptrlen); + key = (char*) calloc(1, ptrlen); + if (!key || !val) + goto out; + + tmp = memchr(ptr, ':', ptrlen); + if (!tmp || (tmp == ptr)) /* skip empty keys / blanks */ + goto out; + slen = (char*)tmp - (char*)ptr; + if ((slen + 1) == ptrlen) /* skip key w/ no value */ + goto out; + memcpy(key, ptr, slen); /* store & nul term key */ + key[slen] = 0; + + rem = (char*)ptr + slen + 1; /* trim value's leading whitespace */ + remlen = ptrlen - slen - 1; + while ((remlen > 0) && (isspace(*rem))) { + remlen--; + rem++; + } + + memcpy(val, rem, remlen); /* store value, trim trailing ws */ + val[remlen] = 0; + while ((*val) && (isspace(val[strlen(val) - 1]))) { + val[strlen(val) - 1] = 0; + } + + if (!strcasecmp("X-Long-Polling", key)) { + hi->lp_path = val; /* steal memory reference */ + val = NULL; + } + + if (!strcasecmp("X-Reject-Reason", key)) { + hi->reason = val; /* steal memory reference */ + val = NULL; + } + + if (!strcasecmp("X-Stratum", key)) { + hi->stratum_url = val; /* steal memory reference */ + val = NULL; + } + + if (!strcasecmp("Content-Length", key)) + hi->content_length = strtoul(val, NULL, 10); + +out: + free(key); + free(val); + return ptrlen; +} + +#if LIBCURL_VERSION_NUM >= 0x070f06 +static int sockopt_keepalive_cb(void *userdata, curl_socket_t fd, + curlsocktype purpose) +{ +#ifdef __linux + int tcp_keepcnt = 3; +#endif + int tcp_keepintvl = 50; + int tcp_keepidle = 50; +#ifndef WIN32 + int keepalive = 1; + if (unlikely(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, + sizeof(keepalive)))) + return 1; +#ifdef __linux + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPCNT, + &tcp_keepcnt, sizeof(tcp_keepcnt)))) + return 1; + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, + &tcp_keepidle, sizeof(tcp_keepidle)))) + return 1; + if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, + &tcp_keepintvl, sizeof(tcp_keepintvl)))) + return 1; +#endif /* __linux */ +#ifdef __APPLE_CC__ + if (unlikely(setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, + &tcp_keepintvl, sizeof(tcp_keepintvl)))) + return 1; +#endif /* __APPLE_CC__ */ +#else /* WIN32 */ + struct tcp_keepalive vals; + vals.onoff = 1; + vals.keepalivetime = tcp_keepidle * 1000; + vals.keepaliveinterval = tcp_keepintvl * 1000; + DWORD outputBytes; + if (unlikely(WSAIoctl(fd, SIO_KEEPALIVE_VALS, &vals, sizeof(vals), + NULL, 0, &outputBytes, NULL, NULL))) + return 1; +#endif /* WIN32 */ + + return 0; +} +#endif + +json_t *json_rpc_call(CURL *curl, const char *url, + const char *userpass, const char *rpc_req, + int *curl_err, int flags) +{ + json_t *val, *err_val, *res_val; + int rc; + long http_rc; + struct data_buffer all_data = {0}; + char *json_buf; + json_error_t err; + struct curl_slist *headers = NULL; + char curl_err_str[CURL_ERROR_SIZE] = { 0 }; + long timeout = (flags & JSON_RPC_LONGPOLL) ? opt_timeout : 30; + struct header_info hi = {0}; + + all_data.headers = &hi; + /* it is assumed that 'curl' is freshly [re]initialized at this pt */ + + if (opt_protocol) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, url); + if (opt_cert) curl_easy_setopt(curl, CURLOPT_CAINFO, opt_cert); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); + curl_easy_setopt(curl, CURLOPT_ENCODING, ""); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); + if (opt_redirect) curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb); + curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi); + if (opt_proxy) + { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } + if (userpass) + { + curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + } +#if LIBCURL_VERSION_NUM >= 0x070f06 + if (flags & JSON_RPC_LONGPOLL) + curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb); +#endif + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, rpc_req); + + if (opt_protocol) + applog(LOG_DEBUG, "JSON protocol request:\n%s\n", rpc_req); + + headers = curl_slist_append(headers, "Content-Type: application/json"); + headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); + headers = curl_slist_append(headers, "X-Mining-Extensions: longpoll reject-reason"); + //headers = curl_slist_append(headers, "Accept:"); // disable Accept hdr + //headers = curl_slist_append(headers, "Expect:"); // disable Expect hdr + + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + + rc = curl_easy_perform(curl); + if (curl_err != NULL) + *curl_err = rc; + if (rc) { + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_rc); + if (!((flags & JSON_RPC_LONGPOLL) && rc == CURLE_OPERATION_TIMEDOUT) && + !((flags & JSON_RPC_QUIET_404) && http_rc == 404)) + applog(LOG_ERR, "HTTP request failed: %s", curl_err_str); + if (curl_err && (flags & JSON_RPC_QUIET_404) && http_rc == 404) + *curl_err = CURLE_OK; + goto err_out; + } + +// want_stratum is useless, and so is this code it seems. Nothing in +// hi appears to be set. + /* If X-Stratum was found, activate Stratum */ + if (want_stratum && hi.stratum_url && + !strncasecmp(hi.stratum_url, "stratum+tcp://", 14)) { + have_stratum = true; + tq_push(thr_info[stratum_thr_id].q, hi.stratum_url); + hi.stratum_url = NULL; + } + + /* If X-Long-Polling was found, activate long polling */ + if (!have_longpoll && want_longpoll && hi.lp_path && !have_gbt && + allow_getwork && !have_stratum) { + have_longpoll = true; + tq_push(thr_info[longpoll_thr_id].q, hi.lp_path); + hi.lp_path = NULL; + } + + if (!all_data.buf) { + applog(LOG_ERR, "Empty data received in json_rpc_call."); + goto err_out; + } + + json_buf = hack_json_numbers((char*) all_data.buf); + errno = 0; /* needed for Jansson < 2.1 */ + val = JSON_LOADS(json_buf, &err); + free(json_buf); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto err_out; + } + + if (opt_protocol) { + char *s = json_dumps(val, JSON_INDENT(3)); + applog(LOG_DEBUG, "JSON protocol response:\n%s", s); + free(s); + } + + /* JSON-RPC valid response returns a 'result' and a null 'error'. */ + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || (err_val && !json_is_null(err_val) + && !(flags & JSON_RPC_IGNOREERR))) { + + char *s = NULL; + + if (err_val) { + s = json_dumps(err_val, 0); + json_t *msg = json_object_get(err_val, "message"); + json_t *err_code = json_object_get(err_val, "code"); + if (curl_err && json_integer_value(err_code)) + *curl_err = (int)json_integer_value(err_code); + + if (msg && json_is_string(msg)) { + free(s); + s = strdup(json_string_value(msg)); + if (have_longpoll && s && !strcmp(s, "method not getwork")) { + json_decref(err_val); + free(s); + goto err_out; + } + } + json_decref(err_val); + } + else + s = strdup("(unknown reason)"); + + if (!curl_err || opt_debug) + applog(LOG_ERR, "JSON-RPC call failed: %s", s); + + free(s); + + goto err_out; + } + + if (hi.reason) + json_object_set_new(val, "reject-reason", json_string(hi.reason)); + + databuf_free(&all_data); + curl_slist_free_all(headers); + curl_easy_reset(curl); + return val; + +err_out: + free(hi.lp_path); + free(hi.reason); + free(hi.stratum_url); + databuf_free(&all_data); + curl_slist_free_all(headers); + curl_easy_reset(curl); + return NULL; +} + +/* used to load a remote config */ +json_t* json_load_url(char* cfg_url, json_error_t *err) +{ + char err_str[CURL_ERROR_SIZE] = { 0 }; + struct data_buffer all_data = { 0 }; + int rc = 0; json_t *cfg = NULL; + CURL *curl = curl_easy_init(); + if (unlikely(!curl)) { + applog(LOG_ERR, "Remote config init failed!"); + return NULL; + } + curl_easy_setopt(curl, CURLOPT_URL, cfg_url); + curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, err_str); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); + if (opt_proxy) { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } else if (getenv("http_proxy")) { + if (getenv("all_proxy")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("all_proxy")); + else if (getenv("ALL_PROXY")) + curl_easy_setopt(curl, CURLOPT_PROXY, getenv("ALL_PROXY")); + else + curl_easy_setopt(curl, CURLOPT_PROXY, ""); + } + rc = curl_easy_perform(curl); + if (rc) { + applog(LOG_ERR, "Remote config read failed: %s", err_str); + goto err_out; + } + if (!all_data.buf || !all_data.len) { + applog(LOG_ERR, "Empty data received for config"); + goto err_out; + } + + cfg = JSON_LOADS((char*)all_data.buf, err); +err_out: + curl_easy_cleanup(curl); + return cfg; +} + +void memrev(unsigned char *p, size_t len) +{ + if ( len == 32 ) + { + v128u32_t *pv = (v128_t*)p; + v128u32_t t = v128_bswap128( pv[0] ); + pv[0] = v128_bswap128( pv[1] ); + pv[1] = t; + } + else + { + unsigned char c, *q; + for (q = p + len - 1; p < q; p++, q--) + { + c = *p; + *p = *q; + *q = c; + } + } +} + +void cbin2hex(char *out, const char *in, size_t len) +{ + if (out) { + unsigned int i; + for (i = 0; i < len; i++) + sprintf(out + (i * 2), "%02x", (uint8_t)in[i]); + } +} + +void bin2hex(char *s, const unsigned char *p, size_t len) +{ + for (size_t i = 0; i < len; i++) + sprintf(s + (i * 2), "%02x", (unsigned int) p[i]); +} + +char *abin2hex(const unsigned char *p, size_t len) +{ + char *s = (char*) malloc((len * 2) + 1); + if (!s) + return NULL; + bin2hex(s, p, len); + return s; +} + +char *bebin2hex(const unsigned char *p, size_t len) +{ + char *s = (char*) malloc((len * 2) + 1); + if (!s) return NULL; + for ( size_t i = 0, j = len - 1; i < len; i++, j-- ) + sprintf( s + ( i*2 ), "%02x", (unsigned int) p[ j ] ); + return s; +} + +bool hex2bin( unsigned char *p, const char *hexstr, const size_t len ) +{ + if( hexstr == NULL ) return false; + + size_t hexstr_len = strlen( hexstr ); + if( ( hexstr_len % 2 ) != 0 ) + { + applog( LOG_ERR, "hex2bin string truncated" ); + return false; + } + size_t bin_len = hexstr_len / 2; + if ( bin_len > len ) + { + applog( LOG_ERR, "hex2bin buffer too small" ); + return false; + } + + memset( p, 0, len ); + size_t i = 0; + while ( i < hexstr_len ) + { + char c = hexstr[i]; + unsigned char nibble; + if ( c >= '0' && c <= '9' ) nibble = (c - '0'); + else if ( c >= 'A' && c <= 'F' ) nibble = ( 10 + (c - 'A') ); + else if ( c >= 'a' && c <= 'f' ) nibble = ( 10 + (c - 'a') ); + else + { + applog( LOG_ERR, "hex2bin invalid hex" ); + return false; + } + p[(i / 2)] |= (nibble << ( (1 - (i % 2) ) * 4) ); + i++; + } + + return true; +} + +int varint_encode(unsigned char *p, uint64_t n) +{ + int i; + if (n < 0xfd) { + p[0] = (uchar) n; + return 1; + } + if (n <= 0xffff) { + p[0] = 0xfd; + p[1] = n & 0xff; + p[2] = (uchar) (n >> 8); + return 3; + } + if (n <= 0xffffffff) { + p[0] = 0xfe; + for (i = 1; i < 5; i++) { + p[i] = n & 0xff; + n >>= 8; + } + return 5; + } + p[0] = 0xff; + for (i = 1; i < 9; i++) { + p[i] = n & 0xff; + n >>= 8; + } + return 9; +} + +static const char b58digits[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + +static bool b58dec(unsigned char *bin, size_t binsz, const char *b58) +{ + size_t i, j; + uint64_t t; + uint32_t c; + uint32_t *outi; + size_t outisz = (binsz + 3) / 4; + int rem = binsz % 4; + uint32_t remmask = 0xffffffff << (8 * rem); + size_t b58sz = strlen(b58); + bool rc = false; + + outi = (uint32_t *) calloc(outisz, sizeof(*outi)); + + for (i = 0; i < b58sz; ++i) { + for (c = 0; b58digits[c] != b58[i]; c++) + if (!b58digits[c]) + goto out; + for (j = outisz; j--; ) { + t = (uint64_t)outi[j] * 58 + c; + c = t >> 32; + outi[j] = t & 0xffffffff; + } + if (c || outi[0] & remmask) + goto out; + } + + j = 0; + switch (rem) { + case 3: + *(bin++) = (outi[0] >> 16) & 0xff; + case 2: + *(bin++) = (outi[0] >> 8) & 0xff; + case 1: + *(bin++) = outi[0] & 0xff; + ++j; + default: + break; + } + for (; j < outisz; ++j) { + be32enc((uint32_t *)bin, outi[j]); + bin += sizeof(uint32_t); + } + + rc = true; +out: + free(outi); + return rc; +} + +static int b58check(unsigned char *bin, size_t binsz, const char *b58) +{ + unsigned char buf[32]; + int i; + + sha256d(buf, bin, (int) (binsz - 4)); + if (memcmp(&bin[binsz - 4], buf, 4)) + return -1; + + /* Check number of zeros is correct AFTER verifying checksum + * (to avoid possibility of accessing the string beyond the end) */ + for (i = 0; bin[i] == '\0' && b58[i] == '1'; ++i); + if (bin[i] == '\0' || b58[i] == '1') + return -3; + + return bin[0]; +} + +bool jobj_binary(const json_t *obj, const char *key, void *buf, size_t buflen) +{ + const char *hexstr; + json_t *tmp; + + tmp = json_object_get(obj, key); + if (unlikely(!tmp)) { + applog(LOG_ERR, "JSON key '%s' not found", key); + return false; + } + hexstr = json_string_value(tmp); + if (unlikely(!hexstr)) { + applog(LOG_ERR, "JSON key '%s' is not a string", key); + return false; + } + if (!hex2bin((uchar*) buf, hexstr, buflen)) + return false; + + return true; +} + +static uint32_t bech32_polymod_step(uint32_t pre) { + uint8_t b = pre >> 25; + return ((pre & 0x1FFFFFF) << 5) ^ + (-((b >> 0) & 1) & 0x3b6a57b2UL) ^ + (-((b >> 1) & 1) & 0x26508e6dUL) ^ + (-((b >> 2) & 1) & 0x1ea119faUL) ^ + (-((b >> 3) & 1) & 0x3d4233ddUL) ^ + (-((b >> 4) & 1) & 0x2a1462b3UL); +} + +static const int8_t bech32_charset_rev[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 15, -1, 10, 17, 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1, + -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, + 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1, + -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, + 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1 +}; + +static bool bech32_decode(char *hrp, uint8_t *data, size_t *data_len, const char *input) { + uint32_t chk = 1; + size_t i; + size_t input_len = strlen(input); + size_t hrp_len; + int have_lower = 0, have_upper = 0; + if (input_len < 8 || input_len > 90) { + return false; + } + *data_len = 0; + while (*data_len < input_len && input[(input_len - 1) - *data_len] != '1') { + ++(*data_len); + } + hrp_len = input_len - (1 + *data_len); + if (1 + *data_len >= input_len || *data_len < 6) { + return false; + } + *(data_len) -= 6; + for (i = 0; i < hrp_len; ++i) { + int ch = input[i]; + if (ch < 33 || ch > 126) { + return false; + } + if (ch >= 'a' && ch <= 'z') { + have_lower = 1; + } else if (ch >= 'A' && ch <= 'Z') { + have_upper = 1; + ch = (ch - 'A') + 'a'; + } + hrp[i] = ch; + chk = bech32_polymod_step(chk) ^ (ch >> 5); + } + hrp[i] = 0; + chk = bech32_polymod_step(chk); + for (i = 0; i < hrp_len; ++i) { + chk = bech32_polymod_step(chk) ^ (input[i] & 0x1f); + } + ++i; + while (i < input_len) { + int v = (input[i] & 0x80) ? -1 : bech32_charset_rev[(int)input[i]]; + if (input[i] >= 'a' && input[i] <= 'z') have_lower = 1; + if (input[i] >= 'A' && input[i] <= 'Z') have_upper = 1; + if (v == -1) { + return false; + } + chk = bech32_polymod_step(chk) ^ v; + if (i + 6 < input_len) { + data[i - (1 + hrp_len)] = v; + } + ++i; + } + if (have_lower && have_upper) { + return false; + } + return chk == 1; +} + +static bool convert_bits(uint8_t *out, size_t *outlen, int outbits, const uint8_t *in, size_t inlen, int inbits, int pad) { + uint32_t val = 0; + int bits = 0; + uint32_t maxv = (((uint32_t)1) << outbits) - 1; + while (inlen--) { + val = (val << inbits) | *(in++); + bits += inbits; + while (bits >= outbits) { + bits -= outbits; + out[(*outlen)++] = (val >> bits) & maxv; + } + } + if (pad) { + if (bits) { + out[(*outlen)++] = (val << (outbits - bits)) & maxv; + } + } else if (((val << (outbits - bits)) & maxv) || bits >= inbits) { + return false; + } + return true; +} + +static bool segwit_addr_decode(int *witver, uint8_t *witdata, size_t *witdata_len, const char *addr) { + uint8_t data[84]; + char hrp_actual[84]; + size_t data_len; + if (!bech32_decode(hrp_actual, data, &data_len, addr)) return false; + if (data_len == 0 || data_len > 65) return false; + if (data[0] > 16) return false; + *witdata_len = 0; + if (!convert_bits(witdata, witdata_len, 8, data + 1, data_len - 1, 5, 0)) return false; + if (*witdata_len < 2 || *witdata_len > 40) return false; + if (data[0] == 0 && *witdata_len != 20 && *witdata_len != 32) return false; + *witver = data[0]; + return true; +} + +static size_t bech32_to_script(uint8_t *out, size_t outsz, const char *addr) { + uint8_t witprog[40]; + size_t witprog_len; + int witver; + + if (!segwit_addr_decode(&witver, witprog, &witprog_len, addr)) + return 0; + if (outsz < witprog_len + 2) + return 0; + out[0] = witver ? (0x50 + witver) : 0; + out[1] = witprog_len; + memcpy(out + 2, witprog, witprog_len); + + if ( opt_debug ) + applog( LOG_INFO, "Coinbase address uses Bech32 coding"); + + return witprog_len + 2; +} + +size_t address_to_script( unsigned char *out, size_t outsz, const char *addr ) +{ + unsigned char addrbin[ pk_buffer_size_max ]; + int addrver; + size_t rv; + + if ( !b58dec( addrbin, outsz, addr ) ) + return bech32_to_script( out, outsz, addr ); + + addrver = b58check( addrbin, outsz, addr ); + if ( addrver < 0 ) + return 0; + + if ( opt_debug ) + applog( LOG_INFO, "Coinbase address uses B58 coding"); + + switch ( addrver ) + { + case 5: /* Bitcoin script hash */ + case 196: /* Testnet script hash */ + if ( outsz < ( rv = 23 ) ) + return rv; + out[ 0] = 0xa9; /* OP_HASH160 */ + out[ 1] = 0x14; /* push 20 bytes */ + memcpy( &out[2], &addrbin[1], 20 ); + out[22] = 0x87; /* OP_EQUAL */ + return rv; + default: + if (outsz < (rv = 25)) + return rv; + out[ 0] = 0x76; /* OP_DUP */ + out[ 1] = 0xa9; /* OP_HASH160 */ + out[ 2] = 0x14; /* push 20 bytes */ + memcpy( &out[3], &addrbin[1], 20 ); + out[23] = 0x88; /* OP_EQUALVERIFY */ + out[24] = 0xac; /* OP_CHECKSIG */ + return rv; + } +} + +/* Subtract the `struct timeval' values X and Y, + storing the result in RESULT. + Return 1 if the difference is negative, otherwise 0. */ +int timeval_subtract(struct timeval *result, struct timeval *x, + struct timeval *y) +{ + /* Perform the carry for the later subtraction by updating Y. */ + if (x->tv_usec < y->tv_usec) { + int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + y->tv_usec -= 1000000 * nsec; + y->tv_sec += nsec; + } + if (x->tv_usec - y->tv_usec > 1000000) { + int nsec = (x->tv_usec - y->tv_usec) / 1000000; + y->tv_usec += 1000000 * nsec; + y->tv_sec -= nsec; + } + + /* Compute the time remaining to wait. + * `tv_usec' is certainly positive. */ + result->tv_sec = x->tv_sec - y->tv_sec; + result->tv_usec = x->tv_usec - y->tv_usec; + + /* Return 1 if result is negative. */ + return x->tv_sec < y->tv_sec; +} + +// Deprecated +bool fulltest( const uint32_t *hash, const uint32_t *target ) +{ + int i; + bool rc = true; + + for ( i = 7; i >= 0; i-- ) + { + if ( hash[i] > target[i] ) + { + rc = false; + break; + } + if ( hash[i] < target[i] ) + { + rc = true; + break; + } + } + + if ( opt_debug ) + { + uint32_t hash_be[8], target_be[8]; + char hash_str[65], target_str[65]; + + for ( i = 0; i < 8; i++ ) + { + be32enc( hash_be + i, hash[7 - i] ); + be32enc( target_be + i, target[7 - i] ); + } + bin2hex( hash_str, (unsigned char *)hash_be, 32 ); + bin2hex( target_str, (unsigned char *)target_be, 32 ); + + applog( LOG_DEBUG, "DEBUG: %s\nHash: %s\nTarget: %s", + rc ? "hash <= target" + : "hash > target (false positive)", + hash_str, target_str ); + } + return rc; +} + +// Mathmatically the difficulty is simply the reciprocal of the hash: d = 1/h. +// Both are real numbers but the hash (target) is represented as a 256 bit +// fixed point number with the upper 32 bits representing the whole integer +// part and the lower 224 bits representing the fractional part: +// target[ 255:224 ] = trunc( 1/diff ) +// target[ 223: 0 ] = frac( 1/diff ) +// +// The 256 bit hash is exact but any floating point representation is not. +// Stratum provides the target difficulty as double precision, inexcact, +// which must be converted to a hash target. The converted hash target will +// likely be less precise due to inexact input and conversion error. +// On the other hand getwork provides a 256 bit hash target which is exact. +// +// How much precision is needed? +// +// 128 bit types are implemented in software by the compiler on 64 bit +// hardware resulting in lower performance and more error than would be +// expected with a hardware 128 bit implementaion. +// Float80 exploits the internals of the FP unit which provide a 64 bit +// mantissa in an 80 bit register with hardware rounding. When the destination +// is double the data is rounded to float64 format. Long double returns all +// 80 bits without rounding and including any accumulated computation error. +// Float80 does not fit efficiently in memory. +// +// Significant digits: +// 256 bit hash: 76 +// float: 7 (float32, 80 bits with rounding to 32 bits) +// double: 15 (float64, 80 bits with rounding to 64 bits) +// long double: 19 (float80, 80 bits with no rounding) +// __float128: 33 (128 bits with no rounding) +// uint32_t: 9 +// uint64_t: 19 +// uint128_t 38 +// +// The concept of significant digits doesn't apply to the 256 bit hash +// representation. It's fixed point making leading zeros significant, +// limiting its range and precision due to fewer zon-zero significant digits. +// +// Doing calculations with float128 and uint128 increases precision for +// target_to_diff, but doesn't help with stratum diff being limited to +// double precision. Is the extra precision really worth the extra cost? +// With float128 the error rate is 1/1e33 compared with 1/1e15 for double. +// For double that's 1 error in every petahash with a very low difficulty, +// not a likely situation. With higher difficulty effective precision +// increases. +// +// Unfortunately I can't get float128 to work so long double (float80) is +// as precise as it gets. +// All calculations will be done using long double then converted to double. +// This prevents introducing significant new error while taking advantage +// of HW rounding. + +#if defined(GCC_INT128) + +void diff_to_hash( uint32_t *target, const double diff ) +{ + uint128_t *targ = (uint128_t*)target; + register long double m = 1. / diff; +// targ[0] = 0; + targ[0] = -1; + targ[1] = (uint128_t)( m * exp96 ); +} + +double hash_to_diff( const void *target ) +{ + const uint128_t *targ = (const uint128_t*)target; + register long double m = ( (long double)targ[1] / exp96 ); +// + ( (long double)targ[0] / exp160 ); + return (double)( 1. / m ); +} + +inline bool valid_hash( const void *hash, const void *target ) +{ + const uint128_t *h = (const uint128_t*)hash; + const uint128_t *t = (const uint128_t*)target; + if ( h[1] > t[1] ) return false; + if ( h[1] < t[1] ) return true; + if ( h[0] > t[0] ) return false; + return true; +} + +#else + +void diff_to_hash( uint32_t *target, const double diff ) +{ + uint64_t *targ = (uint64_t*)target; + register long double m = ( 1. / diff ) * exp32; +// targ[1] = targ[0] = 0; + targ[1] = targ[0] = -1; + targ[3] = (uint64_t)m; + targ[2] = (uint64_t)( ( m - (long double)targ[3] ) * exp64 ); +} + +double hash_to_diff( const void *target ) +{ + const uint64_t *targ = (const uint64_t*)target; + register long double m = ( (long double)targ[3] / exp32 ) + + ( (long double)targ[2] / exp96 ); + return (double)( 1. / m ); +} + +inline bool valid_hash( const void *hash, const void *target ) +{ + const uint64_t *h = (const uint64_t*)hash; + const uint64_t *t = (const uint64_t*)target; + if ( h[3] > t[3] ) return false; + if ( h[3] < t[3] ) return true; + if ( h[2] > t[2] ) return false; + if ( h[2] < t[2] ) return true; + if ( h[1] > t[1] ) return false; + if ( h[1] < t[1] ) return true; + if ( h[0] > t[0] ) return false; + return true; +} + +#endif + +inline double nbits_to_diff( uint32_t nbits ) +{ + long double diff; + uint32_t shift = nbits & 0xff; + uint32_t bits = bswap_32( nbits ) & 0x00ffffff; + int shift_off = (int)shift - 29; + + // diff = ( (2**16 -1) / ( 256**shift_off * bits ) + // With uint128 byte shift is good for 16 <= shift <= 41. As unlikely + // as this may seem necessary, check just in case. + + if ( shift_off >= -13 && shift_off <= 12 ) + { // fast + if ( shift_off == 0 ) + diff = (long double)0xffff / (long double)bits; + else if ( shift_off < 0 ) // shift < 29 + diff = (long double)( (uint128_t)0xffff << ( (-shift_off) *8 ) ) + / (long double)bits; + else // ( shift_off > 0 ) // shift > 29 + diff = (long double)0xffff + / (long double)( (uint128_t)bits << ( shift_off*8 ) ); + } + else + { // slow + int m; + diff = 0.; + for ( m = shift; m < 29; m++ ) diff *= 256.0; + for ( m = 29; m < shift; m++ ) diff /= 256.0; + } + + if ( opt_debug ) + applog( LOG_INFO, "nbits %08x: shift %u(%d), bits %06x, diff %8g", + nbits, shift, shift_off, bits, (double)diff ); + + return (double)diff; +} + +#ifdef WIN32 +#define socket_blocks() (WSAGetLastError() == WSAEWOULDBLOCK) +#else +#define socket_blocks() (errno == EAGAIN || errno == EWOULDBLOCK) +#endif + +static bool send_line( struct stratum_ctx *sctx, char *s ) +{ + size_t sent = 0; + int len; + + len = (int) strlen(s); + s[len++] = '\n'; + + while ( len > 0 ) + { + struct timeval timeout = {0, 0}; + int n; + fd_set wd; + +// Something nasty going on With Windows on aarch64. This hack prevents +// corrupting the sctx pointer. This only works if placed inside the while loop. +#if defined(__aarch64__) && defined(WIN32) && defined(ARM_WIN_HACK) + printf(""); +#endif + + FD_ZERO( &wd ); + FD_SET( sctx->sock, &wd ); + if ( select( (int) ( sctx->sock + 1 ), NULL, &wd, NULL, &timeout ) < 1 ) + return false; + +#if LIBCURL_VERSION_NUM >= 0x071802 + + CURLcode rc = curl_easy_send(sctx->curl, s + sent, len, (size_t *)&n); + if ( rc != CURLE_OK ) + { + if ( rc != CURLE_AGAIN ) +#else + n = send( sctx->sock, s + sent, len, 0); + if ( n < 0 ) + { + if ( !socket_blocks() ) +#endif + return false; + n = 0; + } + sent += n; + len -= n; + } + + return true; +} + +bool stratum_send_line(struct stratum_ctx *sctx, char *s) +{ + bool ret = false; + + if (opt_protocol) + applog(LOG_DEBUG, "> %s", s); + + pthread_mutex_lock(&sctx->sock_lock); + ret = send_line( sctx, s ); + pthread_mutex_unlock(&sctx->sock_lock); + + return ret; +} + +static bool socket_full(curl_socket_t sock, int timeout) +{ + struct timeval tv; + fd_set rd; + + FD_ZERO(&rd); + FD_SET(sock, &rd); + tv.tv_sec = timeout; + tv.tv_usec = 0; + if (select((int)(sock + 1), &rd, NULL, NULL, &tv) > 0) + return true; + return false; +} + +bool stratum_socket_full(struct stratum_ctx *sctx, int timeout) +{ + return strlen(sctx->sockbuf) || socket_full(sctx->sock, timeout); +} + +#define RBUFSIZE 2048 +#define RECVSIZE (RBUFSIZE - 4) + +static void stratum_buffer_append(struct stratum_ctx *sctx, const char *s) +{ + size_t old, n; + + old = strlen(sctx->sockbuf); + n = old + strlen(s) + 1; + if (n >= sctx->sockbuf_size) { + sctx->sockbuf_size = n + (RBUFSIZE - (n % RBUFSIZE)); + sctx->sockbuf = (char*) realloc(sctx->sockbuf, sctx->sockbuf_size); + } + strcpy(sctx->sockbuf + old, s); +} + +char *stratum_recv_line(struct stratum_ctx *sctx) +{ + ssize_t len, buflen; + char *tok, *sret = NULL; + + if (!strstr(sctx->sockbuf, "\n")) { + bool ret = true; + time_t rstart; + + time(&rstart); + if (!socket_full(sctx->sock, 60)) { + applog(LOG_WARNING, "stratum_recv_line timed out"); + goto out; + } + do { + char s[RBUFSIZE]; + ssize_t n; + + memset(s, 0, RBUFSIZE); + +#if LIBCURL_VERSION_NUM >= 0x071802 + + CURLcode rc = curl_easy_recv(sctx->curl, s, RECVSIZE, (size_t *)&n); + if (rc == CURLE_OK && !n) { + ret = false; + break; + } + if (rc != CURLE_OK) { + if (rc != CURLE_AGAIN || !socket_full(sctx->sock, 1)) { +#else + + n = recv(sctx->sock, s, RECVSIZE, 0); + if (!n) { + ret = false; + break; + } + if (n < 0) { + if (!socket_blocks() || !socket_full(sctx->sock, 1)) { +#endif + ret = false; + break; + } + } else + stratum_buffer_append(sctx, s); + } while (time(NULL) - rstart < 60 && !strstr(sctx->sockbuf, "\n")); + + if (!ret) { + applog(LOG_WARNING, "stratum_recv_line failed"); + goto out; + } + } + + buflen = (ssize_t) strlen(sctx->sockbuf); + tok = strtok(sctx->sockbuf, "\n"); + if (!tok) { + applog(LOG_ERR, "stratum_recv_line failed to parse a newline-terminated string"); + goto out; + } + sret = strdup(tok); + len = (ssize_t) strlen(sret); + + if (buflen > len + 1) + memmove(sctx->sockbuf, sctx->sockbuf + len + 1, buflen - len + 1); + else + sctx->sockbuf[0] = '\0'; + +out: + if (sret && opt_protocol) + applog(LOG_DEBUG, "< %s", sret); + return sret; +} + +#if LIBCURL_VERSION_NUM >= 0x071101 && LIBCURL_VERSION_NUM < 0x072d00 +//#if LIBCURL_VERSION_NUM >= 0x071101 +static curl_socket_t opensocket_grab_cb(void *clientp, curlsocktype purpose, + struct curl_sockaddr *addr) +{ + curl_socket_t *sock = (curl_socket_t*) clientp; + *sock = socket(addr->family, addr->socktype, addr->protocol); + return *sock; +} +#endif + +bool stratum_connect(struct stratum_ctx *sctx, const char *url) +{ + CURL *curl; + int rc; + + pthread_mutex_lock(&sctx->sock_lock); + if (sctx->curl) + curl_easy_cleanup(sctx->curl); + sctx->curl = curl_easy_init(); + if (!sctx->curl) { + applog(LOG_ERR, "CURL initialization failed"); + pthread_mutex_unlock(&sctx->sock_lock); + return false; + } + curl = sctx->curl; + if (!sctx->sockbuf) { + sctx->sockbuf = (char*) calloc(RBUFSIZE, 1); + sctx->sockbuf_size = RBUFSIZE; + } + sctx->sockbuf[0] = '\0'; + pthread_mutex_unlock(&sctx->sock_lock); + if (url != sctx->url) { + free(sctx->url); + sctx->url = strdup(url); + } + + free(sctx->curl_url); + sctx->curl_url = (char*) malloc(strlen(url)); + + // replace the stratum protocol prefix with http, https for ssl + sprintf( sctx->curl_url, "%s%s", + ( strstr( url, "s://" ) || strstr( url, "ssl://" ) ) + ? "https" : "http", strstr( url, "://" ) ); + + + +// sprintf( sctx->curl_url, "http%s", strstr( url, "s://" ) +// ? strstr( url, "s://" ) +// : strstr (url, "://" ) ); + + if (opt_protocol) + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curl, CURLOPT_URL, sctx->curl_url); + curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 30); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, sctx->curl_err_str); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + if (opt_proxy) { + curl_easy_setopt(curl, CURLOPT_PROXY, opt_proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); + } + curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1); +#if LIBCURL_VERSION_NUM >= 0x070f06 + curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_keepalive_cb); +#endif +#if LIBCURL_VERSION_NUM >= 0x071101 && LIBCURL_VERSION_NUM < 0x072d00 +//#if LIBCURL_VERSION_NUM >= 0x071101 + curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket_grab_cb); + curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sctx->sock); +#endif + curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1); + + rc = curl_easy_perform(curl); + if (rc) { + applog(LOG_ERR, "Stratum connection failed: %s", sctx->curl_err_str); + curl_easy_cleanup(curl); + sctx->curl = NULL; + return false; + } + +#if LIBCURL_VERSION_NUM >= 0x072d00 + curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sctx->sock); +#elif LIBCURL_VERSION_NUM < 0x071101 +//#if LIBCURL_VERSION_NUM < 0x071101 + /* CURLINFO_LASTSOCKET is broken on Win64; only use it as a last resort */ + curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, (long *)&sctx->sock); +#endif + + return true; +} + +void stratum_disconnect(struct stratum_ctx *sctx) +{ + pthread_mutex_lock(&sctx->sock_lock); + if (sctx->curl) { + curl_easy_cleanup(sctx->curl); + sctx->curl = NULL; + sctx->sockbuf[0] = '\0'; + } + pthread_mutex_unlock(&sctx->sock_lock); +} + +static const char *get_stratum_session_id(json_t *val) +{ + json_t *arr_val; + int i, n; + + arr_val = json_array_get(val, 0); + if (!arr_val || !json_is_array(arr_val)) + return NULL; + n = (int) json_array_size(arr_val); + for (i = 0; i < n; i++) { + const char *notify; + json_t *arr = json_array_get(arr_val, i); + + if (!arr || !json_is_array(arr)) + break; + notify = json_string_value(json_array_get(arr, 0)); + if (!notify) + continue; + if (!strcasecmp(notify, "mining.notify")) + return json_string_value(json_array_get(arr, 1)); + } + return NULL; +} + +static bool stratum_parse_extranonce(struct stratum_ctx *sctx, json_t *params, int pndx) +{ + const char* xnonce1; + int xn2_size; + + xnonce1 = json_string_value(json_array_get(params, pndx)); + if (!xnonce1) { + applog(LOG_ERR, "Failed to get extranonce1"); + goto out; + } + xn2_size = (int) json_integer_value(json_array_get(params, pndx+1)); + if (!xn2_size) { + applog(LOG_ERR, "Failed to get extranonce2_size"); + goto out; + } + if (xn2_size < 2 || xn2_size > 16) { + applog(LOG_INFO, "Failed to get valid n2size in parse_extranonce"); + goto out; + } + + pthread_mutex_lock(&sctx->work_lock); + if (sctx->xnonce1) + free(sctx->xnonce1); + sctx->xnonce1_size = strlen(xnonce1) / 2; + sctx->xnonce1 = (uchar*) calloc(1, sctx->xnonce1_size); + if (unlikely(!sctx->xnonce1)) { + applog(LOG_ERR, "Failed to alloc xnonce1"); + pthread_mutex_unlock(&sctx->work_lock); + goto out; + } + hex2bin(sctx->xnonce1, xnonce1, sctx->xnonce1_size); + sctx->xnonce2_size = xn2_size; + pthread_mutex_unlock(&sctx->work_lock); + + if ( !opt_quiet ) /* pool dynamic change */ + applog( LOG_INFO, "Stratum extranonce1 0x%s, extranonce2 size %d", + xnonce1, xn2_size); + + return true; +out: + return false; +} + +bool stratum_subscribe(struct stratum_ctx *sctx) +{ + char *s, *sret = NULL; + const char *sid; + json_t *val = NULL, *res_val, *err_val; + json_error_t err; + bool ret = false, retry = false; + +start: + s = (char*) malloc(128 + (sctx->session_id ? strlen(sctx->session_id) : 0)); + if (retry) + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": []}"); + else if (sctx->session_id) + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": [\"" USER_AGENT "\", \"%s\"]}", sctx->session_id); + else + sprintf(s, "{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": [\"" USER_AGENT "\"]}"); + + if (!stratum_send_line(sctx, s)) { + applog(LOG_ERR, "stratum_subscribe send failed"); + goto out; + } + + if (!socket_full(sctx->sock, 30)) { + applog(LOG_ERR, "stratum_subscribe timed out"); + goto out; + } + + sret = stratum_recv_line(sctx); + if (!sret) + goto out; + + val = JSON_LOADS(sret, &err); + free(sret); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || json_is_null(res_val) || + (err_val && !json_is_null(err_val))) { + if (opt_debug || retry) { + free(s); + if (err_val) + s = json_dumps(err_val, JSON_INDENT(3)); + else + s = strdup("(unknown reason)"); + applog(LOG_ERR, "JSON-RPC call failed: %s", s); + } + goto out; + } + + sid = get_stratum_session_id(res_val); + if (opt_debug && sid) + applog(LOG_DEBUG, "Stratum session id: %s", sid); + + pthread_mutex_lock(&sctx->work_lock); + if (sctx->session_id) + free(sctx->session_id); + sctx->session_id = sid ? strdup(sid) : NULL; + sctx->next_diff = 1.0; + pthread_mutex_unlock(&sctx->work_lock); + + // sid is param 1, extranonce params are 2 and 3 + if (!stratum_parse_extranonce(sctx, res_val, 1)) { + goto out; + } + + ret = true; + +out: + free(s); + if (val) + json_decref(val); + + if (!ret) { + if (sret && !retry) { + retry = true; + goto start; + } + } + + return ret; +} + +bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass) +{ + json_t *val = NULL, *res_val, *err_val; + char *s, *sret; + json_error_t err; + bool ret = false; + + s = (char*) malloc(80 + strlen(user) + strlen(pass)); + sprintf(s, "{\"id\": 2, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}", + user, pass); + + if (!stratum_send_line(sctx, s)) + goto out; + + while (1) { + sret = stratum_recv_line(sctx); + if (!sret) + goto out; + if (!stratum_handle_method(sctx, sret)) + break; + free(sret); + } + + val = JSON_LOADS(sret, &err); + free(sret); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + res_val = json_object_get(val, "result"); + err_val = json_object_get(val, "error"); + + if (!res_val || json_is_false(res_val) || + (err_val && !json_is_null(err_val))) { + applog(LOG_ERR, "Stratum authentication failed"); + goto out; + } + + ret = true; + + if ( !opt_extranonce ) + goto out; + + // subscribe to extranonce (optional) + sprintf(s, "{\"id\": 3, \"method\": \"mining.extranonce.subscribe\", \"params\": []}"); + + if ( !stratum_send_line( sctx, s ) ) + goto out; + + if ( !socket_full( sctx->sock, 3 ) ) + { + applog( LOG_WARNING, "Extranonce disabled, subscribe timed out" ); + opt_extranonce = false; + goto out; + } + + sret = stratum_recv_line( sctx ); + if ( sret ) + { + json_t *extra = JSON_LOADS( sret, &err ); + if ( !extra ) + { + applog(LOG_WARNING, "JSON decode failed(%d): %s", err.line, err.text); + } + else + { + if ( json_integer_value(json_object_get( extra, "id" ) ) != 3 ) + { + // we receive a standard method if extranonce is ignored + if ( !stratum_handle_method( sctx, sret ) ) + applog( LOG_WARNING, "Stratum answer id is not correct!" ); + } + else + { + res_val = json_object_get( extra, "result" ); + if ( opt_debug && ( !res_val || json_is_false( res_val ) ) ) + applog( LOG_DEBUG, + "Method extranonce.subscribe is not supported" ); + } + json_decref( extra ); + } + free(sret); + } + +out: + free(s); + if (val) + json_decref(val); + + return ret; +} + +bool stratum_suggest_difficulty( struct stratum_ctx *sctx, double diff ) +{ + char *s; + s = (char*) malloc( 80 ); + bool rc = true; + + // response is handled seperately, what ID? + sprintf( s, "{\"id\": 1, \"method\": \"mining.suggest_difficulty\", \"params\": [\"%f\"]}", diff ); + if ( !stratum_send_line( sctx, s ) ) + { + applog(LOG_WARNING,"stratum.suggest_difficulty send failed"); + rc = false; + } + free ( s ); + return rc; +} + + + +/** + * Extract bloc height L H... here len=3, height=0x1333e8 + * "...0000000000ffffffff2703e83313062f503253482f043d61105408" + */ +static uint32_t getblocheight(struct stratum_ctx *sctx) +{ + uint32_t height = 0; + uint8_t hlen = 0, *p, *m; + + // find 0xffff tag + p = (uint8_t*) sctx->job.coinbase + 32; + m = p + sctx->job.coinbase_size - 32 - 2; +// m = p + 128; + while (*p != 0xff && p < m) p++; + while (*p == 0xff && p < m) p++; + if (*(p-1) == 0xff && *(p-2) == 0xff) { + p++; hlen = *p; + p++; height = le16dec(p); + p += 2; + switch (hlen) { + case 4: + height += 0x10000UL * le16dec(p); + break; + case 3: + height += 0x10000UL * (*p); + break; + } + } + return height; +} + +static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) +{ + const char *job_id, *prevhash, *coinb1, *coinb2, *version, *nbits, *stime; + const char *finalsaplinghash = NULL; + const char *denom10 = NULL, *denom100 = NULL, *denom1000 = NULL, + *denom10000 = NULL, *prooffullnode = NULL; + const char *extradata = NULL; + size_t coinb1_size, coinb2_size; + bool clean, ret = false; + int merkle_count, i, p = 0; + json_t *merkle_arr; + uchar **merkle = NULL; + int jsize = json_array_size(params); + bool has_claim = ( opt_algo == ALGO_LBRY ) && ( jsize == 10 ); + bool has_roots = ( opt_algo == ALGO_PHI2 ) && ( jsize == 10 ); + bool is_veil = ( opt_algo == ALGO_X16RT_VEIL ); + + job_id = json_string_value(json_array_get(params, p++)); + prevhash = json_string_value(json_array_get(params, p++)); + if ( has_claim ) + { + extradata = json_string_value(json_array_get(params, p++)); + if ( !extradata || strlen( extradata ) != 64 ) + { + applog(LOG_ERR, "Stratum notify: invalid claim parameter"); + goto out; + } + } + else if ( has_roots ) + { + extradata = json_string_value(json_array_get(params, p++)); + if ( !extradata || strlen( extradata ) != 128 ) + { + applog(LOG_ERR, "Stratum notify: invalid UTXO root parameter"); + goto out; + } + } + if ( is_veil ) + { + denom10 = json_string_value(json_array_get(params, p++)); + denom100 = json_string_value(json_array_get(params, p++)); + denom1000 = json_string_value(json_array_get(params, p++)); + denom10000 = json_string_value(json_array_get(params, p++)); + prooffullnode = json_string_value(json_array_get(params, p++)); + } + + coinb1 = json_string_value(json_array_get(params, p++)); + coinb2 = json_string_value(json_array_get(params, p++)); + merkle_arr = json_array_get(params, p++); + if (!merkle_arr || !json_is_array(merkle_arr)) + goto out; + merkle_count = (int) json_array_size(merkle_arr); + version = json_string_value(json_array_get(params, p++)); + nbits = json_string_value(json_array_get(params, p++)); + stime = json_string_value(json_array_get(params, p++)); + clean = json_is_true(json_array_get(params, p)); p++; + + if (!job_id || !prevhash || !coinb1 || !coinb2 || !version || !nbits || !stime || + strlen(prevhash) != 64 || strlen(version) != 8 || + strlen(nbits) != 8 || strlen(stime) != 8) { + applog(LOG_ERR, "Stratum notify: invalid parameters"); + goto out; + } + + hex2bin( sctx->job.version, version, 4 ); + + if ( opt_sapling ) + { + finalsaplinghash = json_string_value( json_array_get( params, 9 ) ); + if ( !finalsaplinghash || strlen(finalsaplinghash) != 64 ) + { + applog( LOG_ERR, "Stratum notify: invalid sapling parameters" ); + goto out; + } + } + + if ( is_veil ) + { + if ( !denom10 || !denom100 || !denom1000 || !denom10000 + || !prooffullnode || strlen(denom10) != 64 || strlen(denom100) != 64 + || strlen(denom1000) != 64 || strlen(denom10000) != 64 + || strlen(prooffullnode) != 64 ) + { + applog(LOG_ERR, "Stratum notify: invalid veil parameters"); + goto out; + } + } + + pthread_mutex_lock( &sctx->work_lock ); + + if ( merkle_count ) + { + if ( merkle_count > sctx->job.merkle_buf_size ) + { + for ( i = 0; i < sctx->job.merkle_count; i++ ) + free( sctx->job.merkle[i] ); + free( sctx->job.merkle ); + + merkle = (uchar**) malloc( merkle_count * sizeof(char *) ); + for ( i = 0; i < merkle_count; i++ ) + merkle[i] = (uchar*) malloc( 32 ); + sctx->job.merkle_buf_size = merkle_count; + sctx->job.merkle = merkle; + } + + for ( i = 0; i < merkle_count; i++ ) + { + const char *s = json_string_value( json_array_get( merkle_arr, i ) ); + if ( !s || strlen(s) != 64 ) + { + sctx->job.merkle_count = 0; + pthread_mutex_unlock( &sctx->work_lock ); + applog( LOG_ERR, "Stratum notify: invalid Merkle branch" ); + goto out; + } + hex2bin( sctx->job.merkle[i], s, 32 ); + } + } + sctx->job.merkle_count = merkle_count; + + coinb1_size = strlen( coinb1 ) / 2; + coinb2_size = strlen( coinb2 ) / 2; + sctx->job.coinbase_size = coinb1_size + sctx->xnonce1_size + + sctx->xnonce2_size + coinb2_size; + sctx->job.coinbase = (uchar*) realloc( sctx->job.coinbase, + sctx->job.coinbase_size ); + sctx->job.xnonce2 = sctx->job.coinbase + coinb1_size + sctx->xnonce1_size; + hex2bin( sctx->job.coinbase, coinb1, coinb1_size ); + memcpy( sctx->job.coinbase + coinb1_size, + sctx->xnonce1, sctx->xnonce1_size ); + if ( !sctx->job.job_id || strcmp( sctx->job.job_id, job_id ) ) + memset(sctx->job.xnonce2, 0, sctx->xnonce2_size); + hex2bin( sctx->job.xnonce2 + sctx->xnonce2_size, coinb2, coinb2_size ); + free( sctx->job.job_id ); + sctx->job.job_id = strdup( job_id ); + hex2bin( sctx->job.prevhash, prevhash, 32 ); + if ( has_claim ) hex2bin( sctx->job.extra, extradata, 32 ); + if ( has_roots ) hex2bin( sctx->job.extra, extradata, 64 ); + if ( opt_sapling ) + hex2bin( sctx->job.final_sapling_hash, finalsaplinghash, 32 ); + + if ( is_veil ) + { + hex2bin( sctx->job.denom10, denom10, 32 ); + hex2bin( sctx->job.denom100, denom100, 32 ); + hex2bin( sctx->job.denom1000, denom1000, 32 ); + hex2bin( sctx->job.denom10000, denom10000, 32 ); + hex2bin( sctx->job.proofoffullnode, prooffullnode, 32 ); + } + + sctx->block_height = getblocheight( sctx ); + hex2bin( sctx->job.nbits, nbits, 4 ); + hex2bin( sctx->job.ntime, stime, 4 ); + sctx->job.clean = clean; + sctx->job.diff = sctx->next_diff; + + pthread_mutex_unlock( &sctx->work_lock ); + + ret = true; + +out: + return ret; +} + +static bool stratum_set_difficulty(struct stratum_ctx *sctx, json_t *params) +{ + double diff; + + diff = json_number_value(json_array_get(params, 0)); + if (diff == 0) + return false; + + pthread_mutex_lock(&sctx->work_lock); + sctx->next_diff = diff; + pthread_mutex_unlock(&sctx->work_lock); + return true; +} + +static bool stratum_reconnect(struct stratum_ctx *sctx, json_t *params) +{ + json_t *port_val; + char *url; + const char *host; + int port; + + host = json_string_value(json_array_get(params, 0)); + port_val = json_array_get(params, 1); + if (json_is_string(port_val)) + port = atoi(json_string_value(port_val)); + else + port = (int) json_integer_value(port_val); + if (!host || !port) + return false; + + url = (char*) malloc(32 + strlen(host)); + + strncpy( url, sctx->url, 15 ); + sprintf( strstr( url, "://" ) + 3, "%s:%d", host, port ); + + if (!opt_redirect) { + applog(LOG_INFO, "Ignoring request to reconnect to %s", url); + free(url); + return true; + } + + applog(LOG_NOTICE, "Server requested reconnection to %s", url); + + free(sctx->url); + sctx->url = url; + stratum_disconnect(sctx); + + return true; +} + +static bool json_object_set_error(json_t *result, int code, const char *msg) +{ + json_t *val = json_object(); + json_object_set_new(val, "code", json_integer(code)); + json_object_set_new(val, "message", json_string(msg)); + return json_object_set_new(result, "error", val) != -1; +} + +/* allow to report algo perf to the pool for algo stats */ +static bool stratum_benchdata(json_t *result, json_t *params, int thr_id) +{ + char algo[64] = { 0 }; + char cpuname[80] = { 0 }; + char vendorid[32] = { 0 }; + char compiler[32] = { 0 }; + char arch[16] = { 0 }; + char os[8]; + char *p; + double cpufreq = 0; + json_t *val; + + if (!opt_stratum_stats) return false; + + get_currentalgo(algo, sizeof(algo)); + +#if defined(WIN32) && (defined(_M_X64) || defined(__x86_64__)) + strcpy(os, "win64"); +#else + strcpy(os, is_windows() ? "win32" : "linux"); +#endif + +#ifdef _MSC_VER + sprintf(compiler, "MSVC %d\n", msver()); +#elif defined(__clang__) + sprintf(compiler, "clang %s\n", __clang_version__); +#elif defined(__GNUC__) + sprintf(compiler, "GCC %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); +#endif + +#ifdef __AVX2__ + strcat(compiler, " AVX2"); +#elif defined(__AVX__) + strcat(compiler, " AVX"); +#elif defined(__FMA4__) + strcat(compiler, " FMA4"); +#elif defined(__FMA3__) + strcat(compiler, " FMA3"); +#elif defined(__SSE4_2__) + strcat(compiler, " SSE4.2"); +#elif defined(__SSE4_1__) + strcat(compiler, " SSE4"); +#elif defined(__SSE3__) + strcat(compiler, " SSE3"); +#elif defined(__SSE2__) + strcat(compiler, " SSE2"); +#elif defined(__SSE__) + strcat(compiler, " SSE"); +#endif + + cpu_bestfeature(arch, 16); + if (has_aes()) strcat(arch, " NI"); + + cpu_getmodelid(vendorid, 32); + cpu_getname(cpuname, 80); + p = strstr(cpuname, " @ "); + if (p) { + // linux only + char freq[32] = { 0 }; + *p = '\0'; p += 3; + snprintf(freq, 32, "%s", p); + cpufreq = atof(freq); + p = strstr(freq, "GHz"); if (p) cpufreq *= 1000; + applog(LOG_NOTICE, "sharing CPU stats with freq %s", freq); + } + + compiler[31] = '\0'; + + val = json_object(); + json_object_set_new(val, "algo", json_string(algo)); + json_object_set_new(val, "type", json_string("cpu")); + json_object_set_new(val, "device", json_string(cpuname)); + json_object_set_new(val, "vendorid", json_string(vendorid)); + json_object_set_new(val, "arch", json_string(arch)); + json_object_set_new(val, "freq", json_integer((uint64_t)cpufreq)); + json_object_set_new(val, "memf", json_integer(0)); + json_object_set_new(val, "power", json_integer(0)); + json_object_set_new(val, "khashes", json_real((double)global_hashrate / 1000.0)); + json_object_set_new(val, "intensity", json_real(opt_priority)); + json_object_set_new(val, "throughput", json_integer(opt_n_threads)); + json_object_set_new(val, "client", json_string(PACKAGE_NAME "/" PACKAGE_VERSION)); + json_object_set_new(val, "os", json_string(os)); + json_object_set_new(val, "driver", json_string(compiler)); + + json_object_set_new(result, "result", val); + + return true; +} + +static bool stratum_get_stats(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char *s; + json_t *val; + bool ret; + + if (!id || json_is_null(id)) + return false; + + val = json_object(); + json_object_set(val, "id", id); + + ret = stratum_benchdata(val, params, 0); + + if (!ret) { + json_object_set_error(val, 1, "disabled"); //EPERM + } else { + json_object_set_new(val, "error", json_null()); + } + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_unknown_method(struct stratum_ctx *sctx, json_t *id) +{ + char *s; + json_t *val; + bool ret = false; + + if (!id || json_is_null(id)) + return ret; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "result", json_false()); + json_object_set_error(val, 38, "unknown method"); // ENOSYS + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_pong(struct stratum_ctx *sctx, json_t *id) +{ + char buf[64]; + bool ret = false; + + if (!id || json_is_null(id)) + return ret; + + sprintf(buf, "{\"id\":%d,\"result\":\"pong\",\"error\":null}", + (int) json_integer_value(id)); + ret = stratum_send_line(sctx, buf); + + return ret; +} + +static bool stratum_get_algo(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char algo[64] = { 0 }; + char *s; + json_t *val; + bool ret = true; + + if (!id || json_is_null(id)) + return false; + + get_currentalgo(algo, sizeof(algo)); + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_string(algo)); + + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + + +static bool stratum_get_version(struct stratum_ctx *sctx, json_t *id) +{ + char *s; + json_t *val; + bool ret; + + if (!id || json_is_null(id)) + return false; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_string(USER_AGENT)); + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +static bool stratum_show_message(struct stratum_ctx *sctx, json_t *id, json_t *params) +{ + char *s; + json_t *val; + bool ret; + + val = json_array_get(params, 0); + if (val) + applog(LOG_NOTICE, "MESSAGE FROM SERVER: %s", json_string_value(val)); + + if (!id || json_is_null(id)) + return true; + + val = json_object(); + json_object_set(val, "id", id); + json_object_set_new(val, "error", json_null()); + json_object_set_new(val, "result", json_true()); + s = json_dumps(val, 0); + ret = stratum_send_line(sctx, s); + json_decref(val); + free(s); + + return ret; +} + +bool stratum_handle_method(struct stratum_ctx *sctx, const char *s) +{ + json_t *val, *id, *params; + json_error_t err; + const char *method; + bool ret = false; + + val = JSON_LOADS(s, &err); + if (!val) { + applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text); + goto out; + } + + method = json_string_value(json_object_get(val, "method")); + if (!method) + goto out; + + params = json_object_get(val, "params"); + + id = json_object_get(val, "id"); + + if (!strcasecmp(method, "mining.notify")) { + ret = stratum_notify(sctx, params); + sctx->new_job = true; + goto out; + } + if (!strcasecmp(method, "mining.ping")) { // cgminer 4.7.1+ + if (opt_debug) applog(LOG_DEBUG, "Pool ping"); + ret = stratum_pong(sctx, id); + goto out; + } + if (!strcasecmp(method, "mining.set_difficulty")) { + ret = stratum_set_difficulty(sctx, params); + goto out; + } + if (!strcasecmp(method, "mining.set_extranonce")) { + ret = stratum_parse_extranonce(sctx, params, 0); + goto out; + } + if (!strcasecmp(method, "client.reconnect")) { + ret = stratum_reconnect(sctx, params); + goto out; + } + if (!strcasecmp(method, "client.get_algo")) { + // will prevent wrong algo parameters on a pool, will be used as test on rejects + if (!opt_quiet) applog(LOG_NOTICE, "Pool asked your algo parameter"); + ret = stratum_get_algo(sctx, id, params); + goto out; + } + if (!strcasecmp(method, "client.get_stats")) { + // optional to fill device benchmarks + ret = stratum_get_stats(sctx, id, params); + goto out; + } + if (!strcasecmp(method, "client.get_version")) { + ret = stratum_get_version(sctx, id); + goto out; + } + if (!strcasecmp(method, "client.show_message")) { + ret = stratum_show_message(sctx, id, params); + goto out; + } + + if (!ret) { + // don't fail = disconnect stratum on unknown (and optional?) methods + if (opt_debug) applog(LOG_WARNING, "unknown stratum method %s!", method); + ret = stratum_unknown_method(sctx, id); + } +out: + if (val) + json_decref(val); + + return ret; +} + +struct thread_q *tq_new(void) +{ + struct thread_q *tq; + + tq = (struct thread_q*) calloc(1, sizeof(*tq)); + if (!tq) + return NULL; + + INIT_LIST_HEAD(&tq->q); + pthread_mutex_init(&tq->mutex, NULL); + pthread_cond_init(&tq->cond, NULL); + + return tq; +} + +void tq_free(struct thread_q *tq) +{ + struct tq_ent *ent, *iter; + + if (!tq) + return; + + list_for_each_entry_safe(ent, iter, &tq->q, q_node, struct tq_ent) { + list_del(&ent->q_node); + free(ent); + } + + pthread_cond_destroy(&tq->cond); + pthread_mutex_destroy(&tq->mutex); + + memset(tq, 0, sizeof(*tq)); /* poison */ + free(tq); +} + +static void tq_freezethaw(struct thread_q *tq, bool frozen) +{ + pthread_mutex_lock(&tq->mutex); + + tq->frozen = frozen; + + pthread_cond_signal(&tq->cond); + pthread_mutex_unlock(&tq->mutex); +} + +void tq_freeze(struct thread_q *tq) +{ + tq_freezethaw(tq, true); +} + +void tq_thaw(struct thread_q *tq) +{ + tq_freezethaw(tq, false); +} + +bool tq_push(struct thread_q *tq, void *data) +{ + struct tq_ent *ent; + bool rc = true; + + ent = (struct tq_ent*) calloc(1, sizeof(*ent)); + if (!ent) + return false; + + ent->data = data; + INIT_LIST_HEAD(&ent->q_node); + + pthread_mutex_lock(&tq->mutex); + + if (!tq->frozen) { + list_add_tail(&ent->q_node, &tq->q); + } else { + free(ent); + rc = false; + } + + pthread_cond_signal(&tq->cond); + pthread_mutex_unlock(&tq->mutex); + + return rc; +} + +void *tq_pop(struct thread_q *tq, const struct timespec *abstime) +{ + struct tq_ent *ent; + void *rval = NULL; + int rc; + + pthread_mutex_lock(&tq->mutex); + + if (!list_empty(&tq->q)) + goto pop; + + if (abstime) + rc = pthread_cond_timedwait(&tq->cond, &tq->mutex, abstime); + else + rc = pthread_cond_wait(&tq->cond, &tq->mutex); + if (rc) + goto out; + if (list_empty(&tq->q)) + goto out; + +pop: + ent = list_entry(tq->q.next, struct tq_ent, q_node); + rval = ent->data; + + list_del(&ent->q_node); + free(ent); + +out: + pthread_mutex_unlock(&tq->mutex); + return rval; +} + +/* sprintf can be used in applog */ +static char* format_hash(char* buf, uint8_t *hash) +{ + int len = 0; + for (int i=0; i < 32; i += 4) { + len += sprintf(buf+len, "%02x%02x%02x%02x ", + hash[i], hash[i+1], hash[i+2], hash[i+3]); + } + return buf; +} + +void applog_compare_hash(void *hash, void *hash_ref) +{ + char s[256] = ""; + int len = 0; + uchar* hash1 = (uchar*)hash; + uchar* hash2 = (uchar*)hash_ref; + for (int i=0; i < 32; i += 4) { + const char *color = memcmp(hash1+i, hash2+i, 4) ? CL_WHT : CL_GRY; + len += sprintf(s+len, "%s%02x%02x%02x%02x " CL_GRY, color, + hash1[i], hash1[i+1], hash1[i+2], hash1[i+3]); + s[len] = '\0'; + } + applog(LOG_DEBUG, "%s", s); +} + +void applog_hash(void *hash) +{ + char s[128] = {'\0'}; + applog(LOG_DEBUG, "%s", format_hash(s, (uchar*) hash)); +} + +void applog_hex(void *data, int len) +{ + char* hex = abin2hex((uchar*)data, len); + applog(LOG_DEBUG, "%s", hex); + free(hex); +} + +void applog_hash64(void *hash) +{ + char s[128] = {'\0'}; + char t[128] = {'\0'}; + applog(LOG_DEBUG, "%s %s", format_hash(s, (uchar*)hash), format_hash(t, &((uchar*)hash)[32])); +} + +#define printpfx(n,h) \ + printf("%s%11s%s: %s\n", CL_CYN, n, CL_N, format_hash(s, (uint8_t*) h)) + +void print_hash_tests(void) +{ + uchar *scratchbuf = NULL; + char hash[128], s[80]; + char buf[192] = { 0 }; + int algo; + scratchbuf = (uchar*) calloc(128, 1024); + + printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n\n"); + + //buf[0] = 1; buf[64] = 2; // for endian tests + for ( algo=0; algo < ALGO_COUNT; algo++ ) + { + exec_hash_function( algo, &hash[0], &buf[0] ); + printpfx( algo_names[algo], hash ); + } + + printf("\n"); + + free(scratchbuf); +} + diff --git a/rin/miner/cpuminer/verthash-help.txt b/rin/miner/cpuminer/verthash-help.txt new file mode 100644 index 0000000..c722895 --- /dev/null +++ b/rin/miner/cpuminer/verthash-help.txt @@ -0,0 +1,80 @@ +Quickstart: +---------- + +First time mining verthash or don't have a Verthash data file: + +--algo verthash --verify --url ... + +Verthash data file already exists: + +--algo verthash --data-file /path/to/verthash.dat --url ... + + +Background: +---------- + +Verthash algorithm requires a data file for hashing. This file is +static, portable, and only needs to be created once. + +A Verthash data file created by VerthashMiner can also be used by cpuminer-opt +and used simultaneously by both miners. + +Due to its size >1GB it is recommened one data file be created and +stored in a permanent location accessible to any miner that wants to use it. + +New command line options: +------------------------ + +cpuminer-opt adds two new command line options for verthash. The names +and some behaviour is changed from VerthashMiner. + +--data-file /path/to/verthash.dat + default when not used is verthash.dat in current working directory. + +--verify + verify integrity of file specified by --data-file, or if not specified + the default data file if it exists, or create a default file and verify it + if one does not yet exist. Data file verification is disabled by default. + +Detailed usage: +-------------- + +If a data file already exists it can be selected using the --data-file +option to specify the path and name of the file. + +--algo verthash --datafile /path/to/verthash.dat --url ... + +If the --data-file option is not used the default is to use 'verthash.dat' +from the current working directory. + +If no data file exists it can be created by using the --verify option +without the --data-file option. If the default data file is not found in +the current directory it will be created. + +--algo verthash --verify --url ... + +Data file creation can take up to 30 minutes on a spinning hard drive. +Once created the new data file will be verified and used immediately +if a valid url and user were included on the command line. + +A default data file can be created by ommitting the url option. That will +either verify an existing default data file or create one and verify it, +then exit. + +--algo verthash --verify + +A data file will never be created if --data-file is specified. The miner +will exit with an error if the file is not found in the specified location. +This is to avoid accidentally creating an unwanted data file due to a typo. + +After creation the data file can moved to a more convenient location and +referenced by --data-file, or left where it is and used by default without the +--data-file option. + +Data file verification takes a few seconds and is disabled by default. +VerthashMiner enables data file verification by default and has an option to +disable it. + +The --verify option is intended primarily to create a new file. It's +not necessary or useful to verify a file every time the miner is started. + diff --git a/rin/miner/cpuminer/winbuild-cross.sh b/rin/miner/cpuminer/winbuild-cross.sh new file mode 100644 index 0000000..ad682f4 --- /dev/null +++ b/rin/miner/cpuminer/winbuild-cross.sh @@ -0,0 +1,131 @@ +#!/bin/bash +# +# Script for building Windows binaries release package using mingw. +# Requires a custom mingw environment, not intended for users. +# +# Compiles Windows EXE files for selected CPU architectures, copies them +# as well as some DLLs that aren't available in most Windows environments +# into a release folder ready to be zipped and uploaded. + +# define some local variables + +export LOCAL_LIB="$HOME/usr/lib" +export CONFIGURE_ARGS="--with-curl=$LOCAL_LIB/curl --host=x86_64-w64-mingw32" +export MINGW_LIB="/usr/x86_64-w64-mingw32/lib" +# set correct gcc version +export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32" +# used by GCC +export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs" +export DEFAULT_CFLAGS="-maes -O3 -Wall" +export DEFAULT_CFLAGS_OLD="-O3 -Wall" + +# make link to local gmp header file. +ln -s $LOCAL_LIB/gmp/gmp.h ./gmp.h + +# make release directory and copy selected DLLs. + +rm -rf release > /dev/null +mkdir release + +cp README.txt release/ +cp README.md release/ +cp RELEASE_NOTES release/ +cp verthash-help.txt release/ +cp $MINGW_LIB/zlib1.dll release/ +cp $MINGW_LIB/libwinpthread-1.dll release/ +cp $GCC_MINGW_LIB/libstdc++-6.dll release/ +cp $GCC_MINGW_LIB/libgcc_s_seh-1.dll release/ +cp $LOCAL_LIB/curl/lib/.libs/libcurl-4.dll release/ + +# Start building... + +# AVX512 SHA VAES: Intel Core Icelake, Rocketlake +./clean-all.sh || echo clean +rm -f config.status +./autogen.sh || echo done +CFLAGS="-march=icelake-client $DEFAULT_CFLAGS" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx512-sha-vaes.exe + +# AVX512 AES: Intel Core HEDT Slylake-X, Cascadelake +make clean || echo clean +rm -f config.status +CFLAGS="-march=skylake-avx512 $DEFAULT_CFLAGS" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx512.exe + +# AVX2 SHA VAES: Intel Alderlake, AMD Zen3 +make clean || echo done +rm -f config.status +CFLAGS="-mavx2 -msha -mvaes $DEFAULT_CFLAGS" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx2-sha-vaes.exe + +# AVX2 AES SHA: AMD Zen1 +make clean || echo clean +rm -f config.status +CFLAGS="-march=znver1 $DEFAULT_CFLAGS" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx2-sha.exe + +# AVX2 AES: Intel Core Haswell, Skylake, Kabylake, Coffeelake, Cometlake +make clean || echo clean +rm -f config.status +CFLAGS="-march=core-avx2 $DEFAULT_CFLAGS" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx2.exe + +# AVX AES: Intel Sandybridge, Ivybridge +make clean || echo clean +rm -f config.status +CFLAGS="-march=corei7-avx -maes $DEFAULT_CFLAGS_OLD" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-avx.exe + +# SSE4.2 AES: Intel Westmere +make clean || echo clean +rm -f config.status +CFLAGS="-march=westmere -maes $DEFAULT_CFLAGS_OLD" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-aes-sse42.exe + +# Nehalem SSE4.2 +#make clean || echo clean +#rm -f config.status +#CFLAGS="$DEFAULT_CFLAGS_OLD -march=corei7" ./configure $CONFIGURE_ARGS +#make +#strip -s cpuminer.exe +#mv cpuminer.exe release/cpuminer-sse42.exe + +# Core2 SSSE3 +#make clean || echo clean +#rm -f config.status +#CFLAGS="$DEFAULT_CFLAGS_OLD -march=core2" ./configure $CONFIGURE_ARGS +#make +#strip -s cpuminer.exe +#mv cpuminer.exe release/cpuminer-ssse3.exe +#make clean || echo clean + +# Generic SSE2 +make clean || echo clean +rm -f config.status +CFLAGS="-msse2 $DEFAULT_CFLAGS_OLD" ./configure $CONFIGURE_ARGS +make -j 8 +strip -s cpuminer.exe +mv cpuminer.exe release/cpuminer-sse2.exe +#make clean || echo clean + +# Native with CPU groups ennabled +#make clean || echo clean +#rm -f config.status +#CFLAGS="-march=native $DEFAULT_CFLAGS_OLD" ./configure $CONFIGURE_ARGS +#make -j 8 +#strip -s cpuminer.exe + diff --git a/rin/miner/cpuminer/zlib1.dll b/rin/miner/cpuminer/zlib1.dll new file mode 100644 index 0000000..93c94c5 Binary files /dev/null and b/rin/miner/cpuminer/zlib1.dll differ