summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-01 06:56:39 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-01 06:56:39 +0000
commitcc07f8cfe73f56fce1ddda4ea25d7b0b6c4f0ae9 (patch)
tree3b6ad7906b3c93f8f67bde17ee02d7416a333982 /src/bin
parent7510ac6203bc8e3c56eae95466feaeebfc1b4f31 (diff)
downloadpostgresql-cc07f8cfe73f56fce1ddda4ea25d7b0b6c4f0ae9.tar.gz
Create a C version of pg_config.
Andrew Dunstan
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_config/Makefile30
-rw-r--r--src/bin/pg_config/pg_config.sh83
2 files changed, 14 insertions, 99 deletions
diff --git a/src/bin/pg_config/Makefile b/src/bin/pg_config/Makefile
index 8fa0f94a7e..472a32d007 100644
--- a/src/bin/pg_config/Makefile
+++ b/src/bin/pg_config/Makefile
@@ -1,26 +1,24 @@
-# $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.7 2004/07/30 12:26:40 petere Exp $
+# $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.8 2004/08/01 06:56:38 momjian Exp $
subdir = src/bin/pg_config
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-all: pg_config
+OBJS= pg_config.o exec.o
-pg_config: pg_config.sh $(top_builddir)/src/Makefile.global Makefile
- sed -e 's,@bindir@,$(bindir),g' \
- -e 's,@includedir@,$(includedir),g' \
- -e 's,@includedir_server@,$(includedir_server),g' \
- -e 's,@libdir@,$(libdir),g' \
- -e 's,@pkglibdir@,$(pkglibdir),g' \
- -e 's,@pgxsdir@,$(pgxsdir),g' \
- -e "s|@configure@|$(configure_args)|g" \
- -e 's,@version@,$(VERSION),g' \
- $< >$@
- chmod a+x $@
+override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -DVAL_CONFIGURE="\"$(configure_args)\"" $(CPPFLAGS)
-install: all installdirs
- $(INSTALL_SCRIPT) pg_config $(DESTDIR)$(bindir)/pg_config
+all: submake-libpgport pg_config
+
+exec.c: % : $(top_srcdir)/src/port/%
+ rm -f $@ && $(LN_S) $< .
+pg_config: $(OBJS)
+ $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
+
+install: all installdirs
+ $(INSTALL_SCRIPT) pg_config$(X) $(DESTDIR)$(bindir)/pg_config$(X)
+
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -28,4 +26,4 @@ uninstall:
rm -f $(DESTDIR)$(bindir)/pg_config
clean distclean maintainer-clean:
- rm -f pg_config
+ rm -f pg_config$(X) $(OBJS) exec.c
diff --git a/src/bin/pg_config/pg_config.sh b/src/bin/pg_config/pg_config.sh
deleted file mode 100644
index 673462d2af..0000000000
--- a/src/bin/pg_config/pg_config.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#! /bin/sh
-
-# This shell script saves various pieces of information about the
-# installed version of PostgreSQL. Packages that interface to
-# PostgreSQL can use it to configure their build.
-#
-# Author: Peter Eisentraut <peter_e@gmx.net>
-# Public domain
-
-# $PostgreSQL: pgsql/src/bin/pg_config/pg_config.sh,v 1.10 2004/07/30 12:26:40 petere Exp $
-
-me=`basename $0`
-
-# stored configuration values
-val_bindir='@bindir@'
-val_includedir='@includedir@'
-val_includedir_server='@includedir_server@'
-val_libdir='@libdir@'
-val_pkglibdir='@pkglibdir@'
-val_pgxsdir='@pgxsdir@'
-val_configure="@configure@"
-val_version='@version@'
-
-help="\
-$me provides information about the installed version of PostgreSQL.
-
-Usage:
- $me OPTION...
-
-Options:
- --bindir show location of user executables
- --includedir show location of C header files of the client
- interfaces
- --includedir-server show location of C header files for the server
- --libdir show location of object code libraries
- --pkglibdir show location of dynamically loadable modules
- --pgxs show location of extension makefile
- --configure show options given to 'configure' script when
- PostgreSQL was built
- --version show the PostgreSQL version, then exit
- --help show this help, then exit
-
-Report bugs to <pgsql-bugs@postgresql.org>."
-
-advice="\
-Try \"$me --help\" for more information."
-
-if test "$#" -eq 0 ; then
- echo "$me: argument required" 1>&2
- echo "$advice" 1>&2
- exit 1
-fi
-
-show=
-
-for opt
-do
- case "$opt" in
- --bindir) show="$show \$val_bindir";;
- --includedir) show="$show \$val_includedir";;
- --includedir-server)
- show="$show \$val_includedir_server";;
- --libdir) show="$show \$val_libdir";;
- --pkglibdir) show="$show \$val_pkglibdir";;
- --pgxs) show="$show \$val_pgxsdir/src/makefiles/pgxs.mk";;
- --configure) show="$show \$val_configure";;
-
- --version) echo "PostgreSQL $val_version"
- exit 0;;
- --help|-\?) echo "$help"
- exit 0;;
- *) echo "$me: invalid argument: $opt" 1>&2
- echo "$advice" 1>&2
- exit 1;;
- esac
-done
-
-for thing in $show
-do
- eval "echo $thing"
-done
-
-# end of pg_config