File 0001-Use-pkg-config-instead-of-pg_config.patch of Package octave-forge-database
From 6f9e81a056dcc43abc52169b43dc2d5e892f76b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 15 Mar 2019 21:22:09 +0100
Subject: [PATCH] Use pkg-config instead of pg_config
---
src/Makefile.in | 10 +++++-----
src/configure | 41 +----------------------------------------
src/configure.ac | 6 +-----
3 files changed, 7 insertions(+), 50 deletions(-)
Index: database-2.4.4/src/Makefile.in
===================================================================
--- database-2.4.4.orig/src/Makefile.in
+++ database-2.4.4/src/Makefile.in
@@ -39,7 +39,7 @@ endif
ifndef OCT_LINK_OPTS
OCT_LINK_OPTS := $(shell $(MKOCTFILE) -p OCT_LINK_OPTS)
endif
-OCT_LINK_OPTS := $(OCT_LINK_OPTS) -L$(shell $(PG_CONFIG) --libdir)
+OCT_LINK_OPTS := $(OCT_LINK_OPTS) $(shell pkg-config libpq --libs-only-L)
#
CANONICAL_HOST_TYPE := $(shell $(OCTAVE_CONFIG) -p CANONICAL_HOST_TYPE))
@@ -82,11 +82,11 @@ pq_interface.oct: $(IFOBJECTS)
$(MKOCTFILE) $< error-helpers.o
converters.o: converters.cc converters.h wrap_endian.h config.h error-helpers.h
- CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) -I`$(PG_CONFIG) --includedir` -c converters.cc
+ CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) `pkg-config libpq --cflags-only-I` -c converters.cc
converters_arr_comp.o: converters_arr_comp.cc converters.h wrap_endian.h \
pq_connection.h command.h config.h error-helpers.h
- CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) -I`$(PG_CONFIG) --includedir` -c converters_arr_comp.cc
+ CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) `pkg-config libpq --cflags-only-I` -c converters_arr_comp.cc
error-helpers.o: error-helpers.cc error-helpers.h config.h
CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) -c error-helpers.cc
@@ -96,7 +96,7 @@ pkglock.o: pkglock.cc
# be on the safe side with respect to include files
%.o: %.cc converters.h pq_connection.h command.h config.h error-helpers.h
- CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) -I`$(PG_CONFIG) --includedir` -c $<
+ CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) `pkg-config libpq --cflags-only-I` -c $<
doc: $(INFOFILE)
@@ -136,7 +136,7 @@ RDEFUNX_DLD := DEFUNX_DLD_REPLACEMENT_FO
%.bin: %.cc
if grep -q $(RDEFUN_DLD) $<; then echo "The string '$(RDEFUN_DLD)' must not be present in source code, but is in $<."; exit 1; fi
if grep -q $(RDEFUNX_DLD) $<; then echo "The string '$(RDEFUNX_DLD)' must not be present in source code, but is in $<."; exit 1; fi
- (echo "#include <stdio.h>"; echo "int main () {"; sed -e s/DEFUN_DLD/$(RDEFUN_DLD)/g -e s/DEFUNX_DLD/$(RDEFUNX_DLD)/g $< | $(CXXCPP) `$(MKOCTFILE) -p INCFLAGS` -I`$(PG_CONFIG) --includedir` -x c++ -iquote '.' -D'$(RDEFUN_DLD)(name,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' -D'$(RDEFUNX_DLD)(name,fname,gname,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' - | sed -e '/.*$(RDEFUN_DLD)/!D'; echo "}";) | $(CXX) -x c++ -D'$(RDEFUN_DLD)(name,doc)=printf("%c" #name "\n@c " #name " $<\n" doc "\n\n", 0x1D);' -o $@ -
+ (echo "#include <stdio.h>"; echo "int main () {"; sed -e s/DEFUN_DLD/$(RDEFUN_DLD)/g -e s/DEFUNX_DLD/$(RDEFUNX_DLD)/g $< | $(CXXCPP) `$(MKOCTFILE) -p INCFLAGS` `pkg-config libpq --cflags-only-I` -x c++ -iquote '.' -D'$(RDEFUN_DLD)(name,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' -D'$(RDEFUNX_DLD)(name,fname,gname,args,nargout,doc)=$(RDEFUN_DLD)(name,doc)' - | sed -e '/.*$(RDEFUN_DLD)/!D'; echo "}";) | $(CXX) -x c++ -D'$(RDEFUN_DLD)(name,doc)=printf("%c" #name "\n@c " #name " $<\n" doc "\n\n", 0x1D);' -o $@ -
clean:
$(RM) *.o octave-core *.oct *.cc.docstrings MFDOCSTRINGS *~
Index: database-2.4.4/src/configure
===================================================================
--- database-2.4.4.orig/src/configure
+++ database-2.4.4/src/configure
@@ -2216,46 +2216,7 @@ fi
if test -z "$OCTAVE_CONFIG"; then
as_fn_error 1 "octave-config not found" "$LINENO" 5;
fi
-# Extract the first word of "pg_config", so it can be a program name with args.
-set dummy pg_config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$PG_CONFIG"; then
- ac_cv_prog_PG_CONFIG="$PG_CONFIG" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_PG_CONFIG="pg_config"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-PG_CONFIG=$ac_cv_prog_PG_CONFIG
-if test -n "$PG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PG_CONFIG" >&5
-$as_echo "$PG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-if test -z "$PG_CONFIG"; then
-as_fn_error 1 "pg_config not found" "$LINENO" 5;
-fi
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -3649,13 +3610,13 @@ fi
# Check for PostgreSQL version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether PostgreSQL version >= 8.3" >&5
$as_echo_n "checking whether PostgreSQL version >= 8.3... " >&6; }
-if `$PG_CONFIG --version | awk 'NR==1 { print $(NF); };' | awk -F '.' ' { if ( $1 > 8 || $1 == 8 && $2 >= 3 ) exit 1; else exit 0}'`; then
+if `pkg-config --atleast-version 8.3 libpq`; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error 1 "package \"database\" does not work with PostgreSQL version < 8.3" "$LINENO" 5;
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
fi
# Start of checks for Octave features, preparations for checks.
Index: database-2.4.4/src/configure.ac
===================================================================
--- database-2.4.4.orig/src/configure.ac
+++ database-2.4.4/src/configure.ac
@@ -37,10 +37,6 @@ AC_CHECK_PROG(OCTAVE_CONFIG, octave-conf
if test -z "$OCTAVE_CONFIG"; then
AC_MSG_ERROR([octave-config not found], 1);
fi
-AC_CHECK_PROG(PG_CONFIG, pg_config, pg_config)
-if test -z "$PG_CONFIG"; then
-AC_MSG_ERROR([pg_config not found], 1);
-fi
AC_PROG_AWK
if test -z "$ac_cv_prog_AWK"; then
AC_MSG_ERROR([AWK not found], 1);
@@ -66,11 +62,11 @@ AC_FUNC_ERROR_AT_LINE
# Check for PostgreSQL version.
AC_MSG_CHECKING([whether PostgreSQL version >= 8.3])
-if `$PG_CONFIG --version | awk 'NR==1 { print $(NF); };' | awk -F '.' ' { if ( $1 > 8 || $1 == 8 && $2 >= 3 ) exit 1; else exit 0}'`; then
+if `pkg-config --atleast-version 8.3 libpq`; then
+ AC_MSG_RESULT(yes)
+else
AC_MSG_RESULT(no)
AC_MSG_ERROR([package "database" does not work with PostgreSQL version < 8.3], 1);
-else
- AC_MSG_RESULT(yes)
fi
# Start of checks for Octave features, preparations for checks.