Patch - Solving compilation problem for Sun studio compiler
Patch - Solving compilation problem for Sun studio compiler
От:
Dhanaraj M <Dhanaraj.M@Sun.COM>
Дата:
Hi Dave
I have a Sun Studio patch which solves the -Wall problem during the
compilation.
I am not sure whether this is the right way of making the changes.
Please comment on this so that I will make necessary changes and re-submit.
PS: I will also discuss with Zdenek, who is on vacation.
*** configure.ac.orig Thu Jan 4 10:07:55 2007
--- configure.ac Thu Jan 4 10:15:07 2007
***************
*** 24,29 ****
--- 24,34 ----
AC_TYPE_SIZE_T
AC_HEADER_TIME
+ $CXX -V 2>test.txt
+ SUNCOMPILER=`awk '{if ( $2 == "Sun" ) { print "yes" } else {print "no"} }' test.txt`
+ rm -rf test.txt
+ AM_CONDITIONAL([SUN_COMPILER], [test x$SUNCOMPILER = xyes])
+
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([gethostbyname inet_ntoa memmove memset strchr])
*** src/Makefile.am.orig Thu Jan 4 10:15:49 2007
--- src/Makefile.am Thu Jan 4 10:18:21 2007
***************
*** 40,51 ****
include $(srcdir)/ui/module.mk
include $(srcdir)/utils/module.mk
if !APPBUNDLE
nobase_dist_pkgdata_DATA = $(TMP_ui)
! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
# Automake trys to execute install-exec-hook if it appears anywhere in the file, so we need a dummy
# for non-APPBUNDLE cases.
--- 40,59 ----
include $(srcdir)/ui/module.mk
include $(srcdir)/utils/module.mk
+ if !SUN_COMPILER
+ COMPILE_OPTION1=-Wall
+ COMPILE_OPTION2=-Wno-non-virtual-dtor
+ else
+ COMPILE_OPTION1=""
+ COMPILE_OPTION2=""
+ endif
+
if !APPBUNDLE
nobase_dist_pkgdata_DATA = $(TMP_ui)
! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
# Automake trys to execute install-exec-hook if it appears anywhere in the file, so we need a dummy
# for non-APPBUNDLE cases.
***************
*** 54,62 ****
else
nobase_dist_data_DATA = $(TMP_ui)
! AM_CXXFLAGS = -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CPPFLAGS = -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CFLAGS = -Wall -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
install-exec-hook:
cd $(bindir) ;\
--- 62,70 ----
else
nobase_dist_data_DATA = $(TMP_ui)
! AM_CXXFLAGS = $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CPPFLAGS = $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
! AM_CFLAGS = $(COMPILE_OPTION1) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include
install-exec-hook:
cd $(bindir) ;\
*** xtra/pgagent/Makefile.am.orig Thu Jan 4 11:20:38 2007
--- xtra/pgagent/Makefile.am Thu Jan 4 11:19:52 2007
***************
*** 30,40 ****
$(srcdir)/include/misc.h \
$(srcdir)/include/pgAgent.h
if !APPBUNDLE
! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(srcdir)/include
! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(srcdir)/include
! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -I$(srcdir)/include
install-data-local:
$(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql
--- 30,48 ----
$(srcdir)/include/misc.h \
$(srcdir)/include/pgAgent.h
+ if !SUN_COMPILER
+ COMPILE_OPTION1=-Wall
+ COMPILE_OPTION2=-Wno-non-virtual-dtor
+ else
+ COMPILE_OPTION1=""
+ COMPILE_OPTION2=""
+ endif
+
if !APPBUNDLE
! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(srcdir)/include
! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) $(COMPILE_OPTION2) -I$(srcdir)/include
! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(COMPILE_OPTION1) -I$(srcdir)/include
install-data-local:
$(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql
Re: Patch - Solving compilation problem for Sun studio compiler
От:
Dave Page <dpage@postgresql.org>
Дата:
Dhanaraj M wrote: > Hi Dave > > I have a Sun Studio patch which solves the -Wall problem during the > compilation. > I am not sure whether this is the right way of making the changes. > Please comment on this so that I will make necessary changes and re-submit. > > PS: I will also discuss with Zdenek, who is on vacation. Hi Dhanaraj The patch looks OK in theory (I haven't actually tested it yet), though I would prefer to see the compiler test as a macro in acinclude.m4 Thanks, Dave.
Re: Patch - Solving compilation problem for Sun studio compiler
От:
Dhanaraj M <Dhanaraj.M@Sun.COM>
Дата:
>>I have a Sun Studio patch which solves the -Wall problem during the >>compilation. >>I am not sure whether this is the right way of making the changes. >>Please comment on this so that I will make necessary changes and re-submit. >> >> >The patch looks OK in theory (I haven't actually tested it yet), though >I would prefer to see the compiler test as a macro in acinclude.m4 > > Hi Dave, As suggested, I have made some changed. I discussed with Zdenek also. I have a new patch now. I tested on Solaris- gcc and sun studio compilers. This works correctly. Please test this patch. Thanks Dhanaraj *** pgadmin3-1.6.2/acinclude.m4 Sun Jan 7 15:15:44 2007 --- pgadmin3-1.6.2.new/acinclude.m4 Wed Jan 10 17:43:16 2007 *************** *** 20,25 **** --- 20,47 ---- fi ]) + ################################# + # Check this is SUN compiler # + ################################# + + AC_DEFUN([CHECK_SUN_COMPILER], + [ + $CC -V 2>test.txt + SUN_STR=`head -1 test.txt |cut -f2 -d" "` + rm -rf test.txt + if test "$SUN_STR" = "Sun"; then + SUN_CC_COMPILER=yes + fi + + $CXX -V 2>test.txt + SUN_STR=`head -1 test.txt |cut -f2 -d" "` + rm -rf test.txt + if test "$SUN_STR" = "Sun"; then + SUN_CXX_COMPILER=yes + fi + + ]) + ############################# # Override wxWidgets version # ############################# *** pgadmin3-1.6.2/configure.ac Sun Jan 7 15:15:53 2007 --- pgadmin3-1.6.2.new/configure.ac Wed Jan 10 12:35:57 2007 *************** *** 13,18 **** --- 13,21 ---- AC_PROG_CC AC_PROG_CXX CHECK_CPP_COMPILER + CHECK_SUN_COMPILER + AM_CONDITIONAL([SUN_CC], [test x$SUN_CC_COMPILER = xyes]) + AM_CONDITIONAL([SUN_CXX], [test x$SUN_CXX_COMPILER = xyes]) # Checks for header files. AC_HEADER_STDC *** pgadmin3-1.6.2/src/Makefile.am Sun Jan 7 15:15:38 2007 --- pgadmin3-1.6.2.new/src/Makefile.am Wed Jan 10 12:41:21 2007 *************** *** 40,51 **** include $(srcdir)/ui/module.mk include $(srcdir)/utils/module.mk if !APPBUNDLE nobase_dist_pkgdata_DATA = $(TMP_ui) ! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include # Automake trys to execute install-exec-hook if it appears anywhere in the file, so we need a dummy # for non-APPBUNDLE cases. --- 40,63 ---- include $(srcdir)/ui/module.mk include $(srcdir)/utils/module.mk + if !SUN_CC + __CFLAGS=-Wall + else + __CFLAGS="" + endif + + if !SUN_CXX + __CXXFLAGS=-Wall -Wno-non-virtual-dtor + else + __CXXFLAGS="" + endif + if !APPBUNDLE nobase_dist_pkgdata_DATA = $(TMP_ui) ! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CXXFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CXXFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include # Automake trys to execute install-exec-hook if it appears anywhere in the file, so we need a dummy # for non-APPBUNDLE cases. *************** *** 54,62 **** else nobase_dist_data_DATA = $(TMP_ui) ! AM_CXXFLAGS = -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CPPFLAGS = -Wall -Wno-non-virtual-dtor -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CFLAGS = -Wall -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include install-exec-hook: cd $(bindir) ;\ --- 66,74 ---- else nobase_dist_data_DATA = $(TMP_ui) ! AM_CXXFLAGS = $(__CXXFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CPPFLAGS = $(__CXXFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include ! AM_CFLAGS = $(__CFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/agent/include -I$(top_srcdir)/src/slony/include install-exec-hook: cd $(bindir) ;\ *** pgadmin3-1.6.2/xtra/pgagent/Makefile.am Sun Jan 7 15:15:44 2007 --- pgadmin3-1.6.2.new/xtra/pgagent/Makefile.am Sat Jan 13 11:38:40 2007 *************** *** 30,40 **** $(srcdir)/include/misc.h \ $(srcdir)/include/pgAgent.h if !APPBUNDLE ! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(srcdir)/include ! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(srcdir)/include ! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -I$(srcdir)/include install-data-local: $(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql --- 30,52 ---- $(srcdir)/include/misc.h \ $(srcdir)/include/pgAgent.h + if !SUN_CC + __CFLAGS=-Wall + else + __CFLAGS="" + endif + + if !SUN_CXX + __CXXFLAGS=-Wall -Wno-non-virtual-dtor + else + __CXXFLAGS="" + endif + if !APPBUNDLE ! AM_CXXFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CXXFLAGS) -I$(srcdir)/include ! AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CXXFLAGS) -I$(srcdir)/include ! AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" $(__CFLAGS) -I$(srcdir)/include install-data-local: $(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql
Re: Patch - Solving compilation problem for Sun
От:
Kris Jurka <books@ejurka.com>
Дата:
On Sat, 13 Jan 2007, Dhanaraj M wrote: >> The patch looks OK in theory (I haven't actually tested it yet), though >> I would prefer to see the compiler test as a macro in acinclude.m4 >> The assembly of CXXFLAGS seems backwards. Instead of making g++ specific flags the default and requiring a special case for each compiler that doesn't support them, it should only add them if being compiled with g++. Kris Jurka