Ruby: loadpath.c Source File

Ruby 3.4.1p0 (2024-12-25 revision 48d4efcb85000e1ebae42004e963b5d0cedddcf2)

loadpath.c
1/**********************************************************************
2
3 loadpath.c -
4
5 $Author$
6 created at: Wed May 15 14:19:50 JST 2013
7
8 Copyright (C) 2013 Yukihiro Matsumoto
9
10**********************************************************************/
11
12#include "verconf.h"
13#include "ruby/ruby.h"
14
15/* Define RUBY_REVISION to avoid revision.h inclusion via version.h. */
16#define RUBY_REVISION 0
17#include "version.h"
18
19#ifndef RUBY_ARCH
20#define RUBY_ARCH RUBY_PLATFORM
21#endif
22#ifndef RUBY_SITEARCH
23#define RUBY_SITEARCH RUBY_ARCH
24#endif
25#ifdef RUBY_PLATFORM_CPU
26#define RUBY_THINARCH RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
27#endif
28#ifndef RUBY_LIB_PREFIX
29#ifndef RUBY_EXEC_PREFIX
30#error RUBY_EXEC_PREFIX must be defined
31#endif
32#define RUBY_LIB_PREFIX RUBY_EXEC_PREFIX"/lib/ruby"
33#endif
34#ifndef RUBY_SITE_LIB
35#define RUBY_SITE_LIB RUBY_LIB_PREFIX"/site_ruby"
36#endif
37#ifndef RUBY_VENDOR_LIB
38#define RUBY_VENDOR_LIB RUBY_LIB_PREFIX"/vendor_ruby"
39#endif
40
41typedef char ruby_lib_version_string[(int)sizeof(RUBY_LIB_VERSION) - 2];
42
43#ifndef RUBY_LIB
44#define RUBY_LIB RUBY_LIB_PREFIX "/"RUBY_LIB_VERSION
45#endif
46#define RUBY_SITE_LIB2 RUBY_SITE_LIB "/"RUBY_LIB_VERSION
47#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB "/"RUBY_LIB_VERSION
48#ifndef RUBY_ARCH_LIB_FOR
49#define RUBY_ARCH_LIB_FOR(arch) RUBY_LIB "/"arch
50#endif
51#ifndef RUBY_SITE_ARCH_LIB_FOR
52#define RUBY_SITE_ARCH_LIB_FOR(arch) RUBY_SITE_LIB2 "/"arch
53#endif
54#ifndef RUBY_VENDOR_ARCH_LIB_FOR
55#define RUBY_VENDOR_ARCH_LIB_FOR(arch) RUBY_VENDOR_LIB2 "/"arch
56#endif
57
58#if !defined(LOAD_RELATIVE) || !LOAD_RELATIVE
59const char ruby_exec_prefix[] = RUBY_EXEC_PREFIX;
60#endif
61
62const char ruby_initial_load_paths[] =
63#ifndef NO_INITIAL_LOAD_PATH
64#ifdef RUBY_SEARCH_PATH
65 RUBY_SEARCH_PATH "\0"
66#endif
67#ifndef NO_RUBY_SITE_LIB
68 RUBY_SITE_LIB2 "\0"
69#ifdef RUBY_THINARCH
70 RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
71#endif
72 RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
73 RUBY_SITE_LIB "\0"
74#endif
75
76#ifndef NO_RUBY_VENDOR_LIB
77 RUBY_VENDOR_LIB2 "\0"
78#ifdef RUBY_THINARCH
79 RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
80#endif
81 RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
82 RUBY_VENDOR_LIB "\0"
83#endif
84
85 RUBY_LIB "\0"
86#ifdef RUBY_THINARCH
87 RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
88#endif
89 RUBY_ARCH_LIB_FOR(RUBY_ARCH) "\0"
90#endif
91 "";
ruby.h