You can use ./build.sh to configure and build with default options.

It is advised to run ./autogen.sh before ./configure (autoconf and automake
need to be installed on your system for autogen.sh to work)

./configure has an option named --with-cuda that allows you to specify
where your CUDA 6.5 toolkit is installed (usually /usr/local/cuda,
but some distros may have a different default location)


** How to compile on Ubuntu (16.04 LTS)

First, install Cuda toolkit and nVidia Driver, and type `nvidia-smi` to check if your card is detected.

Install dependencies
```sudo apt-get install libcurl4-openssl-dev libssl-dev libjansson-dev automake autotools-dev build-essential```

Ubuntu is now shipped with gcc 6 or 7 so please install gcc/g++ 5 and make it the default (required by the cuda toolkit)
```
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1
```

Then use the helper ./build.sh in ccminer source folder, edit configure.sh and the Makefile.am if required.
```
./build.sh
./ccminer --version
```


** How to compile on Fedora 25 **

Note: You may find an alternative method via rpms :
see https://negativo17.org/nvidia-driver/ and https://negativo17.org/repos/multimedia/


# Step 1: gcc and dependencies
dnf install gcc gcc-c++ autoconf automake
dnf install jansson-devel openssl-devel libcurl-devel zlib-devel

# Step 2: nvidia drivers (Download common linux drivers from nvidia site)
dnf install kernel-devel
dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
dnf check-update
dnf install xorg-x11-drv-nvidia-cuda kmod-nvidia
ln -s libnvidia-ml.so.1 /usr/lib64/libnvidia-ml.so

# Step 3: CUDA SDK (Download from nvidia the generic ".run" archive)
#         --override is required to ignore "too recent" gcc 6.3
#         --silent is required to install only the toolkit (no kmod)
./cuda_8.0.61_375.26_linux.run --toolkit --silent --override
nvcc --version

# add the nvcc binary path to the system
ln -s /usr/local/cuda-8.0 /usr/local/cuda # (if not already made)
echo 'export PATH=$PATH:/usr/local/cuda/bin' > /etc/profile.d/cuda.sh

# add the cudart library path to the system
echo /usr/local/cuda/lib64 > /etc/ld.so.conf.d/cuda.conf
ldconfig

# Step 4: Fix the toolkit incompatibility with gcc 6

# You need to build yourself an older GCC/G++ version, i recommend the 5.4
# see https://gcc.gnu.org/mirrors.html
# Note: this manual method will override the default gcc, it could be better to use a custom toolchain prefix

wget ftp://ftp.lip6.fr/pub/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.bz2
dnf install libmpc-devel mpfr-devel gmp-devel
./configure --prefix=/usr/local --enable-languages=c,c++,lto --disable-multilib
make -j 8 && make install
(while this step, you have the time to cook something :p)

# or, for previous fedora versions, edit the file /usr/local/cuda/include/host_config.h
# and comment/delete the line 121 : #error -- unsupported GNU version! gcc versions later than 5 are not supported!

./build.sh

./ccminer -n


** How to compile on macOS **

# Step 1: download and install CUDA Toolkit 8 or more recent
# https://developer.nvidia.com/cuda-toolkit-archive

# Step 2: install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Step 3: dependencies
brew install pkg-config autoconf automake curl openssl llvm

./build.sh

./ccminer -n