2016-02-17 18:12:06 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* config_info.c
|
|
|
|
* Common code for pg_config output
|
|
|
|
*
|
|
|
|
*
|
2021-01-02 19:06:25 +01:00
|
|
|
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
|
2016-02-17 18:12:06 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* src/common/config_info.c
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FRONTEND
|
|
|
|
#include "postgres.h"
|
|
|
|
#else
|
|
|
|
#include "postgres_fe.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "common/config_info.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2016-02-21 17:38:24 +01:00
|
|
|
* get_configdata(const char *my_exec_path, size_t *configdata_len)
|
2016-02-17 18:12:06 +01:00
|
|
|
*
|
|
|
|
* Get configure-time constants. The caller is responsible
|
|
|
|
* for pfreeing the result.
|
|
|
|
*/
|
|
|
|
ConfigData *
|
2016-02-21 17:38:24 +01:00
|
|
|
get_configdata(const char *my_exec_path, size_t *configdata_len)
|
2016-02-17 18:12:06 +01:00
|
|
|
{
|
|
|
|
ConfigData *configdata;
|
|
|
|
char path[MAXPGPATH];
|
|
|
|
char *lastsep;
|
2016-02-21 17:38:24 +01:00
|
|
|
int i = 0;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
/* Adjust this to match the number of items filled below */
|
|
|
|
*configdata_len = 23;
|
|
|
|
configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("BINDIR");
|
|
|
|
strlcpy(path, my_exec_path, sizeof(path));
|
2016-02-17 18:12:06 +01:00
|
|
|
lastsep = strrchr(path, '/');
|
|
|
|
if (lastsep)
|
|
|
|
*lastsep = '\0';
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("DOCDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_doc_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("HTMLDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_html_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("INCLUDEDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_include_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("PKGINCLUDEDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_pkginclude_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("INCLUDEDIR-SERVER");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_includeserver_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LIBDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_lib_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("PKGLIBDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_pkglib_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LOCALEDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_locale_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("MANDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_man_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("SHAREDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_share_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("SYSCONFDIR");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_etc_path(my_exec_path, path);
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("PGXS");
|
2016-02-17 18:12:06 +01:00
|
|
|
get_pkglib_path(my_exec_path, path);
|
|
|
|
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
|
|
|
|
cleanup_path(path);
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(path);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("CONFIGURE");
|
2020-02-10 17:12:46 +01:00
|
|
|
configdata[i].setting = pstrdup(CONFIGURE_ARGS);
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("CC");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_CC
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_CC);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("CPPFLAGS");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_CPPFLAGS
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_CPPFLAGS);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("CFLAGS");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_CFLAGS
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_CFLAGS);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("CFLAGS_SL");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_CFLAGS_SL
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_CFLAGS_SL);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LDFLAGS");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_LDFLAGS
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_LDFLAGS);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LDFLAGS_EX");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_LDFLAGS_EX
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_LDFLAGS_EX);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LDFLAGS_SL");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_LDFLAGS_SL
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_LDFLAGS_SL);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].name = pstrdup("LIBS");
|
2016-02-17 18:12:06 +01:00
|
|
|
#ifdef VAL_LIBS
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(VAL_LIBS);
|
2016-02-17 18:12:06 +01:00
|
|
|
#else
|
2016-02-21 17:38:24 +01:00
|
|
|
configdata[i].setting = pstrdup(_("not recorded"));
|
2016-02-17 18:12:06 +01:00
|
|
|
#endif
|
2016-02-21 17:38:24 +01:00
|
|
|
i++;
|
|
|
|
|
|
|
|
configdata[i].name = pstrdup("VERSION");
|
|
|
|
configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
|
|
|
|
i++;
|
2016-02-17 18:12:06 +01:00
|
|
|
|
2016-02-21 17:38:24 +01:00
|
|
|
Assert(i == *configdata_len);
|
2016-02-17 18:12:06 +01:00
|
|
|
|
|
|
|
return configdata;
|
|
|
|
}
|