IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11888


Ignore:
Timestamp:
Feb 19, 2007, 11:05:00 AM (19 years ago)
Author:
eugene
Message:

configure cleanups:

  • moved some functions to config.tools
  • added layer in configure to catch CC="... .." options
  • interpret env CC or CC= options
  • moved ranlib setting to configure.tcsh
Location:
trunk/Ohana
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/Configure.in

    r11122 r11888  
    11# Configure file for Ohana Package
    2 #
    3 # this is the location of the package
    4 # change this to match your location of the source
     2# the values of the form @WORD@ are filled in by configure
     3
     4# location of the package and architecture
    55ROOT    = @ROOTDIR@
    66ARCH    = @ARCHVAL@
    77
    88# destination directories:
    9 # these are the installation directories.
    10 # if you use a different toplevel directory than $(ROOT), you might
    11 # need to copy the include files in $(ROOT)/include by hand to the destination
    12 # LBIN  = PREFIX/bin/$(ARCH)
    13 
    149DESTBIN  = @BINDIR@
    1510DESTINC  = @INCDIR@
     
    1813DESTDATA = @DATADIR@
    1914
    20 # prefered C compiler
    21 # CC = gcc -g -DOHANA_MEMORY -Wall -Werror
    22 CC = gcc @OPTFLAGS@
    23 INCDIRS = @INCDIRS@
    24 LIBDIRS = @LIBDIRS@
     15# C compiler options
     16CC       = @CC@
     17CFLAGS   = @CFLAGS@
     18CPPFLAGS = @CPPFLAGS@
     19LDFLAGS  = @LDFLAGS@
     20
     21# flags for external dependencies
     22INCDIRS  = @INCDIRS@
     23LIBDIRS  = @LIBDIRS@
    2524LIBFLAGS = @LIBFLAGS@
    2625
    2726# select the appropriate version of ranlib
    28 RANLIB-sid = ranlib
    29 RANLIB-sol = touch
    30 RANLIB-linux = ranlib
    31 RANLIB-lin64 = ranlib
    32 RANLIB-linrh = ranlib
    33 RANLIB = $(RANLIB-$(ARCH))
     27RANLIB = @RANLIB@
  • trunk/Ohana/Makefile.Common

    r11750 r11888  
    11# this file must be added to the makefile *after* LIB,BIN, etc are defined
    22
    3 # XXX replace BINDIR, etc with DESTBIN in Configure.in
     3# (INC)     & (LIB)     are the program's local include & lib directories
     4# (DESTINC) & (DESTLIB) are the target installation include & lib directories
     5# (INCDIRS) & (LIBDIRS) are all of the probed include & lib directories
     6# (LIBFLAGS) is the list of -lXXX directives from configure for external libs
    47
    5 CFLAGS  =       -I$(INC) -I$(DESTINC) $(INCDIRS) -D$(ARCH)
    6 LDFLAGS =       -L$(LIB) -L$(DESTLIB) $(LIBDIRS) $(LIBFLAGS)
     8BASE_CFLAGS   = $(CFLAGS)
     9BASE_CPPFLAGS = $(CPPFLAGS) -I$(INC) -I$(DESTINC) $(INCDIRS) -D$(ARCH)
     10BASE_LDFLAGS  = $(LDFLAGS) -L$(LIB) -L$(DESTLIB) $(LIBDIRS) $(LIBFLAGS)
    711
    812.PRECIOUS: %.$(ARCH).o
     
    1822
    1923%.$(ARCH).o : %.c
    20         $(CC) $(CFLAGS) -c $< -o $@
     24        $(CC) $(FULL_CFLAGS) $(FULL_CPPFLAGS) -c $< -o $@
    2125
    2226$(BIN)/%.$(ARCH):
    23         @echo "trying $*"
    2427        @if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
    25         $(CC) -o $@ $^ $(LDFLAGS)
     28        $(CC) $(FULL_CFLAGS) -o $@ $^ $(FULL_LDFLAGS)
    2629        @echo "compiled $*"
    2730        @echo ""
  • trunk/Ohana/configure

    r11341 r11888  
    11#!/bin/sh
    22
    3 ./configure.tcsh $*
     3# strip out CC, CFLAGS, CPPFLAGS, LDFLAGS and set env vars
     4while (( $# > 0 )); do
     5  skip=0
     6
     7  # strip out CC, set as env variable
     8  echo $1 | grep "^CC=" > /dev/null
     9  if (( $? == 0 )) ; then
     10    val=`echo $1 | sed "s|^CC=||"`
     11    export CC=$val
     12    skip=1
     13  fi
     14  # strip out CFLAGS, set as env variable
     15  echo $1 | grep "^CFLAGS=" > /dev/null
     16  if (( $? == 0 )) ; then
     17    val=`echo $1 | sed "s|^CFLAGS=||"`
     18    export CFLAGS=$val
     19    skip=1
     20  fi
     21  # strip out CPPFLAGS, set as env variable
     22  echo $1 | grep "^CPPFLAGS=" > /dev/null
     23  if (( $? == 0 )) ; then
     24    val=`echo $1 | sed "s|^CPPFLAGS=||"`
     25    export CPPFLAGS=$val
     26    skip=1
     27  fi
     28  # strip out LDFLAGS, set as env variable
     29  echo $1 | grep "^LDFLAGS=" > /dev/null
     30  if (( $? == 0 )) ; then
     31    val=`echo $1 | sed "s|^LDFLAGS=||"`
     32    export LDFLAGS=$val
     33    skip=1
     34  fi
     35  if (( $skip == 0 )) ; then
     36    args+=" $1"
     37  fi
     38  shift
     39done
     40
     41./configure.tcsh $args
  • trunk/Ohana/configure.tcsh

    r11753 r11888  
    1717# evaluate command-line options
    1818set vararch = 0
     19set optimize = 0
     20set pedantic = 0
     21set memcheck = 0
     22
    1923set prefix  = ""
    20 
    2124set bindir  = ""
    2225set libdir  = ""
     
    2528set datadir  = ""
    2629set sysconfdir  = ""
    27 set optflags = "-g -O0"
    28 set pedantic = ""
    2930
    3031set root    = ""
    3132set args    = ""
     33
    3234while ("$1" != "")
    33  switch ($1)
    34   case --vararch
    35    set vararch = 1
    36    breaksw;
    37   # options passed by jhbuild which we ignore
     35 switch ("$1")
     36  # options passed by jhbuild or others which we ignore
    3837  case --enable-maintainer-mode
    3938  case --no-create
    4039  case --no-recursion
     40  case --sbindir
     41  case --libexecdir
     42  case --sharedstatedir
     43  case --localstatedir
     44  case --oldincludedir
     45  case --infodir
     46   breaksw;
     47  case --vararch
     48   set vararch = 1
    4149   breaksw;
    4250  case --enable-optimize
    43    set optflags = "-O2"
     51   set optimize = 1
     52   breaksw;
     53  case --enable-memcheck
     54   set memcheck = 1
    4455   breaksw;
    4556  case --pedantic
    46    set pedantic = "-Wall -Werror"
     57   set pedantic = 1
    4758   breaksw;
    4859  case --prefix*
     
    116127end
    117128if ($#args != 1) goto usage
     129
     130# set values for CC, CFLAGS, CPPFLAGS, LDFLAGS
     131if (! $?CC) then
     132  set CC = gcc
     133endif 
     134
     135if (! $?CFLAGS) then
     136  set CFLAGS = "-g -O0"
     137endif 
     138# optimize overrides user-supplied CFLAGS
     139if ($optimize) set CFLAGS = "-O2"
     140
     141if (! $?CPPFLAGS) then
     142  set CPPFLAGS =
     143endif 
     144if ($pedantic) set CPPFLAGS = "$CPPFLAGS -Wall -Werror"
     145if ($memcheck) set CPPFLAGS = "$CPPFLAGS -DOHANA_MEMORY"
     146
     147if (! $?LDFLAGS) then
     148  set LDFLAGS =
     149endif 
    118150
    119151set syslibpath = "/lib /usr/lib /usr/X11R6/lib /usr/openwin/lib /usr/local/lib"
     
    165197set needincs = "$needincs zlib.h"
    166198
    167 # need to have options for non-ANSI includes? (ie, varargs.h)
     199# XXX need to have options for non-ANSI includes? (ie, varargs.h)
    168200# set needincs = "$needincs cfuncs.h" - from non-ANSI option in ohana.h
    169201# set needincs = "$needincs float.h" - is from missing_proto (CFHT)
     
    174206# check the hardware architecture:
    175207set sys=`uname -s`
     208set ranlib = "ranlib"
    176209switch ($sys)
    177210 case IRIX64:
     
    186219   endif
    187220   # sun (at least) seems to need the socket library (linux does not)
    188    # set needlibs = "$needlibs libsocket libnsl"
     221   set needlibs = "$needlibs libsocket libnsl"
     222   set ranlib = "touch"
    189223   breaksw;
    190224 case Linux:
     
    208242
    209243# set up the basic directory names:
    210 # XXX : this should be set based on the rules for libdir below
    211244set root = `pwd`
    212245if ($prefix == "") set prefix = $root
     
    246279    echo "$libdirs" | grep -- "-L$g " > /dev/null
    247280    if ($status) then
    248       set libdirs  = "$libdirs -L$g "
     281      set libdirs  = "$libdirs-L$g "
    249282    endif
    250283    echo "$libflags" | grep -- "-l$f " > /dev/null
    251284    if ($status) then
    252       set libflags = "$libflags -l$f "
     285      set libflags = "$libflags-l$f "
    253286    endif
    254287end
     
    274307  echo "$libdirs" | grep -- "-L$g " > /dev/null
    275308  if ($status) then
    276     set libdirs  = "$libdirs -L$g "
     309    set libdirs  = "$libdirs-L$g "
    277310  endif
    278311  echo "$libflags" | grep -- "-l$f " > /dev/null
    279312  if ($status) then
    280     set libflags = "$libflags -l$f "
     313    set libflags = "$libflags-l$f"
    281314  endif
    282315
     
    305338  echo "$incdirs" | grep -- "-I$g " > /dev/null
    306339  if ($status) then
    307     set incdirs = "$incdirs -I$g "
     340    set incdirs = "$incdirs-I$g "
    308341  endif
    309342end
     
    315348endif   
    316349
    317 echo ""
    318 echo INCDIRS: $incdirs
    319 echo LIBDIRS: $libdirs
    320 echo LIBFLAGS: $libflags
    321 
    322 echo ARCH: $arch
    323 echo ROOT: $root
    324 echo PREFIX: $prefix
    325350echo
    326 
    327 #echo BINDIR $bindir
    328 #echo LIBDIR $libdir
    329 #echo INCDIR $incdir
    330 #echo DATADIR $datadir
    331 #echo MANDIR $mandir
    332 
     351echo "Compiler options:"
     352echo "CC: $CC"
     353echo "CFLAGS: $CFLAGS"
     354echo "CPPFLAGS: $CPPFLAGS"
     355echo "LDFLAGS: $LDFLAGS"
     356
     357echo
     358echo "Additional compiler flags:"
     359echo "INCDIRS: $incdirs"
     360echo "LIBDIRS: $libdirs"
     361echo "LIBFLAGS: $libflags"
     362
     363echo
     364echo "ARCH: $arch"
     365echo "ROOT: $root"
     366echo "PREFIX: $prefix"
     367echo
     368
     369# the config.tools fixconf operations below interpolate values in Configure
    333370if (-e Configure) mv Configure Configure.bak
    334 
    335 rm -f Configure.in.tmp Configure.tmp
    336 cp Configure.in Configure.in.tmp
     371cp Configure.in Configure
    337372
    338373# we don't currently need to modify the Makefile but since configure
     
    340375cp -f Makefile.in Makefile
    341376
    342 # modify the BINDIR
     377# the ROOTDIR defines the location of the source tree
     378./config.tools fixconf @ROOTDIR@  "$root"
     379
     380# the following entries define the target installation locations
     381
     382# BINDIR (DESTBIN) holds the output binary files
    343383if ("$bindir" == "") then
    344384  set subdir = bin
     
    351391  set binpath = $prefix/$subpath
    352392endif
    353 cat Configure.in.tmp | sed "s|@BINDIR@| $bindir|" > Configure.tmp
    354 rm -f Configure.in.tmp
    355 mv Configure.tmp Configure.in.tmp
    356 echo BINDIR $bindir
    357 
    358 # modify the INCDIR
     393set bindir = `./config.tools fixpath $bindir`
     394./config.tools fixconf @BINDIR@ $bindir
     395echo DESTBIN $bindir
     396
     397# INCDIR (DESTINC) holds the output header files
    359398if ("$incdir" == "") then
    360399  set subdir = include
     
    362401  set incdir = $prefix/$subdir
    363402endif
    364 cat Configure.in.tmp | sed "s|@INCDIR@|$incdir|" > Configure.tmp
    365 rm -f Configure.in.tmp
    366 mv Configure.tmp Configure.in.tmp
    367 echo INCDIR $incdir
    368 
    369 # modify the LIBDIR
     403set incdir = `./config.tools fixpath $incdir`
     404./config.tools fixconf @INCDIR@ $incdir
     405echo DESTINC $incdir
     406
     407# LIBDIR (DESTLIB) holds the output library files
    370408if ("$libdir" == "") then
    371409  set subdir = lib
     
    373411  set libdir = $prefix/$subdir
    374412endif
    375 cat Configure.in.tmp | sed "s|@LIBDIR@|$libdir|" > Configure.tmp
    376 rm -f Configure.in.tmp
    377 mv Configure.tmp Configure.in.tmp
    378 echo LIBDIR $libdir
    379 
    380 # modify the MANDIR
     413set libdir = `./config.tools fixpath $libdir`
     414./config.tools fixconf @LIBDIR@ $libdir
     415echo DESTLIB $libdir
     416
     417# MANDIR (DESTMAN) holds the output man pages
    381418if ("$mandir" == "") then
    382419  set mandir = $prefix/man
    383420endif
    384 cat Configure.in.tmp | sed "s|@MANDIR@|$mandir|" > Configure.tmp
    385 rm -f Configure.in.tmp
    386 mv Configure.tmp Configure.in.tmp
    387 echo MANDIR $mandir
    388 
    389 # modify the DATADIR
     421set mandir = `./config.tools fixpath $mandir`
     422./config.tools fixconf @MANDIR@ $mandir
     423echo DESTMAN $mandir
     424
     425# DATADIR (DESTDATA) holds the general non-binary files
    390426if ("$datadir" == "") then
    391427  set datadir = $prefix/share
    392428endif
    393 cat Configure.in.tmp | sed "s|@DATADIR@|$datadir|" > Configure.tmp
    394 rm -f Configure.in.tmp
    395 mv Configure.tmp Configure.in.tmp
    396 echo DATADIR $datadir
    397 
     429set datadir = `./config.tools fixpath $datadir`
     430./config.tools fixconf @DATADIR@ $datadir
     431echo DESTDATA $datadir
     432
     433# the vararch option defines an automatic arch-dependent directory
     434# tree for DESTBIN, DESTLIB, DESTINC
    398435if ($vararch) then
    399   cat Configure.in.tmp | sed "s|^\s*ARCH|# ARCH|" > Configure.tmp
     436  ./config.tools fixconf "^\s*ARCH" "# ARCH"
    400437else
    401   cat Configure.in.tmp | sed "s|@ARCHVAL@|$arch|" > Configure.tmp
     438  ./config.tools fixconf @ARCHVAL@ $arch
    402439endif
    403 rm -f Configure.in.tmp
    404 mv Configure.tmp Configure.in.tmp
    405 
    406 cat Configure.in.tmp | sed "s|@ROOTDIR@|$root|" | sed "s|@INCDIRS@|$incdirs|" | sed "s|@LIBDIRS@|$libdirs|" | sed "s|@LIBFLAGS@|$libflags|" | sed "s|@OPTFLAGS@|$optflags $pedantic|" > Configure
    407 rm -f Configure.in.tmp Configure.tmp
     440
     441# INCDIRS, LIBDIRS, LIBFLAGS define include and library flags needed
     442# by the externally-supplied libraries
     443./config.tools fixconf @INCDIRS@  "$incdirs"
     444./config.tools fixconf @LIBDIRS@  "$libdirs"
     445./config.tools fixconf @LIBFLAGS@ "$libflags"
     446
     447# these are the compiler options
     448./config.tools fixconf @CC@ "$CC"
     449./config.tools fixconf @CFLAGS@ "$CFLAGS"
     450./config.tools fixconf @CPPFLAGS@ "$CPPFLAGS"
     451./config.tools fixconf @LDFLAGS@ "$LDFLAGS"
     452
     453# other architecture dependent options
     454./config.tools fixconf @RANLIB@ "$ranlib"
    408455
    409456cat ohana-config.in | sed "s|@INCDIR@|$incdir|" | sed "s|@LIBDIR@|$libdir|" | sed "s|(ARCH)|ARCH|" > ohana-config
Note: See TracChangeset for help on using the changeset viewer.