diff --git a/CMakeLists.txt b/CMakeLists.txt index e47891d..26c1d8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,15 @@ cmake_minimum_required(VERSION 3.9) +include(GNUInstallDirs) + +configure_file( + "${CMAKE_SOURCE_DIR}/pathnames.h.in" + "${CMAKE_BINARY_DIR}/pathnames.h" +) + +include_directories("${CMAKE_BINARY_DIR}") + project(sj3 VERSION 2.0.94 LANGUAGES C diff --git a/pathnames.h.in b/pathnames.h.in new file mode 100644 index 0000000..23011d4 --- /dev/null +++ b/pathnames.h.in @@ -0,0 +1,32 @@ +/*- + * SPDX-License-Identifier: MIT + * + * Copyright (c) 2023 Masanori Ogino + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef SJ3_PATHNAMES_H_ +#define SJ3_PATHNAMES_H_ + +#define _PATH_SJ3_CONF_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/sj3.conf" +#define _PATH_SJ3_LOCK_FILE "@CMAKE_INSTALL_FULL_RUNSTATEDIR@/sj3.lock" +#define _PATH_SJ3_SOCK_FILE "@CMAKE_INSTALL_FULL_RUNSTATEDIR@/sj3.sock" + +#endif diff --git a/sj3serv/sj3serv.c b/sj3serv/sj3serv.c index 26735b4..21eb368 100644 --- a/sj3serv/sj3serv.c +++ b/sj3serv/sj3serv.c @@ -27,6 +27,8 @@ * @brief かな漢字変換サーバーのエントリーポイント。 */ +#include "pathnames.h" + int main(int argc, char *argv[]) {