diff options
author | Ralph Giles <ralph.giles@artifex.com> | 2003-04-16 13:54:17 +0000 |
---|---|---|
committer | Ralph Giles <ralph.giles@artifex.com> | 2003-04-16 13:54:17 +0000 |
commit | d7f1a444c1d49acb70bf61ab243cbfd5dd9c48b6 (patch) | |
tree | 05e0b345789cdc6ad36345d91bc1c41df5ff3812 | |
parent | e5042819195662a14da979c0f0f72b8f3be6fe31 (diff) | |
download | ghostpdl-d7f1a444c1d49acb70bf61ab243cbfd5dd9c48b6.tar.gz |
Test the optimization compiler flag '-O2' before using it since some vendor
compilers have different syntax.
DETAILS:
This is really just a quick fix; it doesn't check flags for the debug or profile
builds. A full solution would also try known options based on the compiler
being used. It's not fair to just disable optimization if -O2 doesn't work.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3833 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r-- | gs/src/Makefile.in | 4 | ||||
-rw-r--r-- | gs/src/configure.ac | 17 |
2 files changed, 16 insertions, 5 deletions
diff --git a/gs/src/Makefile.in b/gs/src/Makefile.in index a14e58293..e68ba7098 100644 --- a/gs/src/Makefile.in +++ b/gs/src/Makefile.in @@ -201,9 +201,9 @@ GCFLAGS=@GCFLAGS@ # Define the added flags for standard, debugging, profiling # and shared object builds. -CFLAGS_STANDARD=-O2 +CFLAGS_STANDARD=@OPT_CFLAGS@ CFLAGS_DEBUG=-g -O -CFLAGS_PROFILE=-pg -O2 +CFLAGS_PROFILE=-pg @OPT_CFLAGS@ CFLAGS_SO=-fPIC # Define the other compilation flags. Add at most one of the following: diff --git a/gs/src/configure.ac b/gs/src/configure.ac index e26f53932..9535c3acf 100644 --- a/gs/src/configure.ac +++ b/gs/src/configure.ac @@ -27,16 +27,26 @@ dnl -------------------------------------------------- #AC_CANONICAL_HOST if test $ac_cv_prog_gcc = yes; then -cflags_to_try="-Wall -Wstrict-prototypes -Wmissing-declarations \ --Wmissing-prototypes -Wcast-qual -Wwrite-strings \ + cflags_to_try="-Wall -Wstrict-prototypes \ +-Wmissing-declarations -Wmissing-prototypes \ +-Wcast-qual -Wwrite-strings \ -fno-builtin -fno-common" else - cflags_to_try= + cflags_to_try= fi +optflags_to_try="-O2" AC_MSG_CHECKING([supported compiler flags]) old_cflags=$CFLAGS echo +for flag in $optflags_to_try; do + CFLAGS="$CFLAGS $flag" + AC_TRY_COMPILE(, [return 0;], [ + echo " $flag" + OPT_CFLAGS="$OPT_CFLAGS $flag" + ]) + CFLAGS=$old_cflags +done for flag in $cflags_to_try; do CFLAGS="$CFLAGS $flag" AC_TRY_COMPILE(, [return 0;], [ @@ -284,5 +294,6 @@ dnl -------------------------------------------------- dnl Do substitutions dnl -------------------------------------------------- +AC_SUBST(OPT_CFLAGS) AC_SUBST(GCFLAGS) AC_OUTPUT(Makefile) |