summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-05-17 14:35:34 +0000
committerBruce Momjian <bruce@momjian.us>2004-05-17 14:35:34 +0000
commit3febb477e643c1cd37fc8d2d3e02685dce6d1196 (patch)
treeadc5f3696ec9001b0bda4d9c0336c50c251c2f62 /src/interfaces
parent85383214ea2b0085658a650b4e6b293464dcf045 (diff)
Reorganize code to allow path-relative installs.
Create new get_* functions to access compiled-in paths and adjust if relative installs are to be used. Clean up substitute_libpath_macro() code.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/preproc/Makefile15
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c19
-rw-r--r--src/interfaces/libpq/Makefile10
3 files changed, 31 insertions, 13 deletions
diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile
index d57fffb7881..51f5e4c9f1f 100644
--- a/src/interfaces/ecpg/preproc/Makefile
+++ b/src/interfaces/ecpg/preproc/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.103 2004/04/30 04:14:06 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.104 2004/05/17 14:35:34 momjian Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
@@ -11,8 +11,6 @@ PATCHLEVEL=0
override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
-DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
- -DINCLUDEDIR=\"$(includedir)\" \
- -DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
-DFRONTEND
ifeq ($(GCC), yes)
@@ -20,15 +18,18 @@ override CFLAGS += -Wno-error
endif
override CFLAGS += $(PTHREAD_CFLAGS)
-OBJS=preproc.o type.o ecpg.o ecpg_keywords.o output.o\
- keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o
-
+OBJS= preproc.o type.o ecpg.o ecpg_keywords.o output.o\
+ keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
+ $(filter exec.o, $(LIBOBJS))
all: submake-libpgport ecpg
ecpg: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
+exec.c: % : $(top_srcdir)/src/port/%
+ rm -f $@ && $(LN_S) $< .
+
# pgc is compiled as part of preproc
preproc.o: $(srcdir)/pgc.c
@@ -65,7 +66,7 @@ uninstall:
rm -f $(DESTDIR)$(bindir)/ecpg$(X)
clean distclean:
- rm -f *.o ecpg$(X)
+ rm -f *.o ecpg$(X) exec.c
# garbage from partial builds
@rm -f y.tab.c y.tab.h
# garbage from development
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 40edf0ecc43..fb2f14a20f0 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.86 2004/05/12 13:38:48 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.87 2004/05/17 14:35:34 momjian Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -120,7 +120,9 @@ main(int argc, char *const argv[])
out_option = 0;
struct _include_path *ip;
const char *progname;
-
+ char my_exec_path[MAXPGPATH];
+ char include_path[MAXPGPATH];
+
progname = get_progname(argv[0]);
if (argc > 1)
@@ -138,6 +140,8 @@ main(int argc, char *const argv[])
}
}
+ find_my_exec(argv[0], my_exec_path);
+
while ((c = getopt(argc, argv, "vcio:I:tD:dC:r:h")) != -1)
{
switch (c)
@@ -175,12 +179,18 @@ main(int argc, char *const argv[])
case 'C':
if (strncmp(optarg, "INFORMIX", strlen("INFORMIX")) == 0)
{
+ char pkginclude_path[MAXPGPATH];
+ char informix_path[MAXPGPATH];
+
compat = (strcmp(optarg, "INFORMIX") == 0) ? ECPG_COMPAT_INFORMIX : ECPG_COMPAT_INFORMIX_SE;
/* system_includes = true; */
add_preprocessor_define("dec_t=decimal");
add_preprocessor_define("intrvl_t=interval");
add_preprocessor_define("dtime_t=timestamp");
- add_include_path(PKGINCLUDEDIR "/informix/esql");
+
+ get_pkginclude_path(my_exec_path, pkginclude_path);
+ snprintf(informix_path, MAXPGPATH, "%s/informix/esql", pkginclude_path);
+ add_include_path(informix_path);
}
else
{
@@ -216,7 +226,8 @@ main(int argc, char *const argv[])
add_include_path(".");
add_include_path("/usr/local/include");
- add_include_path(INCLUDEDIR);
+ get_include_path(my_exec_path, include_path);
+ add_include_path(include_path);
add_include_path("/usr/include");
if (verbose)
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 619646b405b..3537981abca 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.105 2004/05/10 23:09:04 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.106 2004/05/17 14:35:34 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -19,7 +19,13 @@ SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 2
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) $(PTHREAD_CFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"'
-override CFLAGS += $(PTHREAD_CFLAGS)
+override CFLAGS += $(PTHREAD_CFLAGS) \
+ -DPGBINDIR=\"$(bindir)\" \
+ -DPGDATADIR=\"$(datadir)\" \
+ -DSYSCONFDIR='"$(sysconfdir)"' \
+ -DINCLUDEDIR=\"$(includedir)\" \
+ -DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
+ -DPKGLIBDIR=\"$(pkglibdir)\"
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \