From 468391363b9ca2e5a39e706cfc6b8dd43e4db983 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 1 Feb 1999 19:40:25 +0000 Subject: [PATCH] Updated configure.in for proper debug and optimization handling. The new configure script now defaults to no debugging; if you use the --enable-debug option to configure, it uses "-g" for debug. The optimizer section applies the compiler warning options and optimizer options separately. If debug is requested, no -O options are added. For IRIX 6.2 and higher, and for GCC/EGCS, -O3 is used for optimization. For IRIX 5.x -O2 is used. For HP-UX +O2 is used. git-svn-id: file:///fltk/svn/fltk/trunk@261 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- configure.in | 81 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/configure.in b/configure.in index 1d39379d8..c1722f6be 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl# -*- sh -*- dnl# the "configure" script is made from this by running GNU "autoconf" dnl# -dnl# "$Id: configure.in,v 1.19 1999/01/31 07:43:08 bill Exp $" +dnl# "$Id: configure.in,v 1.20 1999/02/01 19:40:25 mike Exp $" dnl# dnl# Configuration script for the Fast Light Tool Kit (FLTK). dnl# @@ -36,11 +36,16 @@ else LIBCOMMAND="ar crs" fi -DEBUGFLAG="" +dnl# Clear debugging flags and only enable debugging if the user asks for +dns# it. -AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],if eval "test x$enable_debug = xyes"; then +DEBUGFLAG="" +CFLAGS="${CFLAGS:=}" +CXXFLAGS="${CXXFLAGS:=}" + +AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then DEBUGFLAG="-g " -fi) +fi]) AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=no]],[ if eval "test x$enable_shared = xyes"; then RANLIB=":" @@ -138,25 +143,59 @@ dnl# do this last so messing with switches does not break tests if test -n "$GXX"; then CFLAGS="-Wall $CFLAGS" CXXFLAGS="-Wall -Wno-return-type $CXXFLAGS" + if test -z "$DEBUGFLAG"; then + CFLAGS="-O3 $CFLAGS" + CXXFLAGS="-O3 $CXXFLAGS" + fi else -if test "`(uname) 2>/dev/null`" = IRIX; then - if expr "`(uname -r)`" \>= 6.2; then -dnl# Uncomment these if you don't have IDO 7.2 or higher -dnl# CXX="CC -n32" -dnl# CC="cc -n32" -dnl# LD="ld -n32" -dnl# MAKEDEPEND="CC -M" - # -woff 3322 is necessary due to errors in Xlib headers on IRIX - CFLAGS="-O2 -fullwarn $CFLAGS" - CXXFLAGS="-O2 -fullwarn -woff 1685 -woff 3322 $CXXFLAGS" - else - CXXFLAGS="+w +pp $CXXFLAGS" - fi -fi + case `(uname) 2>/dev/null` in + IRIX*) + # Running some flavor of IRIX; see which version and + # set things up according... + if expr "`(uname -r)`" \>= 6.2; then + # We are running IRIX 6.2 or higher; uncomment the following + # lines if you don't have IDO 7.2 or higher: + # + # CXX="CC -n32" + # CC="cc -n32" + # LD="ld -n32" + # MAKEDEPEND="CC -M" + + # -woff 3322 is necessary due to errors in Xlib headers on IRIX + CFLAGS="-fullwarn $CFLAGS" + CXXFLAGS="-fullwarn -woff 1685 -woff 3322 $CXXFLAGS" + if test -z "$DEBUGFLAG"; then + CFLAGS="-O3 $CFLAGS" + CXXFLAGS="-O3 $CXXFLAGS" + fi + else + CXXFLAGS="+w +pp $CXXFLAGS" + if test -z "$DEBUGFLAG"; then + CFLAGS="-O2 $CFLAGS" + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + ;; + HP-UX) + # Running HP-UX; these options should work for the HP compilers. + if test -z "$DEBUGFLAG"; then + CFLAGS="+O2 $CFLAGS" + CXXFLAGS="+O2 $CXXFLAGS" + fi + ;; + *) + # Running some other operating system; inform the user they + # should contribute the necessary options to fltk-bugs@easysw.com... + echo "Building FLTK with default compiler optimizations; contact" + echo "fltk-bugs@easysw.com with uname and compiler options needed" + echo "for your platform, or set the CFLAGS and CXXFLAGS options" + echo "before running configure." + ;; + esac fi -CFLAGS="$DEBUGFLAG$CFLAGS" -CXXFLAGS="$DEBUGFLAG$CXXFLAGS" +CFLAGS="$DEBUGFLAG $CFLAGS" +CXXFLAGS="$DEBUGFLAG $CXXFLAGS" AC_SUBST(LIBNAME) AC_SUBST(LIBCOMMAND) @@ -165,5 +204,5 @@ AC_CONFIG_HEADER(config.h:configh.in) AC_OUTPUT(makeinclude) dnl# -dnl# End of "$Id: configure.in,v 1.19 1999/01/31 07:43:08 bill Exp $". +dnl# End of "$Id: configure.in,v 1.20 1999/02/01 19:40:25 mike Exp $". dnl#