-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:sahlberg/libnfs
- Loading branch information
Showing
23 changed files
with
588 additions
and
0 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 |
---|---|---|
|
@@ -38,3 +38,4 @@ stamp-h1 | |
|
||
libnfs.pc | ||
!libnfs.pc.in | ||
build |
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,97 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
project(libnfs | ||
LANGUAGES C | ||
VERSION 2.0.0) | ||
|
||
set(SOVERSION 11.0.0 CACHE STRING "" FORCE) | ||
|
||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") | ||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") | ||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") | ||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") | ||
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/libnfs" CACHE PATH "Installation directory for cmake (.cmake) files") | ||
|
||
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
option(ENABLE_TESTS "Build and run test programs" OFF) | ||
option(ENABLE_DOCUMENTATION "Build Documentation" OFF) | ||
option(ENABLE_UTILS "Build util programs" OFF) | ||
option(ENABLE_EXAMPLES "Build example programs" OFF) | ||
|
||
if(ENABLE_TESTS) | ||
set(ENABLE_UTILS ON CACHE BOOL "Building utils required by tests" FORCE) | ||
endif() | ||
|
||
include(cmake/Macros.cmake) | ||
include(cmake/ConfigureChecks.cmake) | ||
|
||
include_directories(${CMAKE_CURRENT_BINARY_DIR} | ||
include | ||
include/nfsc) | ||
|
||
set(CORE_LIBRARIES nfs) | ||
set(core_DEPENDS "" CACHE STRING "" FORCE) | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL Windows) | ||
list(APPEND CORE_LIBRARIES -lws2_32.lib) | ||
add_subdirectory(win32) | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL Solaris) | ||
find_library(SOCKET_LIBRARY socket) | ||
find_library(NSL_LIBRARY nsl) | ||
list(APPEND CORE_LIBRARIES ${SOCKET_LIBRARY} ${NSL_LIBRARY}) | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL aros) | ||
add_definitions(-DAROS) | ||
add_subdirectory(aros) | ||
endif() | ||
|
||
if(ENABLE_DOCUMENTATION) | ||
add_subdirectory(doc) | ||
endif() | ||
|
||
if(ENABLE_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
if(ENABLE_TESTS) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
if(ENABLE_UTILS) | ||
add_subdirectory(utils) | ||
endif() | ||
|
||
add_subdirectory(mount) | ||
add_subdirectory(nfs) | ||
add_subdirectory(nfs4) | ||
add_subdirectory(nlm) | ||
add_subdirectory(nsm) | ||
add_subdirectory(portmap) | ||
add_subdirectory(rquota) | ||
add_subdirectory(lib) | ||
|
||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/libnfs-config-version.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY AnyNewerVersion) | ||
|
||
configure_file(cmake/libnfs.pc.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/libnfs.pc @ONLY) | ||
|
||
install(DIRECTORY include/nfsc | ||
DESTINATION ${INSTALL_INC_DIR}) | ||
|
||
install(FILES mount/libnfs-raw-mount.h | ||
nfs/libnfs-raw-nfs.h | ||
nlm/libnfs-raw-nlm.h | ||
nsm/libnfs-raw-nsm.h | ||
portmap/libnfs-raw-portmap.h | ||
rquota/libnfs-raw-rquota.h | ||
DESTINATION ${INSTALL_INC_DIR}/nfsc) | ||
|
||
install(FILES cmake/FindNFS.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/libnfs-config-version.cmake | ||
DESTINATION ${INSTALL_CMAKE_DIR}) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfs.pc | ||
DESTINATION ${INSTALL_PKGCONFIG_DIR}) |
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,4 @@ | ||
set(SOURCES aros_compat.c) | ||
set(HEADERS aros_compat.h) | ||
|
||
core_add_library(aros) |
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,103 @@ | ||
include(CheckIncludeFile) | ||
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) | ||
check_include_file("dlfcn.h" HAVE_DLFCN_H) | ||
check_include_file("fuse.h" HAVE_FUSE_H) | ||
check_include_file("inttypes.h" HAVE_INTTYPES_H) | ||
check_include_file("memory.h" HAVE_MEMORY_H) | ||
check_include_file("netdb.h" HAVE_NETDB_H) | ||
check_include_file("netinet/in.h" HAVE_NETINET_IN_H) | ||
check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H) | ||
check_include_file("net/if.h" HAVE_NET_IF_H) | ||
check_include_file("poll.h" HAVE_POLL_H) | ||
check_include_file("stdint.h" HAVE_STDINT_H) | ||
check_include_file("stdlib.h" HAVE_STDLIB_H) | ||
check_include_file("strings.h" HAVE_STRINGS_H) | ||
check_include_file("string.h" HAVE_STRING_H) | ||
check_include_file("sys/filio.h" HAVE_SYS_FILIO_H) | ||
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H) | ||
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) | ||
check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H) | ||
check_include_file("sys/stat.h" HAVE_SYS_STAT_H) | ||
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) | ||
check_include_file("sys/time.h" HAVE_SYS_TIME_H) | ||
check_include_file("sys/types.h" HAVE_SYS_TYPES_H) | ||
check_include_file("sys/vfs.h" HAVE_SYS_VFS_H) | ||
check_include_file("unistd.h" HAVE_UNISTD_H) | ||
check_include_file("utime.h" HAVE_UTIME_H) | ||
|
||
include(CheckStructHasMember) | ||
check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_SOCKADDR_LEN) | ||
check_struct_has_member("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE) | ||
check_struct_has_member("struct stat" st_mtim.tv_nsec sys/stat.h HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) | ||
|
||
include(CheckCSourceCompiles) | ||
check_c_source_compiles("#include <net/if.h> | ||
int main(void) | ||
{ | ||
int i = SO_BINDTODEVICE; | ||
}" | ||
HAVE_SO_BINDTODEVICE) | ||
|
||
check_c_source_compiles("#include <talloc.h> | ||
#include <tevent.h> | ||
int main(void) | ||
{ | ||
struct tevent_context *ctx = tevent_context_init(NULL); | ||
int major = talloc_version_major(); | ||
}" | ||
HAVE_TALLOC_TEVENT) | ||
|
||
check_c_source_compiles("#include <time.h> | ||
int main(void) | ||
{ | ||
int i = clock_gettime(CLOCK_MONOTONIC_COARSE, NULL); | ||
}" | ||
HAVE_CLOCK_GETTIME) | ||
|
||
check_c_source_compiles("#include <sys/types.h> | ||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; | ||
int main() | ||
{ | ||
return 0; | ||
}" | ||
NO_LFS_REQUIRED) | ||
|
||
if(NOT NO_LFS_REQUIRED) | ||
check_c_source_compiles("#include <sys/types.h> | ||
#define _FILE_OFFSET_BITS 64 | ||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; | ||
int main() | ||
{ | ||
return 0; | ||
}" | ||
_FILE_OFFSET_BITS) | ||
|
||
check_c_source_compiles("#include <sys/types.h> | ||
#define _LARGE_FILES 1 | ||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; | ||
int main() | ||
{ | ||
return 0; | ||
}" | ||
_LARGE_FILES) | ||
endif() | ||
|
||
|
||
include(CheckSymbolExists) | ||
check_symbol_exists("makedev" "sys/mkdev.h" MAJOR_IN_MKDEV) | ||
check_symbol_exists("makedev" "sys/sysmacros.h" MAJOR_IN_SYSMACROS) | ||
|
||
include(CheckCCompilerFlag) | ||
if(CMAKE_COMPILER_IS_GNUCC) | ||
check_c_compiler_flag(-Wall C_ACCEPTS_WALL) | ||
|
||
if(C_ACCEPTS_WALL) | ||
add_definitions(-Wall) | ||
endif() | ||
endif() | ||
|
||
configure_file(cmake/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) | ||
add_definitions(-DHAVE_CONFIG_H) |
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 @@ | ||
#.rst: | ||
# FindNFS | ||
# ------- | ||
# Finds the libnfs library | ||
# | ||
# This will will define the following variables:: | ||
# | ||
# NFS_FOUND - system has libnfs | ||
# NFS_INCLUDE_DIRS - the libnfs include directory | ||
# NFS_LIBRARIES - the libnfs libraries | ||
# NFS_DEFINITIONS - the libnfs compile definitions | ||
# | ||
|
||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(PC_NFS libnfs QUIET) | ||
endif() | ||
|
||
find_path(NFS_INCLUDE_DIR nfsc/libnfs.h | ||
PATHS ${PC_NFS_INCLUDEDIR}) | ||
find_library(NFS_LIBRARY NAMES nfs | ||
PATHS ${PC_NFS_LIBDIR}) | ||
|
||
set(NFS_VERSION ${PC_NFS_VERSION}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(NFS | ||
REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR | ||
VERSION_VAR NFS_VERSION) | ||
|
||
if(NFS_FOUND) | ||
set(NFS_LIBRARIES ${NFS_LIBRARY}) | ||
set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR}) | ||
set(NFS_DEFINITIONS -DHAVE_LIBNFS=1) | ||
endif() | ||
|
||
mark_as_advanced(NFS_INCLUDE_DIR NFS_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,15 @@ | ||
# Add sources to main application | ||
# Arguments: | ||
# name name of the library to add | ||
# Implicit arguments: | ||
# SOURCES the sources of the library | ||
# HEADERS the headers of the library (only for IDE support) | ||
# On return: | ||
# Library will be built and added to ${core_DEPENDS} | ||
function(core_add_library name) | ||
set(name core_${name}) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
add_library(${name} STATIC ${SOURCES} ${HEADERS}) | ||
target_include_directories(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) | ||
endfunction() |
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,122 @@ | ||
/* config.h.cmake */ | ||
|
||
/* Define to 1 if you have the <arpa/inet.h> header file. */ | ||
#cmakedefine HAVE_ARPA_INET_H | ||
|
||
/* Whether we have clock_gettime */ | ||
#cmakedefine HAVE_CLOCK_GETTIME | ||
|
||
/* Define to 1 if you have the <dlfcn.h> header file. */ | ||
#cmakedefine HAVE_DLFCN_H | ||
|
||
/* Define to 1 if you have the <fuse.h> header file. */ | ||
#cmakedefine HAVE_FUSE_H | ||
|
||
/* Define to 1 if you have the <inttypes.h> header file. */ | ||
#cmakedefine HAVE_INTTYPES_H | ||
|
||
/* Define to 1 if you have the `nsl' library (-lnsl). */ | ||
#cmakedefine HAVE_LIBNSL | ||
|
||
/* Define to 1 if you have the `socket' library (-lsocket). */ | ||
#cmakedefine HAVE_LIBSOCKET | ||
|
||
/* Define to 1 if you have the <memory.h> header file. */ | ||
#cmakedefine HAVE_MEMORY_H | ||
|
||
/* Define to 1 if you have the <netdb.h> header file. */ | ||
#cmakedefine HAVE_NETDB_H | ||
|
||
/* Define to 1 if you have the <netinet/in.h> header file. */ | ||
#cmakedefine HAVE_NETINET_IN_H | ||
|
||
/* Define to 1 if you have the <netinet/tcp.h> header file. */ | ||
#cmakedefine HAVE_NETINET_TCP_H | ||
|
||
/* Define to 1 if you have the <net/if.h> header file. */ | ||
#cmakedefine HAVE_NET_IF_H | ||
|
||
/* Define to 1 if you have the <poll.h> header file. */ | ||
#cmakedefine HAVE_POLL_H | ||
|
||
/* Whether sockaddr struct has sa_len */ | ||
#cmakedefine HAVE_SOCKADDR_LEN | ||
|
||
/* Whether we have sockaddr_Storage */ | ||
#cmakedefine HAVE_SOCKADDR_STORAGE | ||
|
||
/* Whether our sockets support SO_BINDTODEVICE */ | ||
#cmakedefine HAVE_SO_BINDTODEVICE | ||
|
||
/* Define to 1 if you have the <stdint.h> header file. */ | ||
#cmakedefine HAVE_STDINT_H | ||
|
||
/* Define to 1 if you have the <stdlib.h> header file. */ | ||
#cmakedefine HAVE_STDLIB_H | ||
|
||
/* Define to 1 if you have the <strings.h> header file. */ | ||
#cmakedefine HAVE_STRINGS_H | ||
|
||
/* Define to 1 if you have the <string.h> header file. */ | ||
#cmakedefine HAVE_STRING_H | ||
|
||
/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ | ||
#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC | ||
|
||
/* Define to 1 if you have the <sys/filio.h> header file. */ | ||
#cmakedefine HAVE_SYS_FILIO_H | ||
|
||
/* Define to 1 if you have the <sys/ioctl.h> header file. */ | ||
#cmakedefine HAVE_SYS_IOCTL_H | ||
|
||
/* Define to 1 if you have the <sys/socket.h> header file. */ | ||
#cmakedefine HAVE_SYS_SOCKET_H | ||
|
||
/* Define to 1 if you have the <sys/sockio.h> header file. */ | ||
#cmakedefine HAVE_SYS_SOCKIO_H | ||
|
||
/* Define to 1 if you have the <sys/statvfs.h> header file. */ | ||
#cmakedefine HAVE_SYS_STATVFS_H | ||
|
||
/* Define to 1 if you have the <sys/stat.h> header file. */ | ||
#cmakedefine HAVE_SYS_STAT_H | ||
|
||
/* Define to 1 if you have the <sys/sysmacros.h> header file. */ | ||
#cmakedefine HAVE_SYS_SYSMACROS_H | ||
|
||
/* Define to 1 if you have the <sys/time.h> header file. */ | ||
#cmakedefine HAVE_SYS_TIME_H | ||
|
||
/* Define to 1 if you have the <sys/types.h> header file. */ | ||
#cmakedefine HAVE_SYS_TYPES_H | ||
|
||
/* Define to 1 if you have the <sys/vfs.h> header file. */ | ||
#cmakedefine HAVE_SYS_VFS_H | ||
|
||
/* Whether we have talloc nad tevent support */ | ||
#cmakedefine HAVE_TALLOC_TEVENT | ||
|
||
/* Define to 1 if you have the <unistd.h> header file. */ | ||
#cmakedefine HAVE_UNISTD_H | ||
|
||
/* Define to 1 if you have the <utime.h> header file. */ | ||
#cmakedefine HAVE_UTIME_H | ||
|
||
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. | ||
*/ | ||
#cmakedefine MAJOR_IN_MKDEV | ||
|
||
/* Define to 1 if `major', `minor', and `makedev' are declared in | ||
<sysmacros.h>. */ | ||
#cmakedefine MAJOR_IN_SYSMACROS | ||
|
||
/* 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. */ | ||
#cmakedefine _FILE_OFFSET_BITS | ||
|
||
/* Define for large files, on AIX-style hosts. */ | ||
#cmakedefine _LARGE_FILES |
Oops, something went wrong.