IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.