Re: libpq++ build problems - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: libpq++ build problems
Date
Msg-id 200207072027.g67KRD003119@candle.pha.pa.us
Whole thread Raw
In response to Re: libpq++ build problems  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Good idea.  Patch attached.  autoconf run.

---------------------------------------------------------------------------

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Looking at configure.in, it looks pretty safe:
>
> >   if test "$ac_env_CXXFLAGS" != set; then
> >     if test "$GXX" = yes; then
> >       CXXFLAGS=-O2
> >     else
> >       case $template in
> >         osf)            CXXFLAGS='-O4 -Olimit 2000' ;;
> >         unixware)       CXXFLAGS='-O' ;;
> >         *)              CXXFLAGS= ;;
> >       esac
> >     fi
> >   fi
>
> > Because CXXFLAGS is already set for freebsd/alpha, it falls through,
>
> I don't think so; the ac_env_ flag presumably indicates whether
> configure inherited CXXFLAGS from its environment, not whether it
> set it internally.
>
> But even if setting CXXFLAGS in the template did override this code,
> it would be a mistake, because the point of this code is to allow a
> choice between g++-specific and vendor's-compiler-specific CXXFLAGS.
>
> Perhaps we could do something like this:
>
>     # set defaults for most platforms
>     GCC_CXXFLAGS="-O2"
>     VENDOR_CXXFLAGS=
>
>     # now include template, which may override either of the above
>
>     # now select proper CXXFLAGS
>     if test "$ac_env_CXXFLAGS" != set; then
>         if test "$GXX" = yes; then
>           CXXFLAGS="$GCC_CXXFLAGS"
>         else
>           CXXFLAGS="$VENDOR_CXXFLAGS"
>         fi
>     fi
>
> This would allow us to push the special cases for osf and unixware out
> into their template files, which would be a Good Thing.
>
>             regards, tom lane
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.186
diff -c -r1.186 configure.in
*** configure.in    28 May 2002 16:57:53 -0000    1.186
--- configure.in    7 Jul 2002 20:05:54 -0000
***************
*** 243,248 ****
--- 243,252 ----
  # variable.
  PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])

+ # Set here so it can be over-ridden in the template file
+ GCC_CXXFLAGS="-O2"
+ VENDOR_CXXFLAGS=""
+
  case $template in
    aix) pgac_cc_list="gcc xlc";;
   irix) pgac_cc_list="cc";; # no gcc
***************
*** 593,605 ****
    AC_PROG_CXX
    if test "$ac_env_CXXFLAGS" != set; then
      if test "$GXX" = yes; then
!       CXXFLAGS=-O2
      else
!       case $template in
!     osf)        CXXFLAGS='-O4 -Olimit 2000' ;;
!         unixware)    CXXFLAGS='-O' ;;
!     *)        CXXFLAGS= ;;
!       esac
      fi
    fi
    if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
--- 597,605 ----
    AC_PROG_CXX
    if test "$ac_env_CXXFLAGS" != set; then
      if test "$GXX" = yes; then
!       CXXFLAGS="$GCC_CXXFLAGS"
      else
!       CXXFLAGS="$VENDOR_CXXFLAGS"
      fi
    fi
    if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
Index: src/template/freebsd
===================================================================
RCS file: /cvsroot/pgsql/src/template/freebsd,v
retrieving revision 1.12
diff -c -r1.12 freebsd
*** src/template/freebsd    7 Jul 2002 14:24:13 -0000    1.12
--- src/template/freebsd    7 Jul 2002 20:05:57 -0000
***************
*** 2,6 ****

  case $host_cpu in
    alpha*)   CFLAGS="$CFLAGS -O";;
!             CXXFLAGS="$CXXFLAGS -O"
  esac
--- 2,6 ----

  case $host_cpu in
    alpha*)   CFLAGS="$CFLAGS -O";;
!             GCC_CXXFLAGS="-O"
  esac
Index: src/template/osf
===================================================================
RCS file: /cvsroot/pgsql/src/template/osf,v
retrieving revision 1.3
diff -c -r1.3 osf
*** src/template/osf    31 Oct 2000 18:16:20 -0000    1.3
--- src/template/osf    7 Jul 2002 20:05:57 -0000
***************
*** 6,8 ****
--- 6,10 ----
    CFLAGS='-O4 -Olimit 2000'
    CCC=cxx
  fi
+ VENDOR_CXXFLAGS='-O4 -Olimit 2000'
+
Index: src/template/unixware
===================================================================
RCS file: /cvsroot/pgsql/src/template/unixware,v
retrieving revision 1.9
diff -c -r1.9 unixware
*** src/template/unixware    22 Oct 2000 22:15:09 -0000    1.9
--- src/template/unixware    7 Jul 2002 20:05:57 -0000
***************
*** 3,5 ****
--- 3,7 ----
  else
    CFLAGS='-O -K inline'
  fi
+ VENDOR_CXXFLAGS="-O"
+

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Most system catalog columns should be NOT NULL
Next
From: Peter Eisentraut
Date:
Subject: Re: Proposal: CREATE CONVERSION