1 /*-------------------------------------------------------------------------
4 * Common code for pg_config output
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
12 * src/common/config_info.c
14 *-------------------------------------------------------------------------
20 #include "postgres_fe.h"
23 #include "common/config_info.h"
27 * get_configdata(const char *my_exec_path, size_t *configdata_len)
29 * Get configure-time constants. The caller is responsible
30 * for pfreeing the result.
33 get_configdata(const char *my_exec_path
, size_t *configdata_len
)
35 ConfigData
*configdata
;
40 /* Adjust this to match the number of items filled below */
42 configdata
= palloc_array(ConfigData
, *configdata_len
);
44 configdata
[i
].name
= pstrdup("BINDIR");
45 strlcpy(path
, my_exec_path
, sizeof(path
));
46 lastsep
= strrchr(path
, '/');
50 configdata
[i
].setting
= pstrdup(path
);
53 configdata
[i
].name
= pstrdup("DOCDIR");
54 get_doc_path(my_exec_path
, path
);
56 configdata
[i
].setting
= pstrdup(path
);
59 configdata
[i
].name
= pstrdup("HTMLDIR");
60 get_html_path(my_exec_path
, path
);
62 configdata
[i
].setting
= pstrdup(path
);
65 configdata
[i
].name
= pstrdup("INCLUDEDIR");
66 get_include_path(my_exec_path
, path
);
68 configdata
[i
].setting
= pstrdup(path
);
71 configdata
[i
].name
= pstrdup("PKGINCLUDEDIR");
72 get_pkginclude_path(my_exec_path
, path
);
74 configdata
[i
].setting
= pstrdup(path
);
77 configdata
[i
].name
= pstrdup("INCLUDEDIR-SERVER");
78 get_includeserver_path(my_exec_path
, path
);
80 configdata
[i
].setting
= pstrdup(path
);
83 configdata
[i
].name
= pstrdup("LIBDIR");
84 get_lib_path(my_exec_path
, path
);
86 configdata
[i
].setting
= pstrdup(path
);
89 configdata
[i
].name
= pstrdup("PKGLIBDIR");
90 get_pkglib_path(my_exec_path
, path
);
92 configdata
[i
].setting
= pstrdup(path
);
95 configdata
[i
].name
= pstrdup("LOCALEDIR");
96 get_locale_path(my_exec_path
, path
);
98 configdata
[i
].setting
= pstrdup(path
);
101 configdata
[i
].name
= pstrdup("MANDIR");
102 get_man_path(my_exec_path
, path
);
104 configdata
[i
].setting
= pstrdup(path
);
107 configdata
[i
].name
= pstrdup("SHAREDIR");
108 get_share_path(my_exec_path
, path
);
110 configdata
[i
].setting
= pstrdup(path
);
113 configdata
[i
].name
= pstrdup("SYSCONFDIR");
114 get_etc_path(my_exec_path
, path
);
116 configdata
[i
].setting
= pstrdup(path
);
119 configdata
[i
].name
= pstrdup("PGXS");
120 get_pkglib_path(my_exec_path
, path
);
121 strlcat(path
, "/pgxs/src/makefiles/pgxs.mk", sizeof(path
));
123 configdata
[i
].setting
= pstrdup(path
);
126 configdata
[i
].name
= pstrdup("CONFIGURE");
127 configdata
[i
].setting
= pstrdup(CONFIGURE_ARGS
);
130 configdata
[i
].name
= pstrdup("CC");
132 configdata
[i
].setting
= pstrdup(VAL_CC
);
134 configdata
[i
].setting
= pstrdup(_("not recorded"));
138 configdata
[i
].name
= pstrdup("CPPFLAGS");
140 configdata
[i
].setting
= pstrdup(VAL_CPPFLAGS
);
142 configdata
[i
].setting
= pstrdup(_("not recorded"));
146 configdata
[i
].name
= pstrdup("CFLAGS");
148 configdata
[i
].setting
= pstrdup(VAL_CFLAGS
);
150 configdata
[i
].setting
= pstrdup(_("not recorded"));
154 configdata
[i
].name
= pstrdup("CFLAGS_SL");
156 configdata
[i
].setting
= pstrdup(VAL_CFLAGS_SL
);
158 configdata
[i
].setting
= pstrdup(_("not recorded"));
162 configdata
[i
].name
= pstrdup("LDFLAGS");
164 configdata
[i
].setting
= pstrdup(VAL_LDFLAGS
);
166 configdata
[i
].setting
= pstrdup(_("not recorded"));
170 configdata
[i
].name
= pstrdup("LDFLAGS_EX");
171 #ifdef VAL_LDFLAGS_EX
172 configdata
[i
].setting
= pstrdup(VAL_LDFLAGS_EX
);
174 configdata
[i
].setting
= pstrdup(_("not recorded"));
178 configdata
[i
].name
= pstrdup("LDFLAGS_SL");
179 #ifdef VAL_LDFLAGS_SL
180 configdata
[i
].setting
= pstrdup(VAL_LDFLAGS_SL
);
182 configdata
[i
].setting
= pstrdup(_("not recorded"));
186 configdata
[i
].name
= pstrdup("LIBS");
188 configdata
[i
].setting
= pstrdup(VAL_LIBS
);
190 configdata
[i
].setting
= pstrdup(_("not recorded"));
194 configdata
[i
].name
= pstrdup("VERSION");
195 configdata
[i
].setting
= pstrdup("PostgreSQL " PG_VERSION
);
198 Assert(i
== *configdata_len
);