Tom Lane wrote:
> Neil Conway <[EMAIL PROTECTED]> writes:
> > On Wed, 2003-10-08 at 14:31, Bruce Momjian wrote:
> >> Well, this is really embarassing. I can't imagine why we would not set
> >> at least -O on all platforms.
>
> I believe that autoconf will automatically select -O2 (when CFLAGS isn't
> already set) *if* it's chosen gcc. It won't select anything for vendor
> ccs.
>
> > Can we get these optimizations enabled in time for the next 7.4 beta?
>
> I think it's too late in the beta cycle to add optimization flags except
> for platforms we can get specific success results for. (Solaris is
> probably okay for instance.) The risk of breaking things seems too
> high.
OK, patch attached and applied. It centralizes the optimization
defaults into configure.in, rather than having CFLAGS= in the template
files.
It used -O2 for gcc (generated automatically by autoconf), and -O for
non-gcc, unless the template overrides it.
--
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.302
diff -c -c -r1.302 configure
*** configure 3 Oct 2003 03:08:14 -0000 1.302
--- configure 9 Oct 2003 03:16:44 -0000
***************
*** 2393,2398 ****
--- 2393,2402 ----
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
fi
+ # configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc
+ if test x"$CFLAGS" = x""; then
+ CFLAGS="-O"
+ fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.293
diff -c -c -r1.293 configure.in
*** configure.in 3 Oct 2003 03:08:14 -0000 1.293
--- configure.in 9 Oct 2003 03:16:46 -0000
***************
*** 238,243 ****
--- 238,247 ----
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
fi
+ # configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc
+ if test x"$CFLAGS" = x""; then
+ CFLAGS="-O"
+ fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi
Index: src/template/beos
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/beos,v
retrieving revision 1.6
diff -c -c -r1.6 beos
*** src/template/beos 21 Oct 2000 22:36:13 -0000 1.6
--- src/template/beos 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS='-O2'
--- 0 ----
Index: src/template/bsdi
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/bsdi,v
retrieving revision 1.16
diff -c -c -r1.16 bsdi
*** src/template/bsdi 27 Sep 2003 16:24:44 -0000 1.16
--- src/template/bsdi 9 Oct 2003 03:16:51 -0000
***************
*** 5,13 ****
esac
case $host_os in
! bsdi2.0 | bsdi2.1 | bsdi3*)
! CC=gcc2
! ;;
esac
THREAD_SUPPORT=yes
--- 5,11 ----
esac
case $host_os in
! bsdi2.0 | bsdi2.1 | bsdi3*) CC=gcc2;;
esac
THREAD_SUPPORT=yes
Index: src/template/cygwin
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/cygwin,v
retrieving revision 1.2
diff -c -c -r1.2 cygwin
*** src/template/cygwin 9 Oct 2003 02:37:09 -0000 1.2
--- src/template/cygwin 9 Oct 2003 03:16:51 -0000
***************
*** 1,2 ****
- CFLAGS='-O2'
SRCH_LIB='/usr/local/lib'
--- 1 ----
Index: src/template/dgux
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/dgux,v
retrieving revision 1.10
diff -c -c -r1.10 dgux
*** src/template/dgux 21 Oct 2000 22:36:13 -0000 1.10
--- src/template/dgux 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS=
--- 0 ----
Index: src/template/freebsd
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/freebsd,v
retrieving revision 1.23
diff -c -c -r1.23 freebsd
*** src/template/freebsd 27 Sep 2003 16:24:44 -0000 1.23
--- src/template/freebsd 9 Oct 2003 03:16:51 -0000
***************
*** 1,17 ****
- CFLAGS='-pipe'
-
case $host_cpu in
! alpha*) CFLAGS="$CFLAGS -O" ;;
esac
THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_THREAD_SAFE"
case $host_os in
! freebsd2*|freebsd3*|freebsd4*)
! THREAD_LIBS="-pthread"
! ;;
! *)
! THREAD_LIBS="-lc_r"
! ;;
esac
--- 1,11 ----
case $host_cpu in
! alpha*) CFLAGS="-O";;
esac
THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes
THREAD_CPPFLAGS="-D_THREAD_SAFE"
case $host_os in
! freebsd2*|freebsd3*|freebsd4*) THREAD_LIBS="-pthread";;
! *) THREAD_LIBS="-lc_r";;
esac
Index: src/template/hpux
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/hpux,v
retrieving revision 1.7
diff -c -c -r1.7 hpux
*** src/template/hpux 2 Apr 2003 00:49:28 -0000 1.7
--- src/template/hpux 9 Oct 2003 03:16:51 -0000
***************
*** 1,8 ****
! if test "$GCC" = yes ; then
! CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
! CFLAGS="-O2"
! else
CC="$CC -Ae"
- CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
CFLAGS="+O2"
fi
--- 1,6 ----
! CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
!
! if test "$GCC" != yes ; then
CC="$CC -Ae"
CFLAGS="+O2"
fi
Index: src/template/irix5
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/irix5,v
retrieving revision 1.9
diff -c -c -r1.9 irix5
*** src/template/irix5 21 Oct 2000 22:36:13 -0000 1.9
--- src/template/irix5 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS=
--- 0 ----
Index: src/template/linux
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/linux,v
retrieving revision 1.18
diff -c -c -r1.18 linux
*** src/template/linux 27 Sep 2003 22:23:35 -0000 1.18
--- src/template/linux 9 Oct 2003 03:16:51 -0000
***************
*** 1,4 ****
- CFLAGS=-O2
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
CPPFLAGS="-D_GNU_SOURCE"
--- 1,3 ----
***************
*** 6,9 ****
NEED_REENTRANT_FUNCS=yes # Debian kernel 2.2 2003-09-27
THREAD_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
THREAD_LIBS="-lpthread"
-
--- 5,7 ----
Index: src/template/netbsd
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/netbsd,v
retrieving revision 1.13
diff -c -c -r1.13 netbsd
*** src/template/netbsd 27 Sep 2003 16:24:44 -0000 1.13
--- src/template/netbsd 9 Oct 2003 03:16:51 -0000
***************
*** 1,4 ****
- CFLAGS='-O2 -pipe'
-
THREAD_SUPPORT=yes
NEED_REENTRANT_FUNCS=yes # 1.6 2003-09-14
--- 1,2 ----
Index: src/template/nextstep
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/nextstep,v
retrieving revision 1.7
diff -c -c -r1.7 nextstep
*** src/template/nextstep 15 Jul 2000 15:54:52 -0000 1.7
--- src/template/nextstep 9 Oct 2003 03:16:51 -0000
***************
*** 1,4 ****
AROPT=rc
- CFLAGS=
SHARED_LIB=
DLSUFFIX=.o
--- 1,3 ----
Index: src/template/openbsd
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/openbsd,v
retrieving revision 1.8
diff -c -c -r1.8 openbsd
*** src/template/openbsd 21 Oct 2000 22:36:14 -0000 1.8
--- src/template/openbsd 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS='-O2 -pipe'
--- 0 ----
Index: src/template/osf
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/osf,v
retrieving revision 1.10
diff -c -c -r1.10 osf
*** src/template/osf 27 Sep 2003 16:24:45 -0000 1.10
--- src/template/osf 9 Oct 2003 03:16:51 -0000
***************
*** 1,6 ****
! if test "$GCC" = yes ; then
! CFLAGS=
! else
CC="$CC -std"
CFLAGS='-O4 -Olimit 2000'
fi
--- 1,4 ----
! if test "$GCC" != yes ; then
CC="$CC -std"
CFLAGS='-O4 -Olimit 2000'
fi
Index: src/template/qnx4
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/qnx4,v
retrieving revision 1.4
diff -c -c -r1.4 qnx4
*** src/template/qnx4 24 May 2001 22:33:18 -0000 1.4
--- src/template/qnx4 9 Oct 2003 03:16:51 -0000
***************
*** 1,2 ****
! CFLAGS=-I/usr/local/include
! LIBS=-lunix
--- 1,2 ----
! CFLAGS="-O2 -I/usr/local/include"
! LIBS="-lunix"
Index: src/template/sco
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/sco,v
retrieving revision 1.10
diff -c -c -r1.10 sco
*** src/template/sco 11 Dec 2002 22:27:26 -0000 1.10
--- src/template/sco 9 Oct 2003 03:16:51 -0000
***************
*** 1,7 ****
- if test "$GCC" = yes; then
- CFLAGS=-O2
- else
- CFLAGS=-O
- fi
CC="$CC -b elf"
--- 1,2 ----
Index: src/template/solaris
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/solaris,v
retrieving revision 1.5
diff -c -c -r1.5 solaris
*** src/template/solaris 27 Sep 2003 16:24:45 -0000 1.5
--- src/template/solaris 9 Oct 2003 03:16:51 -0000
***************
*** 1,8 ****
! if test "$GCC" = yes ; then
! CFLAGS=
! else
CC="$CC -Xa" # relaxed ISO C mode
! CFLAGS=-v # -v is like gcc -Wall
fi
THREAD_SUPPORT=yes
--- 1,6 ----
! if test "$GCC" != yes ; then
CC="$CC -Xa" # relaxed ISO C mode
! CFLAGS="-O -v" # -v is like gcc -Wall
fi
THREAD_SUPPORT=yes
Index: src/template/sunos4
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/sunos4,v
retrieving revision 1.2
diff -c -c -r1.2 sunos4
*** src/template/sunos4 21 Oct 2000 22:36:14 -0000 1.2
--- src/template/sunos4 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS=
--- 0 ----
Index: src/template/svr4
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/svr4,v
retrieving revision 1.10
diff -c -c -r1.10 svr4
*** src/template/svr4 21 Oct 2000 22:36:14 -0000 1.10
--- src/template/svr4 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS=
--- 0 ----
Index: src/template/ultrix4
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/ultrix4,v
retrieving revision 1.10
diff -c -c -r1.10 ultrix4
*** src/template/ultrix4 21 Oct 2000 22:36:14 -0000 1.10
--- src/template/ultrix4 9 Oct 2003 03:16:51 -0000
***************
*** 1 ****
- CFLAGS=
--- 0 ----
Index: src/template/univel
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/univel,v
retrieving revision 1.13
diff -c -c -r1.13 univel
*** src/template/univel 21 Oct 2000 22:36:14 -0000 1.13
--- src/template/univel 9 Oct 2003 03:16:51 -0000
***************
*** 1,2 ****
CFLAGS='-v -O -K i486,host,inline,loop_unroll -Dsvr4'
! LIBS=-lc89
--- 1,2 ----
CFLAGS='-v -O -K i486,host,inline,loop_unroll -Dsvr4'
! LIBS="-lc89"
Index: src/template/unixware
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/unixware,v
retrieving revision 1.24
diff -c -c -r1.24 unixware
*** src/template/unixware 27 Sep 2003 16:24:45 -0000 1.24
--- src/template/unixware 9 Oct 2003 03:16:51 -0000
***************
*** 1,5 ****
if test "$GCC" = yes; then
- CFLAGS=-O2
THREAD_CPPFLAGS="-pthread"
else
# the -Kno_host is temporary for a bug in the compiler. See -hackers
--- 1,4 ----
Index: src/template/win
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/win,v
retrieving revision 1.5
diff -c -c -r1.5 win
*** src/template/win 8 Oct 2003 18:23:08 -0000 1.5
--- src/template/win 9 Oct 2003 03:16:51 -0000
***************
*** 1,3 ****
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- fi
--- 0 ----
Index: src/template/win32
===================================================================
RCS file: /cvsroot/pgsql-server/src/template/win32,v
retrieving revision 1.1
diff -c -c -r1.1 win32
*** src/template/win32 15 May 2003 16:35:30 -0000 1.1
--- src/template/win32 9 Oct 2003 03:16:51 -0000
***************
*** 1,3 ****
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- fi
--- 0 ----
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend