-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Wielemaker
authored and
Jan Wielemaker
committed
Sep 21, 2018
1 parent
a36c644
commit 47c905c
Showing
22 changed files
with
290 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(swipl-clib) | ||
|
||
include("../cmake/PrologPackage.cmake") | ||
include(Sockets) | ||
find_package(LibUUID) | ||
|
||
check_function_exists(crypt HAVE_CRYPT) | ||
if(NOT HAVE_CRYPT) | ||
check_library_exists(crypt crypt "" HAVE_LIBCRYPT) | ||
if(HAVE_LIBCRYPT) | ||
set(CRYPT_LIBS -lcrypt) | ||
else() | ||
set(CRYPT_SOURCE bsd-crypt.c) | ||
endif() | ||
endif() | ||
|
||
check_function_exists(syslog HAVE_SYSLOG) | ||
|
||
AC_CHECK_HEADERS(malloc.h alloca.h unistd.h sys/time.h fcntl.h | ||
utime.h execinfo.h sys/resource.h crypt.h syslog.h | ||
sys/types.h sys/wait.h sys/stat.h sys/prctl.h | ||
netinet/tcp.h crt_externs.h poll.h) | ||
|
||
check_type_size("long" SIZEOF_LONG) | ||
check_type_size("long long" SIZEOF_LONG_LONG) | ||
|
||
AC_CHECK_FUNCS(setsid strerror utime getrlimit strcasestr vfork _NSGetEnviron | ||
pipe2 prctl sysconf poll initgroups setgroups chmod | ||
mallinfo malloc_info open_memstream) | ||
|
||
configure_file(config.h.cmake config.h) | ||
|
||
################ | ||
# Setup the targets | ||
|
||
swipl_plugin(cgi C_SOURCES error.c form.c cgi.c PL_LIBS cgi.pl) | ||
swipl_plugin(memfile C_SOURCES error.c memfile.c PL_LIBS memfile.pl) | ||
swipl_plugin(time C_SOURCES error.c time.c PL_LIBS time.pl) | ||
swipl_plugin(files C_SOURCES error.c files.c PL_LIBS filesex.pl) | ||
swipl_plugin(process C_SOURCES error.c process.c PL_LIBS process.pl) | ||
swipl_plugin(streaminfo C_SOURCES error.c streaminfo.c PL_LIBS streaminfo.pl) | ||
if(HAVE_MALLINFO) | ||
swipl_plugin(mallocinfo C_SOURCES error.c mallocinfo.c PL_LIBS mallocinfo.pl) | ||
endif() | ||
|
||
swipl_plugin(uri C_SOURCES uri.c PL_LIBS uri.pl) | ||
swipl_plugin(readutil C_SOURCES readutil.c PL_LIBS) | ||
swipl_plugin(prolog_stream C_SOURCES prolog_stream.c PL_LIBS prolog_stream.pl) | ||
swipl_plugin(md54pl C_SOURCES md54pl.c md5.c PL_LIBS md5.pl) | ||
|
||
if(UNIX) | ||
swipl_plugin(unix C_SOURCES error.c unix.c PL_LIBS unix.pl) | ||
swipl_plugin(uid C_SOURCES error.c uid.c PL_LIBS uid.pl) | ||
swipl_plugin(rlimit C_SOURCES error.c rlimit.c PL_LIBS rlimit.pl) | ||
swipl_plugin(syslog C_SOURCES syslog.c PL_LIBS syslog.pl) | ||
endif(UNIX) | ||
|
||
if(LIBUUID_FOUND) | ||
swipl_plugin(uuid | ||
C_SOURCES uuid.c | ||
C_LIBS ${UUID_LIBRARY} | ||
PL_LIBS uuid.pl) | ||
target_include_directories(plugin_uuid BEFORE PRIVATE | ||
${LIBUUID_INCLUDE_DIR}) | ||
endif() | ||
|
||
swipl_plugin(crypt | ||
C_SOURCES error.c crypt.c md5.c md5passwd.c ${CRYPT_SOURCE} | ||
C_LIBS ${CRYPT_LIBS} | ||
PL_LIBS crypt.pl) | ||
swipl_plugin(hashstream | ||
C_SOURCES hash_stream.c md5.c sha1/sha1.c sha1/sha2.c | ||
PL_LIBS hash_stream.pl) | ||
swipl_plugin(sha4pl | ||
C_SOURCES error.c sha4pl.c sha1/sha1.c sha1/sha2.c | ||
sha1/hmac_sha1.c sha1/hmac_sha256.c | ||
PL_LIBS sha.pl) | ||
|
||
if(HAVE_SOCKET) | ||
swipl_plugin( | ||
socket | ||
C_SOURCES error.c socket.c nonblockio.c | ||
C_LIBS ${SOCKET_LIBRARIES} | ||
PL_LIBS socket.pl streampool.pl prolog_server.pl udp_broadcast.pl) | ||
endif(HAVE_SOCKET) | ||
|
||
################ | ||
# Tests | ||
|
||
test_libs(cgi crypt memfile process readutil socket stream time uri) | ||
|
||
################ | ||
# Documentation | ||
|
||
pkg_doc(clib | ||
SOURCES process.pl uri.pl filesex.pl uid.pl udp_broadcast.pl | ||
uuid.pl unix.pl syslog.pl socket.pl prolog_stream.pl md5.pl | ||
hash_stream.pl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
find_package(PkgConfig QUIET) | ||
pkg_check_modules(PC_LIBUUID QUIET ossp-uuid) | ||
|
||
find_path(LIBUUID_INCLUDE_DIR | ||
NAMES uuid.h | ||
PATH_SUFFIXES ossp | ||
HINTS ${PC_LIBUUID_INCLUDEDIR} | ||
${PC_LIBUUID_INCLUDE_DIRS}) | ||
|
||
# MinGW version seems very aggressive finding uuid.h from our version, | ||
# but libuuid.a from the system directory. As ossp-uuid is not part | ||
# of most defaults, we'll try ignoring this. | ||
|
||
string(REPLACE "/include" "/lib" i_libuuid_libdir ${LIBUUID_INCLUDE_DIR}) | ||
find_library(UUID_LIBRARY | ||
NAMES ossp-uuid uuid | ||
HINTS ${i_libuuid_libdir} | ||
${PC_LIBUUID_LIBDIR} | ||
${PC_LIBUUID_LIBRARY_DIRS} | ||
NO_CMAKE_SYSTEM_PATH) | ||
if(NOT UUID_LIBRARY) | ||
find_library(UUID_LIBRARY | ||
NAMES ossp-uuid uuid) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args( | ||
LibUUID | ||
REQUIRED_VARS LIBUUID_INCLUDE_DIR UUID_LIBRARY) | ||
|
||
mark_as_advanced(LIBUUID_INCLUDE_DIR | ||
UUID_LIBRARY) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#cmakedefine CRAY_STACKSEG_END | ||
#cmakedefine C_ALLOCA | ||
#cmakedefine DEFINE_XOPEN_SOURCE | ||
#cmakedefine HAVE_ALLOCA | ||
#cmakedefine HAVE_ALLOCA_H | ||
#cmakedefine HAVE_CHMOD | ||
#cmakedefine HAVE_CRT_EXTERNS_H | ||
#cmakedefine HAVE_CRYPT | ||
#cmakedefine HAVE_CRYPT_H | ||
#cmakedefine HAVE_EXECINFO_H | ||
#cmakedefine HAVE_FCNTL_H | ||
#cmakedefine HAVE_GETRLIMIT | ||
#cmakedefine HAVE_H_ERRNO | ||
#cmakedefine HAVE_INITGROUPS | ||
#cmakedefine HAVE_INTTYPES_H | ||
#cmakedefine HAVE_LIBCRYPT | ||
#cmakedefine HAVE_LIBNSL | ||
#cmakedefine HAVE_LIBPTHREAD | ||
#cmakedefine HAVE_LIBPTHREADGC | ||
#cmakedefine HAVE_LIBPTHREADGC2 | ||
#cmakedefine HAVE_LIBSOCKET | ||
#cmakedefine HAVE_MALLINFO | ||
#cmakedefine HAVE_MALLOC_H | ||
#cmakedefine HAVE_MALLOC_INFO | ||
#cmakedefine HAVE_MEMORY_H | ||
#cmakedefine HAVE_NETINET_TCP_H | ||
#cmakedefine HAVE_OPEN_MEMSTREAM | ||
#cmakedefine HAVE_PIPE2 | ||
#cmakedefine HAVE_POLL | ||
#cmakedefine HAVE_POLL_H | ||
#cmakedefine HAVE_PRCTL | ||
#cmakedefine HAVE_SETGROUPS | ||
#cmakedefine HAVE_SETPGID | ||
#cmakedefine HAVE_SETPGRP | ||
#cmakedefine HAVE_SETSID | ||
#cmakedefine HAVE_SOCKET | ||
#cmakedefine HAVE_SOCKLEN_T | ||
#cmakedefine HAVE_SSIZE_T | ||
#cmakedefine HAVE_STDINT_H | ||
#cmakedefine HAVE_STDLIB_H | ||
#cmakedefine HAVE_STRCASESTR | ||
#cmakedefine HAVE_STRERROR | ||
#cmakedefine HAVE_STRINGS_H | ||
#cmakedefine HAVE_STRING_H | ||
#cmakedefine HAVE_SYSCONF | ||
#cmakedefine HAVE_SYSLOG_H | ||
#cmakedefine HAVE_SYS_PRCTL_H | ||
#cmakedefine HAVE_SYS_RESOURCE_H | ||
#cmakedefine HAVE_SYS_STAT_H | ||
#cmakedefine HAVE_SYS_TIME_H | ||
#cmakedefine HAVE_SYS_TYPES_H | ||
#cmakedefine HAVE_SYS_WAIT_H | ||
#cmakedefine HAVE_UNISTD_H | ||
#cmakedefine HAVE_UTIME | ||
#cmakedefine HAVE_UTIME_H | ||
#cmakedefine HAVE_VFORK | ||
#cmakedefine HAVE__NSGETENVIRON | ||
#cmakedefine O_PLMT | ||
#cmakedefine PL_ARITY_AS_SIZE | ||
#cmakedefine SETPGRP_VOID | ||
#cmakedefine SIZEOF_LONG | ||
#cmakedefine SIZEOF_LONG_LONG | ||
#cmakedefine STACK_DIRECTION | ||
#cmakedefine STDC_HEADERS | ||
#cmakedefine HAVE_UUID_H | ||
#cmakedefine HAVE_OSSP_UUID_H | ||
#cmakedefine _REENTRANT | ||
#cmakedefine size_t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* Part of SWI-Prolog | ||
Author: Jan Wielemaker | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 2018, VU University Amsterdam | ||
CWI, Amsterdam | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#define USE_SHA1 1 | ||
#include "hmac.c" |
Oops, something went wrong.