Uses configurable path for libnfc's configuration files
This commit is contained in:
parent
cf9e02879a
commit
b5f8ce91c7
5 changed files with 18 additions and 3 deletions
|
@ -13,9 +13,11 @@ SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||||
# config.h
|
# config.h
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_windows.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_windows.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
||||||
|
SET(LIBNFC_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/config" CACHE PATH "libnfc configuration directory")
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32)
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
SET(_XOPEN_SOURCE 600)
|
SET(_XOPEN_SOURCE 600)
|
||||||
|
SET(SYSCONFDIR "/etc" CACHE PATH "System configuration directory")
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_posix.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_posix.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
#cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@
|
#cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@
|
||||||
|
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
|
||||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
#cmakedefine LIBNFC_SYSCONFDIR "@LIBNFC_SYSCONFDIR@"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SUBDIRS = chips buses drivers .
|
SUBDIRS = chips buses drivers .
|
||||||
|
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
AM_CPPFLAGS = $(all_includes) $(LIBNFC_CFLAGS)
|
AM_CPPFLAGS = $(all_includes) $(LIBNFC_CFLAGS) -DSYSCONFDIR='"$(sysconfdir)"'
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
conf.h \
|
conf.h \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*-
|
/*-
|
||||||
* Copyright (C) 2012 Romuald Conty
|
* Copyright (C) 2012, 2013 Romuald Conty
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -31,7 +35,14 @@
|
||||||
#define LOG_CATEGORY "libnfc.config"
|
#define LOG_CATEGORY "libnfc.config"
|
||||||
#define LOG_GROUP NFC_LOG_GROUP_CONFIG
|
#define LOG_GROUP NFC_LOG_GROUP_CONFIG
|
||||||
|
|
||||||
#define LIBNFC_SYSCONFDIR "/etc/nfc"
|
#ifndef LIBNFC_SYSCONFDIR
|
||||||
|
// If this define does not already exists, we build it using SYSCONFDIR
|
||||||
|
#ifndef SYSCONFDIR
|
||||||
|
#error "SYSCONFDIR is not defined but required."
|
||||||
|
#endif // SYSCONFDIR
|
||||||
|
#define LIBNFC_SYSCONFDIR SYSCONFDIR"/nfc"
|
||||||
|
#endif // LIBNFC_SYSCONFDIR
|
||||||
|
|
||||||
#define LIBNFC_CONFFILE LIBNFC_SYSCONFDIR"/libnfc.conf"
|
#define LIBNFC_CONFFILE LIBNFC_SYSCONFDIR"/libnfc.conf"
|
||||||
#define LIBNFC_DEVICECONFDIR LIBNFC_SYSCONFDIR"/devices.d"
|
#define LIBNFC_DEVICECONFDIR LIBNFC_SYSCONFDIR"/devices.d"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue