PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
config_info.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ConfigData
 

Typedefs

typedef struct ConfigData ConfigData
 

Functions

ConfigDataget_configdata (const char *my_exec_path, size_t *configdata_len)
 

Typedef Documentation

Function Documentation

ConfigData* get_configdata ( const char *  my_exec_path,
size_t *  configdata_len 
)

Definition at line 33 of file config_info.c.

References _, Assert, cleanup_path(), get_doc_path(), get_etc_path(), get_html_path(), get_include_path(), get_includeserver_path(), get_lib_path(), get_locale_path(), get_man_path(), get_pkginclude_path(), get_pkglib_path(), get_share_path(), i, MAXPGPATH, ConfigData::name, palloc(), pstrdup(), ConfigData::setting, strlcat(), and strlcpy().

Referenced by main(), and pg_config().

34 {
35  ConfigData *configdata;
36  char path[MAXPGPATH];
37  char *lastsep;
38  int i = 0;
39 
40  /* Adjust this to match the number of items filled below */
41  *configdata_len = 23;
42  configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
43 
44  configdata[i].name = pstrdup("BINDIR");
45  strlcpy(path, my_exec_path, sizeof(path));
46  lastsep = strrchr(path, '/');
47  if (lastsep)
48  *lastsep = '\0';
49  cleanup_path(path);
50  configdata[i].setting = pstrdup(path);
51  i++;
52 
53  configdata[i].name = pstrdup("DOCDIR");
55  cleanup_path(path);
56  configdata[i].setting = pstrdup(path);
57  i++;
58 
59  configdata[i].name = pstrdup("HTMLDIR");
61  cleanup_path(path);
62  configdata[i].setting = pstrdup(path);
63  i++;
64 
65  configdata[i].name = pstrdup("INCLUDEDIR");
67  cleanup_path(path);
68  configdata[i].setting = pstrdup(path);
69  i++;
70 
71  configdata[i].name = pstrdup("PKGINCLUDEDIR");
73  cleanup_path(path);
74  configdata[i].setting = pstrdup(path);
75  i++;
76 
77  configdata[i].name = pstrdup("INCLUDEDIR-SERVER");
79  cleanup_path(path);
80  configdata[i].setting = pstrdup(path);
81  i++;
82 
83  configdata[i].name = pstrdup("LIBDIR");
85  cleanup_path(path);
86  configdata[i].setting = pstrdup(path);
87  i++;
88 
89  configdata[i].name = pstrdup("PKGLIBDIR");
91  cleanup_path(path);
92  configdata[i].setting = pstrdup(path);
93  i++;
94 
95  configdata[i].name = pstrdup("LOCALEDIR");
97  cleanup_path(path);
98  configdata[i].setting = pstrdup(path);
99  i++;
100 
101  configdata[i].name = pstrdup("MANDIR");
102  get_man_path(my_exec_path, path);
103  cleanup_path(path);
104  configdata[i].setting = pstrdup(path);
105  i++;
106 
107  configdata[i].name = pstrdup("SHAREDIR");
109  cleanup_path(path);
110  configdata[i].setting = pstrdup(path);
111  i++;
112 
113  configdata[i].name = pstrdup("SYSCONFDIR");
114  get_etc_path(my_exec_path, path);
115  cleanup_path(path);
116  configdata[i].setting = pstrdup(path);
117  i++;
118 
119  configdata[i].name = pstrdup("PGXS");
121  strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
122  cleanup_path(path);
123  configdata[i].setting = pstrdup(path);
124  i++;
125 
126  configdata[i].name = pstrdup("CONFIGURE");
127 #ifdef VAL_CONFIGURE
128  configdata[i].setting = pstrdup(VAL_CONFIGURE);
129 #else
130  configdata[i].setting = pstrdup(_("not recorded"));
131 #endif
132  i++;
133 
134  configdata[i].name = pstrdup("CC");
135 #ifdef VAL_CC
136  configdata[i].setting = pstrdup(VAL_CC);
137 #else
138  configdata[i].setting = pstrdup(_("not recorded"));
139 #endif
140  i++;
141 
142  configdata[i].name = pstrdup("CPPFLAGS");
143 #ifdef VAL_CPPFLAGS
144  configdata[i].setting = pstrdup(VAL_CPPFLAGS);
145 #else
146  configdata[i].setting = pstrdup(_("not recorded"));
147 #endif
148  i++;
149 
150  configdata[i].name = pstrdup("CFLAGS");
151 #ifdef VAL_CFLAGS
152  configdata[i].setting = pstrdup(VAL_CFLAGS);
153 #else
154  configdata[i].setting = pstrdup(_("not recorded"));
155 #endif
156  i++;
157 
158  configdata[i].name = pstrdup("CFLAGS_SL");
159 #ifdef VAL_CFLAGS_SL
160  configdata[i].setting = pstrdup(VAL_CFLAGS_SL);
161 #else
162  configdata[i].setting = pstrdup(_("not recorded"));
163 #endif
164  i++;
165 
166  configdata[i].name = pstrdup("LDFLAGS");
167 #ifdef VAL_LDFLAGS
168  configdata[i].setting = pstrdup(VAL_LDFLAGS);
169 #else
170  configdata[i].setting = pstrdup(_("not recorded"));
171 #endif
172  i++;
173 
174  configdata[i].name = pstrdup("LDFLAGS_EX");
175 #ifdef VAL_LDFLAGS_EX
176  configdata[i].setting = pstrdup(VAL_LDFLAGS_EX);
177 #else
178  configdata[i].setting = pstrdup(_("not recorded"));
179 #endif
180  i++;
181 
182  configdata[i].name = pstrdup("LDFLAGS_SL");
183 #ifdef VAL_LDFLAGS_SL
184  configdata[i].setting = pstrdup(VAL_LDFLAGS_SL);
185 #else
186  configdata[i].setting = pstrdup(_("not recorded"));
187 #endif
188  i++;
189 
190  configdata[i].name = pstrdup("LIBS");
191 #ifdef VAL_LIBS
192  configdata[i].setting = pstrdup(VAL_LIBS);
193 #else
194  configdata[i].setting = pstrdup(_("not recorded"));
195 #endif
196  i++;
197 
198  configdata[i].name = pstrdup("VERSION");
199  configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
200  i++;
201 
202  Assert(i == *configdata_len);
203 
204  return configdata;
205 }
void get_includeserver_path(const char *my_exec_path, char *ret_path)
Definition: path.c:740
char * pstrdup(const char *in)
Definition: mcxt.c:1077
void get_pkglib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:758
char * name
Definition: config_info.h:14
char * setting
Definition: config_info.h:15
void get_lib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:749
void get_pkginclude_path(const char *my_exec_path, char *ret_path)
Definition: path.c:731
#define MAXPGPATH
void get_doc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:776
void cleanup_path(char *path)
Definition: path.c:185
char my_exec_path[MAXPGPATH]
Definition: globals.c:64
void get_etc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:713
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
#define Assert(condition)
Definition: c.h:676
void get_html_path(const char *my_exec_path, char *ret_path)
Definition: path.c:785
void get_man_path(const char *my_exec_path, char *ret_path)
Definition: path.c:794
void get_include_path(const char *my_exec_path, char *ret_path)
Definition: path.c:722
void * palloc(Size size)
Definition: mcxt.c:849
int i
void get_locale_path(const char *my_exec_path, char *ret_path)
Definition: path.c:767
void get_share_path(const char *my_exec_path, char *ret_path)
Definition: path.c:704
#define _(x)
Definition: elog.c:84
size_t strlcat(char *dst, const char *src, size_t siz)
Definition: strlcat.c:33