Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc07f8c

Browse files
committed
Create a C version of pg_config.
Andrew Dunstan
1 parent7510ac6 commitcc07f8c

File tree

5 files changed

+55
-104
lines changed

5 files changed

+55
-104
lines changed

‎src/bin/pg_config/Makefile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
# $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.7 2004/07/30 12:26:40 petere Exp $
1+
# $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.8 2004/08/01 06:56:38 momjian Exp $
22

33
subdir = src/bin/pg_config
44
top_builddir = ../../..
55
include$(top_builddir)/src/Makefile.global
66

7-
all:pg_config
7+
OBJS=pg_config.o exec.o
88

9-
pg_config: pg_config.sh$(top_builddir)/src/Makefile.global Makefile
10-
sed -e's,@bindir@,$(bindir),g'\
11-
-e's,@includedir@,$(includedir),g'\
12-
-e's,@includedir_server@,$(includedir_server),g'\
13-
-e's,@libdir@,$(libdir),g'\
14-
-e's,@pkglibdir@,$(pkglibdir),g'\
15-
-e's,@pgxsdir@,$(pgxsdir),g'\
16-
-e"s|@configure@|$(configure_args)|g"\
17-
-e's,@version@,$(VERSION),g'\
18-
$<>$@
19-
chmod a+x$@
9+
overrideCPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -DVAL_CONFIGURE="\"$(configure_args)\""$(CPPFLAGS)
2010

21-
install: all installdirs
22-
$(INSTALL_SCRIPT) pg_config$(DESTDIR)$(bindir)/pg_config
11+
all: submake-libpgport pg_config
12+
13+
exec.c:% :$(top_srcdir)/src/port/%
14+
rm -f$@&&$(LN_S)$<.
2315

16+
pg_config:$(OBJS)
17+
$(CC)$(CFLAGS)$(OBJS)$(LDFLAGS)$(LIBS) -o$@$(X)
18+
19+
install: all installdirs
20+
$(INSTALL_SCRIPT) pg_config$(X)$(DESTDIR)$(bindir)/pg_config$(X)
21+
2422
installdirs:
2523
$(mkinstalldirs)$(DESTDIR)$(bindir)
2624

2725
uninstall:
2826
rm -f$(DESTDIR)$(bindir)/pg_config
2927

3028
cleandistcleanmaintainer-clean:
31-
rm -f pg_config
29+
rm -f pg_config$(X)$(OBJS) exec.c

‎src/bin/pg_config/pg_config.sh

Lines changed: 0 additions & 83 deletions
This file was deleted.

‎src/include/port.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.46 2004/08/01 06:19:24 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.47 2004/08/01 06:56:39 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -44,6 +44,8 @@ extern void get_share_path(const char *my_exec_path, char *ret_path);
4444
externvoidget_etc_path(constchar*my_exec_path,char*ret_path);
4545
externvoidget_include_path(constchar*my_exec_path,char*ret_path);
4646
externvoidget_pkginclude_path(constchar*my_exec_path,char*ret_path);
47+
externvoidget_includeserver_path(constchar*my_exec_path,char*ret_path);
48+
externvoidget_lib_path(constchar*my_exec_path,char*ret_path);
4749
externvoidget_pkglib_path(constchar*my_exec_path,char*ret_path);
4850
externvoidget_locale_path(constchar*my_exec_path,char*ret_path);
4951
externvoidset_pglocale_pgservice(constchar*argv0,constchar*app);

‎src/port/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# with broken/missing library files.
88

99
# IDENTIFICATION
10-
# $PostgreSQL: pgsql/src/port/Makefile,v 1.15 2004/05/30 14:07:47 momjian Exp $
10+
# $PostgreSQL: pgsql/src/port/Makefile,v 1.16 2004/08/01 06:56:39 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -35,6 +35,8 @@ pg_config_paths.h: $(top_builddir)/src/Makefile.global
3535
echo"#define SYSCONFDIR\"$(sysconfdir)\"">>$@
3636
echo"#define INCLUDEDIR\"$(includedir)\"">>$@
3737
echo"#define PKGINCLUDEDIR\"$(pkgincludedir)\"">>$@
38+
echo"#define INCLUDEDIRSERVER\"$(includedir_server)\"">>$@
39+
echo"#define LIBDIR\"$(libdir)\"">>$@
3840
echo"#define PKGLIBDIR\"$(pkglibdir)\"">>$@
3941
echo"#define LOCALEDIR\"$(localedir)\"">>$@
4042

‎src/port/path.c

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.25 2004/07/12 19:27:31 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.26 2004/08/01 06:56:39 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -205,10 +205,42 @@ get_pkginclude_path(const char *my_exec_path, char *ret_path)
205205

206206

207207

208+
/*
209+
*get_includeserver_path
210+
*/
211+
void
212+
get_includeserver_path(constchar*my_exec_path,char*ret_path)
213+
{
214+
constchar*p;
215+
216+
if ((p=relative_path(PGBINDIR,INCLUDEDIRSERVER)))
217+
make_relative(my_exec_path,p,ret_path);
218+
else
219+
StrNCpy(ret_path,INCLUDEDIRSERVER,MAXPGPATH);
220+
canonicalize_path(ret_path);
221+
}
222+
223+
224+
225+
/*
226+
*get_lib_path
227+
*/
228+
void
229+
get_lib_path(constchar*my_exec_path,char*ret_path)
230+
{
231+
constchar*p;
232+
233+
if ((p=relative_path(PGBINDIR,LIBDIR)))
234+
make_relative(my_exec_path,p,ret_path);
235+
else
236+
StrNCpy(ret_path,LIBDIR,MAXPGPATH);
237+
canonicalize_path(ret_path);
238+
}
239+
240+
241+
208242
/*
209243
*get_pkglib_path
210-
*
211-
*Return library path, either relative to /bin or hardcoded
212244
*/
213245
void
214246
get_pkglib_path(constchar*my_exec_path,char*ret_path)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp