# DeviceAtlas C API and Unix # A how-to guide to compile and run the DeviceAtlas C API on Unix systems. ### Requirements ### - A C compiler - CMake 2.6 (or above) - PCRE 6.x (or above). For best performance v8.21 (or above) is recommended. **Important** - There are two major versions of the PCRE library: PCRE and PCRE2. PCRE2 is not compatible and should not be used. The following compilers have been tested and are able to compile all components: - GCC (3.4 or above (4.x versions are recommended)) - Clang/LLVM (3.0 or above) - Sun Pro family (12.x or above) ### CMake ### By default CMake should find all necessary components if they are installed with a package manager. This section describes setting cmake variables to handle components installed in custom locations. ** PCRE library and headers ** If the PCRE library and headers are located in a custom location, the following cmake environment variables may be set: - PCRELIB=&lt;path to the pcre library&gt; - PCRE_INCLUDE_DIR=&lt;path to the pcre headers folder&gt; (For Red Hat based operating systems, the required packages are pcre-devel; for Debian, the names are libpcre3-dev; otherwise, please check pcre and zlib development packages with your package manager). For example: ```shell cmake -DPCRELIB=/home/test/pcre/lib/libpcre.so -DPCRE_INCLUDE_DIR=/home/test/pcre/include ``` Compatibility: For older PCRE versions it is possible to disable the PCRE Study feature with cmake -DPCRE_STUDY=0. It is highly recommended to NOT disable PCRE Study for better performance. ** Custom compiler location ** - CMAKE_C_COMPILER=&lt;full path to the C compiler executable&gt; For example: ```shell cmake -DCMAKE_C_COMPILER=/home/test/gcc-4.8.3/bin/gcc -DCMAKE_CXX_COMPILER=/home/test/gcc-4.8.3/bin/g++ ``` NB: For a static API version used with another shared library it is possible to use CFLAGS/CXXFLAGS with -fPIC/fpic compilation flag. ### Building the API ### 1. Unpack the API 2. Change to the API directory 3. Run cmake command 4. Run make ```shell % cmake . % make ``` ### Sample applications ### There are multiple examples in the /Examples folder to test the API. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ Copyright (c) DeviceAtlas Limited 2021. All Rights Reserved. _ https://deviceatlas.com <!-- HTML+JS for document formatting when opened in browser --> <div class="btn-group" id="main-menu" style="float:right"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Menu<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="README.html">Main</a></li><li class="divider"></li><li><a href="README.DeviceApi-Web.html">Device Detection for Web</a></li><li><a href="README.DeviceApi-Apps.html">Device Detection for Apps</a></li><li><a href="README.DeviceApi-Config.html">Device Detection API Config</a></li><li><a href="README.CarrierApi.html">Carrier Identification API</a></li><li class="divider"></li><li class="disabled"><a href="README.Unix.html">C API and Unix</a></li><li><a href="README.Windows.html">C API and Windows</a></li><li class="divider"></li><li><a href="README.Nginx.html">C API and NGINX Module Installation</a></li><li class="divider"></li><li><a href="README.JsonConverter.html">C API JSONConverter</a></li><li><a href="README.ClientSide.html">Client-side Component</a></li><li><a href="ApiDocs/index.html">DeviceAtlas ApiDocs</a></li></ul></div>