Changeset 3848


Ignore:
Timestamp:
Oct 10, 2018 2:06:13 PM (11 months ago)
Author:
lou
Message:

Introduce CHK_HERE, {_CFLAGS,_LFLAGS}_NOPC for use in .pc files and remove
_PUB variables, rename a few variables, and generally clean up accumulation
of compiler and linker flags.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r3811 r3848  
    8585])
    8686
     87
    8788###########################################################################
    8889#                          COIN_ENABLE_MSVC                               #
     
    101102])
    102103
    103 ###########################################################################
    104 #                            COIN_INITIALIZE                               #
     104
     105###########################################################################
     106#                      COIN_DEPENDENCY_LINKING                            #
     107###########################################################################
     108
     109# Control whether all dependencies are linked into shared libraries. `Yes' is
     110# the recommended best practice now-a-days. This can be overridden on the
     111# configure command line.
     112
     113# In BuildTools/stable, dependency linking is disabled for cl and icl on
     114# cygwin and mingw, enabled for everything else. That may need to be
     115# reintroduced. --lh, 180228 --
     116
     117AC_DEFUN([AC_COIN_DEPENDENCY_LINKING],
     118[
     119  AC_ARG_ENABLE([dependency-linking],
     120    [AC_HELP_STRING([--enable-dependency-linking],
     121       [Link all library dependencies into shared libraries at
     122        creation (default=yes)])],
     123    [dependency_linking="$enableval"],
     124    [dependency_linking=yes])
     125
     126# AC_SUBST([LT_LDFLAGS])
     127# if test "$dependency_linking" = yes ; then
     128#   LT_LDFLAGS="$LT_LDFLAGS -no-undefined"
     129# fi
     130
     131  AM_CONDITIONAL(DEPENDENCY_LINKING, [test "$dependency_linking" = yes])
     132])
     133
     134###########################################################################
     135#                        COIN_COMPFLAGS_DEFAULTS                          #
    105136###########################################################################
    106137
     
    138169])
    139170
     171###########################################################################
     172#                            COIN_INITIALIZE                               #
     173###########################################################################
     174
    140175# AC_COIN_INITIALIZE(name,version)
    141176
     
    213248# On Windows, shared C++ libraries do not work with the current libtool (it
    214249# handles only exports for C functions, not C++). On all other systems, build
    215 # shared libraries.
    216 
    217   case $host_os in
    218     cygwin* | mingw* | msys* )
    219       AC_DISABLE_SHARED
    220       ;;
    221     *)
    222       AC_DISABLE_STATIC
    223       ;;
    224   esac
    225 
    226 # Create libtool
    227 
    228   AC_PROG_LIBTOOL
     250# only shared libraries.
     251
     252# (lh, 180302) Sadly, we can't use the obvious libtool macros
     253# (AC_{ENABLE,DISABLE}_{SHARED,STATIC}, nor parameters to LT_INIT,
     254# precisely because these macros record the default behaviour by defining
     255# a macro, _LT_ENABLE_{SHARED,STATIC}_DEFAULT. No shell code involved, hence
     256# any shell conditional has no effect. Either we trust libtool or we need
     257# something more inventive. The relevant libtool macros are in ltoptions.m4,
     258# _LT_ENABLE_SHARED and _LT_ENABLE_STATIC.
     259
     260# case $host_os in
     261#   cygwin* | mingw* | msys* )
     262#     AC_DISABLE_SHARED
     263#     ;;
     264#   *)
     265#     AC_DISABLE_STATIC
     266#     ;;
     267# esac
     268
     269# Create libtool.
     270
     271  LT_INIT
    229272
    230273# Patch libtool to eliminate a trailing space after AR_FLAGS. This needs to be
     
    241284  esac
    242285
    243 # -no-undefined is required for DLLs on Windows
    244 
    245   LT_LDFLAGS="-no-undefined"
     286# Set up LT_LDFLAGS. Add the library version string to LT_LDFLAGS, if one
     287# is supplied.
     288
    246289  AC_SUBST([LT_LDFLAGS])
     290  AC_MSG_CHECKING([if the library version is set])
     291  if test x"$coin_libversion" != x ; then
     292    LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion"
     293    AC_MSG_RESULT([$coin_libversion])
     294  else
     295    AC_MSG_RESULT([no])
     296  fi
     297
     298# Check if dependency linking is enabled or disabled.
     299
     300  AC_COIN_DEPENDENCY_LINKING
     301
    247302])
    248303
     
    266321
    267322  AC_BEFORE([$0],[LT_INIT])
    268   AC_BEFORE([$0],[AC_PROG_LIBTOOL])
    269323
    270324# If enable-msvc, then test only for MS and Intel (on Windows) C compiler
     
    341395    AC_MSG_CHECKING([$PKG_CONFIG is at least version $pkg_min_version])
    342396    if $PKG_CONFIG --atleast-pkgconfig-version $pkg_min_version ; then
    343       AC_MSG_RESULT([yes: `$PKG_CONFIG --version`])
     397      pkg_version=`$PKG_CONFIG --version`
     398      AC_MSG_RESULT([yes: $pkg_version])
    344399    else
    345400     AC_MSG_RESULT([no])
     
    367422# ${libdir}/pkgconfig. But autoconf sets $libdir to '${exec_prefix}/lib', and
    368423# $exec_prefix to '${prefix}'.  COIN_INITIALIZE will set ac_default_prefix
    369 # correctly. Unless the user specifies --prefix, it is set to NONE
    370 # until the end of configuration, at which point it will be set to
    371 # $ac_default_prefix. Unless the user specifies --exec-prefix, it is
    372 # set to NONE until the end of configuration, at which point it's set to
     424# correctly. Unless the user specifies --prefix, prefix is set to
     425# NONE until the end of configuration, at which point it will be set to
     426# $ac_default_prefix. Unless the user specifies --exec-prefix, exec-prefix
     427# is set to NONE until the end of configuration, at which point it's set to
    373428# '${prefix}'. Sheesh.  So do the expansion, then back it out. Of course,
    374429# this whole house of cards balances on the shaky assumption that the user is
     
    419474  if test -n "$PKG_CONFIG" ; then
    420475    if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$2" ; then
    421       m4_toupper($1)[]_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '`
     476      m4_toupper($1)_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '`
    422477      $3
    423478    else
     
    431486
    432487###########################################################################
     488#                          COIN_INIT_LIBVARS                              #
     489###########################################################################
     490
     491# COIN_INIT_LIBVARS(lib,lflags,cflags,pcfiles,data)
     492
     493# This macro sets up the public variables for lib, PROJ_LFLAGS_PUB,
     494# PROJ_CFLAGS_PUB, PROJ_PCFILES_PUB, and PROJ_DATA. These variables correspond
     495# to Libs, Cflags, Requires, and datadir in the .pc.in file for a project.
     496# More generally, this macro is useful when a project builds libraries that
     497# are used by other libraries during the project build. For example, Osi
     498# builds OsiLib, which is used by OsiCommonTest and the various OsiXxxLib
     499# interfaces to third-party solvers.
     500
     501# PROJ_PCFILES_PUB should be used rarely, if ever. We're exposing public
     502# information from lower level libraries at the level of this library, which is
     503# not usually necessary.
     504
     505# The datadir variable is a COIN extension in the .pc file. It defaults
     506# to @datadir@/@PACKAGE_TARNAME@ in accordance with Gnu standards.
     507
     508AC_DEFUN([AC_COIN_INIT_LIBVARS],
     509[
     510  AC_SUBST(m4_toupper($1_LFLAGS_PUB),["$2"])
     511  AC_SUBST(m4_toupper($1_CFLAGS_PUB),["$3"])
     512  AC_SUBST(m4_toupper($1_PCFILES_PUB),["$4"])
     513  AC_SUBST(m4_toupper($1_DATA),["$5"])
     514])
     515 
     516
     517###########################################################################
     518#                          COIN_CHK_HERE                                  #
     519###########################################################################
     520
     521# COIN_CHK_HERE([prim],[client packages],[pcfile])
     522
     523# Augment the _LFLAGS, _CFLAGS, and _PCFILES variables of the client
     524# packages with the values from PRIM_LFLAGS_PUB, PRIM_CFLAGS_PUB, and
     525# PRIM_PCFILES_PUB. This macro is intended for the case where a single project
     526# builds several objects and one object includes another. For example,
     527# the various OsiXxxLib solvers, which depend on OsiLib. We can't consult
     528# osi.pc (it's not installed yet) but the relevant variables are ready at
     529# hand. The name of prim is often different from the name of the .pc file
     530# ($3), hence the separate parameter.
     531
     532# This macro should be called after FINALIZE_FLAGS is invoked for the
     533# client packages, for two reasons: First, COIN packages tend to use
     534# .pc files, so we're probably adding a package to _PCFILES that isn't yet
     535# installed. Also, FINALIZE_FLAGS will have accessed the .pc files already
     536# in _PCFILES and expanded them into _LIBS and _CFLAGS, saving the original
     537# _LIBS and _CFLAGS in _LIBS_NOPC and _CFLAGS_NOPC.
     538
     539AC_DEFUN([AC_COIN_CHK_HERE],
     540[
     541
     542# Make sure the necessary variables exist for each client package.
     543
     544  m4_foreach_w([myvar],[$2],
     545    [AC_SUBST(m4_toupper(myvar)_LFLAGS)
     546     AC_SUBST(m4_toupper(myvar)_CFLAGS)
     547     AC_SUBST(m4_toupper(myvar)_PCFILES)])
     548
     549# Add the .pc file and augment LFLAGS and CFLAGS.
     550
     551    m4_foreach_w([myvar],[$2],
     552      [m4_toupper(myvar)_PCFILES="$m4_toupper(myvar)_PCFILES $3"
     553       m4_toupper(myvar)_LFLAGS="$m4_toupper(myvar)_LFLAGS $m4_toupper($1)_LFLAGS"
     554       m4_toupper(myvar)_CFLAGS="$m4_toupper(myvar)_CFLAGS $m4_toupper($1)_CFLAGS"
     555
     556# Change the test to enable / disable debugging output
     557
     558       if test 1 = 1 ; then
     559         AC_MSG_NOTICE([CHK_HERE adding $1 to myvar:])
     560         AC_MSG_NOTICE([m4_toupper(myvar)_PCFILES: "${m4_toupper(myvar)_PCFILES}"])
     561         AC_MSG_NOTICE([m4_toupper(myvar)_LFLAGS: "${m4_toupper(myvar)_LFLAGS}"])
     562         AC_MSG_NOTICE([m4_toupper(myvar)_CFLAGS: "${m4_toupper(myvar)_CFLAGS}"])
     563       fi ; ])
     564
     565])   # COIN_CHK_HERE
     566
     567###########################################################################
    433568#                      COIN_DEF_PRIM_ARGS                                 #
    434569###########################################################################
     
    439574# configuration files supply for a component (package or library):
    440575#   --with-prim: use primitive (yes / no / special)
    441 #   --with-prim-libs: linker flags for the primitive
     576#   --with-prim-lflags: linker flags for the primitive
    442577#   --with-prim-cflags: preprocessor & compiler flags for the primitive
    443578#   --with-prim-data: data directory for the primitive
    444 # These arguments allow the user to override default macro behaviour on the
     579# These arguments allow the user to override default macro behaviour from the
    445580# configure command line.
    446581# The string prim, lower-cased, is used in the flag name.
    447582# The parameters base, lflags, cflags, and dflags have the value yes or no and
    448 # determine whether a --with option will be defined for prim, libs, cflags,
     583# determine whether a --with option will be defined for prim, lflags, cflags,
    449584# and data, respectively. They must be literals, as the macro uses them to cut
    450585# out unused options. To use the results, construct the name of the shell
    451 # variable as specified in the autoconf doc'n.
     586# variable as specified in the autoconf doc'n for ARG_WITH.
    452587
    453588# Setting the final parameter to 'build' will cause the phrase "'build' will
     
    470605        Any other argument is applied as for --with-m4_tolower($1)-cflags,
    471606        noyesyes,
    472         Any other argument is applied as for --with-m4_tolower($1)-data,
    473         Any other argument is applied as for --with-m4_tolower($1)-libs))])
     607        Any other argument is applied as for --with-m4_tolower($1)-cflags,
     608        Any other argument is applied as for --with-m4_tolower($1)-lflags))])
    474609
    475610  m4_if($2,yes,
     
    478613
    479614  m4_if($3,yes,
    480     [AC_ARG_WITH([m4_tolower($1)-libs],
    481        AS_HELP_STRING([--with-m4_tolower($1)-libs],
     615    [AC_ARG_WITH([m4_tolower($1)-lflags],
     616       AS_HELP_STRING([--with-m4_tolower($1)-lflags],
    482617         [Linker flags for $1 appropriate for your environment.
    483618          (Most often, -l specs for libraries.)]))])
     
    503638
    504639# Determine whether we can use primary package prim ($1) and assemble
    505 # information on the required library flags (prim_libs), compiler flags
     640# information on the required library flags (prim_lflags), compiler flags
    506641# (prim_cflags), and data directories (prim_data) as specified by cmdlineopts.
    507642
    508643# cmdlineopts ($4) specifies the set of configure command line options
    509 # defined and processed: 'nodata' produces --with-prim, --with-prim-libs,
    510 # and --with-prim-cflags 'dataonly' produces only --with-prim and
    511 # --with-prim-data Anything else ('all' works well) produces all four
    512 # command line options. Shell code produced by the macro is tailored based
    513 # on cmdlineopts. `nodata' is the default.
     644# defined and processed: 'nodata' produces --with-prim, --with-prim-libs, and
     645# --with-prim-cflags; 'dataonly' produces --with-prim and --with-prim-data;
     646# anything else ('all' works well) produces all four command line
     647# options. Shell code produced by the macro is tailored based on
     648# cmdlineopts. `nodata' is the default.
    514649
    515650# --with-prim is interpreted as follows: --with-prim=no is equivalent to
    516651# --without-prim. Any of --with-prim, --with-prim=yes, or --with-prim=build,
    517652# cause the macro to look for a .pc file. Any other value is taken as
    518 # equivalent to --with-prim-data=value (dataonly) or --with-prim-libs=value
     653# equivalent to --with-prim-data=value (dataonly) or --with-prim-lflags=value
    519654# (anything else).
    520655
    521656# The algorithm first checks for a user-specified value of --with-prim;
    522657# if this is no, prim is skipped. Next, it looks for user specified values
    523 # given with command line parameters --with-prim-libs, --with-prim-cflags,
     658# given with command line parameters --with-prim-lflags, --with-prim-cflags,
    524659# and --with-prim-data. If none of these are specified, it will look for a
    525660# .pc file for prim using PKG_CONFIG.
    526661
    527662# Default action ($3) (no, yes, build) is the default action if the user
    528 # offers no guidance via command line parameters. In turn, it defaults to yes.
     663# offers no guidance via command line parameters. The (hardwired) default is
     664# yes.
    529665
    530666# If no .pc file names are specified, the macro will look for prim.pc if the
    531667# default is yes, coinprim.pc if the default is build.  If a .pc file name
    532668# ($2) is specified, it overrides the macro defaults. Note that for the
    533 # majority of COIN packages, you should not specify `build' as .pc files for
    534 # most COIN packages are simply the package name (e.g., clp.pc). But for
     669# majority of COIN packages, you should not specify `build' as .pc files
     670# for most COIN packages are simply the package name (e.g., clp.pc). For
    535671# ThirdParty packages, this works (e.g., coinglpk.pc).
    536672
     
    549685
    550686  m4_tolower(coin_has_$1)=noInfo
    551   m4_tolower($1_libs)=
     687  m4_tolower($1_lflags)=
    552688  m4_tolower($1_cflags)=
    553689  m4_tolower($1_data)=
     
    573709        m4_if(m4_default($4,nodata),dataonly,
    574710          [m4_tolower($1_data)=$withval],
    575           [m4_tolower($1_libs)=$withval])
     711          [m4_tolower($1_lflags)=$withval])
    576712        ;;
    577713    esac
     
    584720  m4_if(m4_default($4,nodata),dataonly,[],
    585721    [if test "$m4_tolower(coin_has_$1)" != skipping ; then
    586        withval=$m4_tolower(with_$1_lib)
     722       withval=$m4_tolower(with_$1_lflags)
    587723       if test -n "$withval" ; then
    588724         case "$withval" in
     
    592728           * )
    593729             m4_tolower(coin_has_$1)=yes
    594              m4_tolower($1_libs)=$withval
     730             m4_tolower($1_lflags)=$withval
    595731             ;;
    596732         esac
     
    696832      AC_MSG_NOTICE([FIND_PRIM_PKG result for $1: "$m4_tolower(coin_has_$1)"])
    697833      AC_MSG_NOTICE([Collected values for package '$1'])
    698       AC_MSG_NOTICE([m4_tolower($1_libs) is "$m4_tolower($1_libs)"])
     834      AC_MSG_NOTICE([m4_tolower($1_lflags) is "$m4_tolower($1_lflags)"])
    699835      AC_MSG_NOTICE([m4_tolower($1_cflags) is "$m4_tolower($1_cflags)"])
    700836      AC_MSG_NOTICE([m4_tolower($1_data) is "$m4_tolower($1_data)"])
     
    709845
    710846# COIN_CHK_PKG([prim],[client packages],[.pc file name],
    711 #              [default action],[public/private],[cmdopts])
     847#              [default action],[cmdopts])
    712848
    713849# Determine whether we can use primary package prim ($1) and assemble
    714 # information on the required library flags (prim_libs), compiler flags
     850# information on the required linker flags (prim_lflags), compiler flags
    715851# (prim_cflags), and data directories (prim_data).
    716852
    717853# The configure command line options offered to the user are controlled
    718 # by cmdopts ($6). 'nodata' offers --with-prim, --with-prim-libs, and
     854# by cmdopts ($5). 'nodata' offers --with-prim, --with-prim-lflags, and
    719855# --with-prim-cflags. 'dataonly' offers --with-prim and --with-prim-data.
    720856# 'all' offers all four. DEF_PRIM_ARGS and FIND_PRIM_PKG are tailored
     
    735871# Linker and compiler flag information will be propagated to the space-
    736872# separated list of client packages ($2) using the _PCFILES variable if
    737 # a .pc file is used, otherwise by the _LIBS and _CFLAGS variables of
     873# a .pc file is used, otherwise by the _LFLAGS and _CFLAGS variables of
    738874# client packages. These variables match Requires.private, Libs.private,
    739 # and Cflags.private, respectively, in a .pc file. To force information about
    740 # prim to be added to the public variables in a .pc file, set public/private
    741 # ($5) to public.
     875# and Cflags.private, respectively, in a .pc file.
    742876
    743877# The macro doesn't test that the specified values actually work. This is
     
    752886  AC_MSG_CHECKING([for package $1])
    753887
    754   pubpriv=m4_default([$5],[private])
    755 
    756888# Make sure the necessary variables exist for each client package.
    757889
    758890  m4_foreach_w([myvar],[$2],
    759     [AC_SUBST(m4_toupper(myvar)_LIBS)
     891    [AC_SUBST(m4_toupper(myvar)_LFLAGS)
    760892     AC_SUBST(m4_toupper(myvar)_CFLAGS)
    761      AC_SUBST(m4_toupper(myvar)_PCFILES)
    762      AC_SUBST(m4_toupper(myvar)_LIBS_PUB)
    763      AC_SUBST(m4_toupper(myvar)_CFLAGS_PUB)
    764      AC_SUBST(m4_toupper(myvar)_PCFILES_PUB)])
    765 
    766 # Check to see if the user has overridden configure parameters from the
    767 # environment.
     893     AC_SUBST(m4_toupper(myvar)_PCFILES)])
     894
     895# Check to see if the user has set an override to skip this primary.
    768896
    769897  m4_tolower(coin_has_$1)=noInfo
     
    776904  fi
    777905
    778 # If we're not skipping this project, define and process the command line
     906# If we're not skipping this primary, define and process the command line
    779907# options according to the cmdopts parameter. Then invoke FIND_PRIM_PKG to do
    780908# the heavy lifting.
    781909
    782910  if test "$m4_tolower(coin_has_$1)" != skipping ; then
    783     m4_case(m4_default($6,nodata),
     911    m4_case(m4_default($5,nodata),
    784912      nodata,[AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,no,$4)],
    785913      dataonly,[AC_COIN_DEF_PRIM_ARGS([$1],yes,no,no,yes,$4)],
    786914      [AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,yes,$4)])
    787     AC_COIN_FIND_PRIM_PKG(m4_tolower($1),[$3],[$4],[$6])
     915    AC_COIN_FIND_PRIM_PKG(m4_tolower($1),[$3],[$4],[$5])
    788916    AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    789917  else
     
    803931
    804932# If we've located the package, define preprocessor symbol COIN_HAS_PRIM and
    805 # augment the necessary variables for the client packages. We need the final
    806 # ':' (noop) below because it's possible that the list of client packages
    807 # is empty.
     933# augment the necessary variables for the client packages.
    808934
    809935  if test $m4_tolower(coin_has_$1) = yes ; then
    810936    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],
    811       [Define to 1 if the $1 package is available])
    812     if test $pubpriv = private ; then
    813       m4_foreach_w([myvar],[$2],
    814         [m4_toupper(myvar)_PCFILES="$m4_tolower($1_pcfiles) $m4_toupper(myvar)_PCFILES"
    815          m4_toupper(myvar)_LIBS="$m4_tolower($1_libs) $m4_toupper(myvar)_LIBS"
    816          m4_toupper(myvar)_CFLAGS="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS"])
    817       :
    818     else
    819       m4_foreach_w([myvar],[$2],
    820         [m4_toupper(myvar)_PCFILES_PUB="$m4_tolower($1_pcfiles) $m4_toupper(myvar)_PCFILES"_PUB
    821          m4_toupper(myvar)_LIBS_PUB="$m4_tolower($1_libs) $m4_toupper(myvar)_LIBS_PUB"
    822          m4_toupper(myvar)_CFLAGS_PUB="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS_PUB"])
    823       :
    824     fi
     937      [Define to 1 if $1 is available.])
     938    m4_foreach_w([myvar],[$2],
     939      [m4_toupper(myvar)_PCFILES="$m4_tolower($1_pcfiles) $m4_toupper(myvar)_PCFILES"
     940       m4_toupper(myvar)_LFLAGS="$m4_tolower($1_lflags) $m4_toupper(myvar)_LFLAGS"
     941       m4_toupper(myvar)_CFLAGS="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS"])
    825942
    826943# Finally, set up PRIM_DATA, unless the user specified nodata.
    827944
    828     m4_if(m4_default([$6],nodata),nodata,[],
     945    m4_if(m4_default([$5],nodata),nodata,[],
    829946      [AC_SUBST(m4_toupper($1)_DATA)
    830947       m4_toupper($1)_DATA=$m4_tolower($1_data)])
     
    837954###########################################################################
    838955
    839 # COIN_FIND_PRIM_LIB([prim],[linkflgs],[cflgs],[dataflgs],
     956# COIN_FIND_PRIM_LIB([prim],[lflgs],[cflgs],[dflgs],
    840957#                    [dfltaction],[cmdlineopts])
    841958
    842959# Determine whether we can use primary library prim ($1) and assemble
    843 # information on the required library flags (prim_libs), compiler flags
     960# information on the required linker flags (prim_lflags), compiler flags
    844961# (prim_cflags), and data directories (prim_data) as specified by cmdlineopts.
    845962
    846963# cmdlineopts ($6) specifies the set of configure command line options
    847 # defined and processed: 'nodata' produces --with-prim, --with-prim-libs,
    848 # and --with-prim-cflags 'dataonly' produces only --with-prim and
    849 # --with-prim-data Anything else ('all' works well) produces all four
     964# defined and processed: 'nodata' produces --with-prim, --with-prim-lflags,
     965# and --with-prim-cflags; 'dataonly' produces only --with-prim and
     966# --with-prim-data; anything else ('all' works well) produces all four
    850967# command line options. Shell code produced by the macro is tailored based
    851968# on cmdlineopts. `nodata' is the default.
     
    854971#   * --with-prim=no is equivalent to --without-prim.
    855972#   * --with-prim or --with-prim=yes is equivalent to
    856 #       --with-prim-libs=-lprim
     973#       --with-prim-lflags=-lprim
    857974#       --with-prim-data=/usr/local/share
    858975#   * --with-prim=build attempts to invent something that will find a COIN
    859976#     ThirdParty library or data
    860 #       --with-prim-libs="-L\$(libdir) -lcoinprim"
     977#       --with-prim-lflags="-L\$(libdir) -lcoinprim"
    861978#       --with-prim-cflgs="-I\$(pkgincludedir)/ThirdParty"
    862979#       --with-prim-data="\$(pkgdatadir)"
    863980#   * Any other value is taken as equivalent to
    864981#       --with-prim-data=value (dataonly) or
    865 #       --with-prim-libs=value (anything else)
     982#       --with-prim-lflags=value (anything else)
    866983
    867984# The algorithm first checks for a user-specified value of --with-prim;
    868985# if this is no, prim is skipped. Next, it looks for user specified values
    869 # given with command line parameters --with-prim-libs, --with-prim-cflags,
     986# given with command line parameters --with-prim-lflags, --with-prim-cflags,
    870987# and --with-prim-data. If none of these are specified, it will use the values
    871988# passed as parameters. It's all or none: any command line options disable all
     
    873990
    874991# Default action ($5) (no, yes, build) is the default value of --with-prim
    875 # if the user offers no guidance via command line parameters. In turn,
    876 # it defaults to yes. `build' doesn't have a hope of working except for COIN
    877 # ThirdParty packages, and even then it's pretty shaky.
     992# if the user offers no guidance via command line parameters. The (hardwired)
     993# default is yes. `build' doesn't have a hope of working except for COIN
     994# ThirdParty packages, and even then it's pretty shaky. You should be
     995# using CHK_PKG, because COIN packaging for ThirdParty software creates a .pc
     996# file.
    878997
    879998# The macro doesn't test that the specified values actually work. This is
     
    8891008
    8901009  m4_tolower(coin_has_$1)=noInfo
    891   m4_tolower($1_libs)=
     1010  m4_tolower($1_lflags)=
    8921011  m4_tolower($1_cflags)=
    8931012  m4_tolower($1_data)=
     
    9171036  fi
    9181037
    919 # --with-prim-libs and --with-prim-cflags are present unless the client
     1038# --with-prim-lflags and --with-prim-cflags are present unless the client
    9201039# specified dataonly. Specifying --with-prim=no overrides the individual
    921 # options for libs and cflags.
     1040# options for lflags and cflags.
    9221041
    9231042  m4_if(m4_default($6,nodata),dataonly,[],
    9241043    [if test "$m4_tolower(coin_has_$1)" != skipping ; then
    925        withval=$m4_tolower(with_$1_lib)
     1044       withval=$m4_tolower(with_$1_lflags)
    9261045       if test -n "$withval" ; then
    9271046         case "$withval" in
     
    10001119      m4_if(m4_default($6,nodata),dataonly,[],
    10011120        [m4_ifnblank([$2],
    1002            [m4_tolower($1_libs)=$2],
     1121           [m4_tolower($1_lflags)=$2],
    10031122           [if test "$m4_tolower(coin_has_$1)" = build ; then
    1004               m4_tolower($1_libs)="-L\$(libdir) -l[]m4_tolower(coin$1)"
     1123              m4_tolower($1_lflags)="-L\$(libdir) -l[]m4_tolower(coin$1)"
    10051124            else
    1006               m4_tolower($1_libs)="-l[]m4_tolower($1)"
     1125              m4_tolower($1_lflags)="-l[]m4_tolower($1)"
    10071126            fi])
    10081127         m4_ifnblank([$3],
     
    10361155      AC_MSG_NOTICE([FIND_PRIM_LIB result for $1: "$m4_tolower(coin_has_$1)"])
    10371156      AC_MSG_NOTICE([Collected values for package '$1'])
    1038       AC_MSG_NOTICE([m4_tolower($1_libs) is "$m4_tolower($1_libs)"])
     1157      AC_MSG_NOTICE([m4_tolower($1_lflags) is "$m4_tolower($1_lflags)"])
    10391158      AC_MSG_NOTICE([m4_tolower($1_cflags) is "$m4_tolower($1_cflags)"])
    10401159      AC_MSG_NOTICE([m4_tolower($1_data) is "$m4_tolower($1_data)"])
     
    10481167###########################################################################
    10491168
    1050 # COIN_CHK_LIB([prim],[client packages],[linkflgs],[cflgs],[dataflgs],
    1051 #              [dfltaction],[public/private],[cmdopts])
     1169# COIN_CHK_LIB([prim],[client packages],[lflgs],[cflgs],[dflgs],
     1170#              [dfltaction],[cmdopts])
    10521171
    10531172# Determine whether we can use primary library prim ($1) and assemble
    1054 # information on the required library flags (prim_libs), compiler flags
     1173# information on the required linker flags (prim_lflags), compiler flags
    10551174# (prim_cflags), and data directories (prim_data).
    10561175
    10571176# The configure command line options offered to the user are controlled
    1058 # by cmdopts ($8). 'nodata' offers --with-prim, --with-prim-libs, and
    1059 # --with-prim-cflags. 'dataonly' offers --with-prim and --with-prim-data.
    1060 # 'all' offers all four. DEF_PRIM_ARGS and FIND_PRIM_PKG are tailored
     1177# by cmdopts ($7). 'nodata' offers --with-prim, --with-prim-lflags, and
     1178# --with-prim-cflags; 'dataonly' offers --with-prim and --with-prim-data;
     1179# 'all' offers all four. DEF_PRIM_ARGS and FIND_PRIM_LIB are tailored
    10611180# accordingly. The (hardwired) default is 'nodata'.
    10621181
    1063 # Macro parameters linkflgs ($3), cflgs ($4), and dataflgs ($5) are used for
    1064 # --with-prim-libs, --with-prim-cflgs, and --with-prim-data if and only if
     1182# Macro parameters lflgs ($3), cflgs ($4), and dflgs ($5) are used for
     1183# --with-prim-lflags, --with-prim-cflags, and --with-prim-data if and only if
    10651184# there are no user-supplied values on the command line. It's all or nothing;
    10661185# any user-supplied value causes all macro parameters to be ignored.
    10671186
    10681187# Default action ($6) (no, yes, build) is the default action if the user
    1069 # offers no guidance via command line parameters. Really, 'build' has no hope
    1070 # of working except for COIN ThirdParty packages. Don't use it for other COIN
    1071 # packages.
     1188# offers no guidance via command line parameters. Really, 'build' has no
     1189# hope of working except for COIN ThirdParty packages. Don't use it for
     1190# other COIN packages. You should be using CHK_PKG because COIN packaging
     1191# for ThirdParty software creates a .pc file.
    10721192
    10731193# Define an automake conditional COIN_HAS_PRIM to record the result. If we
     
    10751195
    10761196# Linker and compiler flag information will be propagated to the space-
    1077 # separated list of client packages ($2) using the _LIBS and _CFLAGS variables
    1078 # of client packages. These variables match Libs.private and Cflags.private,
    1079 # respectively, in a .pc file. To force information about prim to be added
    1080 # to the public variables in a .pc file, set public/private ($7) to public.
     1197# separated list of client packages ($2) using the _LFLAGS and _CFLAGS
     1198# variables of client packages. These variables match Libs.private and
     1199# Cflags.private, respectively, in a .pc file.
    10811200
    10821201# The macro doesn't test that the specified values actually work. This is
     
    10891208  AC_MSG_CHECKING([for package $1])
    10901209
    1091   pubpriv=m4_default([$7],[private])
    1092 
    10931210# Make sure the necessary variables exist for each client package.
    10941211
    10951212  m4_foreach_w([myvar],[$2],
    1096     [AC_SUBST(m4_toupper(myvar)_LIBS)
    1097      AC_SUBST(m4_toupper(myvar)_CFLAGS)
    1098      AC_SUBST(m4_toupper(myvar)_LIBS_PUB)
    1099      AC_SUBST(m4_toupper(myvar)_CFLAGS_PUB)])
     1213    [AC_SUBST(m4_toupper(myvar)_LFLAGS)
     1214     AC_SUBST(m4_toupper(myvar)_CFLAGS)])
    11001215
    11011216# Check to see if the user has overridden configure parameters from the
     
    11161231
    11171232  if test "$m4_tolower(coin_has_$1)" != skipping ; then
    1118     m4_case(m4_default($8,nodata),
     1233    m4_case(m4_default($7,nodata),
    11191234      nodata,[AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,no,$4)],
    11201235      dataonly,[AC_COIN_DEF_PRIM_ARGS([$1],yes,no,no,yes,$4)],
    11211236      [AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,yes,$4)])
    1122     AC_COIN_FIND_PRIM_LIB(m4_tolower($1),[$3],[$4],[$5],[$6],[$8])
     1237    AC_COIN_FIND_PRIM_LIB(m4_tolower($1),[$3],[$4],[$5],[$6],[$7])
    11231238    AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    11241239  else
     
    11381253
    11391254# If we've located the package, define preprocessor symbol COIN_HAS_PRIM
    1140 # and augment the necessary variables for the client packages. We need the
    1141 # final ':' (noop) below because it's possible that PRIM is data-only and the
    1142 # list of client packages is empty.
     1255# and augment the necessary variables for the client packages.
    11431256
    11441257  if test $m4_tolower(coin_has_$1) = yes ; then
    11451258    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],
    11461259      [Define to 1 if the $1 package is available])
    1147     if test $pubpriv = private ; then
    1148       m4_foreach_w([myvar],[$2],
    1149         [m4_toupper(myvar)_LIBS="$m4_tolower($1_libs) $m4_toupper(myvar)_LIBS"
    1150          m4_toupper(myvar)_CFLAGS="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS"])
    1151       :
    1152     else
    1153       m4_foreach_w([myvar],[$2],
    1154         [m4_toupper(myvar)_LIBS_PUB="$m4_tolower($1_libs) $m4_toupper(myvar)_LIBS_PUB"
    1155          m4_toupper(myvar)_CFLAGS_PUB="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS_PUB"])
    1156       :
    1157     fi
     1260    m4_foreach_w([myvar],[$2],
     1261      [m4_toupper(myvar)_LFLAGS="$m4_tolower($1_lflags) $m4_toupper(myvar)_LFLAGS"
     1262       m4_toupper(myvar)_CFLAGS="$m4_tolower($1_cflags) $m4_toupper(myvar)_CFLAGS"])
    11581263
    11591264# Finally, set up PRIM_DATA, unless the user specified nodata.
    11601265
    1161     m4_if(m4_default([$8],nodata),nodata,[],
     1266    m4_if(m4_default([$7],nodata),nodata,[],
    11621267      [AC_SUBST(m4_toupper($1)_DATA)
    11631268       m4_toupper($1)_DATA=$m4_tolower($1_data)])
     
    11671272
    11681273#######################################################################
    1169 #                           COIN_CHECK_LIBM                           #
     1274#                           COIN_CHK_LIBM                           #
    11701275#######################################################################
    11711276
    1172 # COIN_CHECK_LIBM([client1 client2 ...])
     1277# COIN_CHK_LIBM([client1 client2 ...])
    11731278# Check if a library spec is needed for the math library. If something is
    1174 # needed, the macro adds the flags to CLIENT_LIBS for each client.
    1175 
    1176 AC_DEFUN([AC_COIN_CHECK_LIBM],
     1279# needed, the macro adds the flags to CLIENT_LFLAGS for each client.
     1280
     1281AC_DEFUN([AC_COIN_CHK_LIBM],
    11771282[
    11781283  AC_REQUIRE([AC_PROG_CC])
     
    11831288    [if test "$ac_cv_search_cos" != 'none required' ; then
    11841289       m4_foreach_w([myvar],[$1],
    1185          [m4_toupper(myvar)_LIBS="$ac_cv_search_cos $m4_toupper(myvar)_LIBS"])
     1290         [m4_toupper(myvar)_LFLAGS="$ac_cv_search_cos $m4_toupper(myvar)_LFLAGS"])
    11861291     fi])
    11871292  LIBS="$coin_save_LIBS"
    1188 ]) # AC_COIN_CHECK_LIBM
    1189 
    1190 ###########################################################################
    1191 #                           COIN_CHECK_ZLIB                               #
    1192 ###########################################################################
    1193 
    1194 # COIN_CHECK_ZLIB([client1 client2 ...])
     1293]) # AC_COIN_CHK_LIBM
     1294
     1295###########################################################################
     1296#                           COIN_CHK_ZLIB                               #
     1297###########################################################################
     1298
     1299# COIN_CHK_ZLIB([client1 client2 ...])
    11951300
    11961301# This macro checks for the libz library.  If found, it sets the automake
    11971302# conditional COIN_HAS_ZLIB and defines the C preprocessor variable
    1198 # COIN_HAS_ZLIB. The default is to use zlib, if it's present.  For each
    1199 # client, it adds the linker flags to the variable CLIENT_LIBS.
    1200 
    1201 AC_DEFUN([AC_COIN_CHECK_ZLIB],
     1303# COIN_HAS_ZLIB. The default is to use zlib, if it's present.  For each client,
     1304# it adds the linker flags to the variable CLIENT_LFLAGS for each client.
     1305
     1306AC_DEFUN([AC_COIN_CHK_ZLIB],
    12021307[
    12031308  AC_REQUIRE([AC_COIN_PROG_CC])
     
    12181323    if test x$coin_has_zlib = xyes ; then
    12191324      m4_foreach_w([myvar],[$1],
    1220         [m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"])
     1325        [m4_toupper(myvar)_LFLAGS="-lz $m4_toupper(myvar)_LFLAGS"])
    12211326      AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
    12221327    fi
     
    12241329
    12251330  AM_CONDITIONAL([COIN_HAS_ZLIB],[test x$coin_has_zlib = xyes])
    1226 ]) # AC_COIN_CHECK_ZLIB
    1227 
    1228 
    1229 ###########################################################################
    1230 #                            COIN_CHECK_BZLIB                             #
    1231 ###########################################################################
    1232 
    1233 # COIN_CHECK_BZLIB([client1 client2 ...])
     1331]) # AC_COIN_CHK_ZLIB
     1332
     1333
     1334###########################################################################
     1335#                            COIN_CHK_BZLIB                             #
     1336###########################################################################
     1337
     1338# COIN_CHK_BZLIB([client1 client2 ...])
    12341339
    12351340# This macro checks for the libbz2 library.  If found, it defines the
    12361341# C preprocessor variable COIN_HAS_BZLIB and the automake conditional
    12371342# COIN_HAS_BZLIB.  Further, for a (space separated) list of clients, it adds
    1238 # the linker flag to the variable CLIENT_LIBS.
    1239 
    1240 AC_DEFUN([AC_COIN_CHECK_BZLIB],
     1343# the linker flag to the variable CLIENT_LFLAGS for each client.
     1344
     1345AC_DEFUN([AC_COIN_CHK_BZLIB],
    12411346[
    12421347  AC_REQUIRE([AC_PROG_CC])
     
    12571362    if test $coin_has_bzlib = yes ; then
    12581363      m4_foreach_w([myvar],[$1],
    1259         [m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"])
     1364        [m4_toupper(myvar)_LFLAGS="-lbz2 $m4_toupper(myvar)_LFLAGS"])
    12601365      AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
    12611366    fi
     
    12631368
    12641369  AM_CONDITIONAL([COIN_HAS_BZLIB],[test x$coin_has_bzlib = xyes])
    1265 ]) # AC_COIN_CHECK_BZLIB
    1266 
    1267 
    1268 ###########################################################################
    1269 #                              COIN_CHECK_GMP                             #
    1270 ###########################################################################
    1271 
    1272 # COIN_CHECK_GMP([client1 client2 ...])
     1370]) # AC_COIN_CHK_BZLIB
     1371
     1372
     1373###########################################################################
     1374#                              COIN_CHK_GMP                             #
     1375###########################################################################
     1376
     1377# COIN_CHK_GMP([client1 client2 ...])
    12731378
    12741379# This macro checks for the gmp library.  If found, it defines the C
    12751380# preprocessor variable COIN_HAS_GMP and the automake conditional COIN_HAS_GMP.
    12761381# Further, for a (space separated) list of clients, it adds the linker
    1277 # flag to the variable CLIENT_LIBS.
    1278 
    1279 AC_DEFUN([AC_COIN_CHECK_GMP],
     1382# flag to the variable CLIENT_LFLAGS for each client.
     1383
     1384AC_DEFUN([AC_COIN_CHK_GMP],
    12801385[
    12811386  AC_REQUIRE([AC_PROG_CC])
     
    12941399    if test $coin_has_gmp = yes ; then
    12951400      m4_foreach_w([myvar],[$1],
    1296         [m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS"])
     1401        [m4_toupper(myvar)_LFLAGS="-lgmp $m4_toupper(myvar)_LFLAGS"])
    12971402      AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available])
    12981403    fi
     
    13001405
    13011406  AM_CONDITIONAL([COIN_HAS_GMP],[test x$coin_has_gmp = xyes])
    1302 ]) # AC_COIN_CHECK_GMP
    1303 
    1304 
    1305 ###########################################################################
    1306 #                         COIN_CHECK_GNU_READLINE                         #
    1307 ###########################################################################
    1308 
    1309 # COIN_CHECK_GNU_READLINE([client1 client2 ...])
     1407]) # AC_COIN_CHK_GMP
     1408
     1409
     1410###########################################################################
     1411#                         COIN_CHK_GNU_READLINE                         #
     1412###########################################################################
     1413
     1414# COIN_CHK_GNU_READLINE([client1 client2 ...])
    13101415
    13111416# This macro checks for GNU's readline.  It verifies that the header
     
    13141419# file before the #include<readline/readline.h> If found, it defines the C
    13151420# preprocessor variable COIN_HAS_READLINE.  Further, for a (space separated)
    1316 # list of clients, it adds the linker flag to the variable CLIENT_LIBS.
    1317 
    1318 AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
     1421# list of clients, it adds the linker flag to the variable CLIENT_LFLAGS for
     1422# each client.
     1423
     1424AC_DEFUN([AC_COIN_CHK_GNU_READLINE],
    13191425[
    13201426  AC_REQUIRE([AC_PROG_CC])
     
    13421448    if test $coin_has_readline = yes ; then
    13431449      m4_foreach_w([myvar],[$1],
    1344         [m4_toupper(myvar)_LIBS="-lreadline $m4_toupper(myvar)_LIBS"])
     1450        [m4_toupper(myvar)_LFLAGS="-lreadline $m4_toupper(myvar)_LFLAGS"])
    13451451      AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
    13461452    fi
     
    13491455
    13501456  AM_CONDITIONAL([COIN_HAS_READLINE],[test x$coin_has_readline = xyes])
    1351 ]) # AC_COIN_CHECK_GNU_READLINE
     1457]) # AC_COIN_CHK_GNU_READLINE
    13521458
    13531459###########################################################################
     
    14821588###########################################################################
    14831589
    1484 # COIN_FINALIZE_FLAGS([client1 client2 ...])
    1485 
    1486 # For each client, accumulate the necessary flags in CLIENT_LIBS and
    1487 # CLIENT_CFLAGS.  The algorithm accumulates the flags for the packages
    1488 # in CLIENT_PCFILES and tacks on the current value of CLIENT_LIBS and
    1489 # CLIENT_CFLAGS.
     1590# COIN_FINALIZE_FLAGS([prim1 prim2 ...])
     1591
     1592# For each PRIM, produce final versions of variables specifying linker and
     1593# compiler flags.  PRIM_LFLAGS_NOPC and PRIM_CFLAGS_NOPC are appropriate for
     1594# use in .pc files together with PRIM_PCFILES. PRIM_LFLAGS and PRIM_CFLAGS
     1595# are augmented to contain flags obtained by invoking PKG_CONFIG on packages
     1596# listed in PRIM_PCFILES and are appropriate for use in Makefile.am files.
    14901597
    14911598# TODO this could be moved into COIN_FINALIZE, if we were able to remember
     
    14951602[
    14961603  m4_foreach_w([myvar],[$1],
    1497     [if test -n "${m4_toupper(myvar)_PCFILES}" ; then
    1498        temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${m4_toupper(myvar)_PCFILES}`
    1499        temp_LIBS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${m4_toupper(myvar)_PCFILES}`
    1500        m4_toupper(myvar)_CFLAGS="$temp_CFLAGS ${m4_toupper(myvar)_CFLAGS}"
    1501        m4_toupper(myvar)_LIBS="$temp_LIBS ${m4_toupper(myvar)_LIBS}"
    1502      fi
     1604    [ if test 1 = 1 ; then
     1605        AC_MSG_NOTICE([FINALIZE_FLAGS for myvar:])
     1606      fi
     1607      AC_SUBST(m4_toupper(myvar)_LFLAGS_NOPC,[$m4_toupper(myvar)_LFLAGS])
     1608      AC_SUBST(m4_toupper(myvar)_CFLAGS_NOPC,[$m4_toupper(myvar)_CFLAGS])
     1609      if test -n "${m4_toupper(myvar)_PCFILES}" ; then
     1610        temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${m4_toupper(myvar)_PCFILES}`
     1611        temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${m4_toupper(myvar)_PCFILES}`
     1612        m4_toupper(myvar)_CFLAGS="$temp_CFLAGS ${m4_toupper(myvar)_CFLAGS}"
     1613        m4_toupper(myvar)_LFLAGS="$temp_LFLAGS ${m4_toupper(myvar)_LFLAGS}"
     1614      fi
    15031615
    15041616# Change the test to enable / disable debugging output
    15051617
    1506      if test 1 = 1 ; then
    1507        AC_MSG_NOTICE(
    1508          [FINALIZE_FLAGS for myvar: adding "${m4_toupper(myvar)_PCFILES}"])
    1509        AC_MSG_NOTICE([m4_toupper(myvar)_LIBS is "${m4_toupper(myvar)_LIBS}"])
    1510        AC_MSG_NOTICE([m4_toupper(myvar)_CFLAGS is "${m4_toupper(myvar)_CFLAGS}"])
    1511      fi ; ])
     1618      if test 1 = 1 ; then
     1619        AC_MSG_NOTICE(
     1620          [m4_toupper(myvar)_LFLAGS_NOPC: "${m4_toupper(myvar)_LFLAGS_NOPC}"])
     1621        AC_MSG_NOTICE(
     1622          [m4_toupper(myvar)_CFLAGS_NOPC: "${m4_toupper(myvar)_CFLAGS_NOPC}"])
     1623        AC_MSG_NOTICE([adding "${m4_toupper(myvar)_PCFILES}"])
     1624        AC_MSG_NOTICE([m4_toupper(myvar)_LFLAGS: "${m4_toupper(myvar)_LFLAGS}"])
     1625        AC_MSG_NOTICE([m4_toupper(myvar)_CFLAGS: "${m4_toupper(myvar)_CFLAGS}"])
     1626      fi ; ])
    15121627])
    15131628
  • trunk/coin_fortran.m4

    r3809 r3848  
    308308
    309309###########################################################################
    310 #                         COIN_CHK_PKG_BLAS                               #
    311 ###########################################################################
    312 
    313 # COIN_CHK_PKG_BLAS([client packages],[public],[nolinkcheck])
     310#                         COIN_CHK_BLAS                                   #
     311###########################################################################
     312
     313# COIN_CHK_BLAS([client packages],[nolinkcheck])
    314314
    315315# This macro checks for a BLAS library and adds the information necessary to
    316 # use it to the _LIBS, _CFLAGS, and _PCFILES variables of the client packages
     316# use it to the _LFLAGS, _CFLAGS, and _PCFILES variables of the client packages
    317317# passed as a space-separated list in parameter $1. These correspond to
    318318# Libs.private, Cflags.private, and Requires.private, respectively, in a .pc
    319 # file. To add to the public variables, specify 'public' as $2.
     319# file.
    320320
    321321# The algorithm first invokes FIND_PRIM_PKG. The parameters --with-blas,
    322 # --with-blas-libs, and --with-blas-cflags are interpreted there. If nothing
     322# --with-blas-lflags, and --with-blas-cflags are interpreted there. If nothing
    323323# is found, default locations are checked.
    324324
    325325# When checking default locations, the macro uses a link check because it's
    326 # the easiest way to decide if a guess is correct. But a link check is always
    327 # a good idea just in case FLIBS (Fortran intrinsic & runtime libraries) is
    328 # also necessary. You can suppress the link check for a library spec given on
    329 # the command line or obtained via a .pc file by adding `nolinkcheck' as $3.
    330 
    331 AC_DEFUN([AC_COIN_CHK_PKG_BLAS],
     326# really the only way to decide if a guess is correct. But a link check is
     327# always a good idea just in case FLIBS (Fortran intrinsic & runtime libraries)
     328# is also necessary. You can suppress the link check for a library spec given
     329# on the command line or obtained via a .pc file by adding `nolinkcheck' as $2.
     330
     331AC_DEFUN([AC_COIN_CHK_BLAS],
    332332[
    333333  AC_REQUIRE([AC_COIN_PROG_F77])
     
    337337# Make sure the necessary variables exist for each client package.
    338338
    339   pubpriv=m4_default([$2],[private])
    340339  m4_foreach_w([myvar],[$1],
    341     [AC_SUBST(m4_toupper(myvar)_LIBS)
     340    [AC_SUBST(m4_toupper(myvar)_LFLAGS)
    342341     AC_SUBST(m4_toupper(myvar)_CFLAGS)
    343      AC_SUBST(m4_toupper(myvar)_PCFILES)
    344      AC_SUBST(m4_toupper(myvar)_LIBS_PUB)
    345      AC_SUBST(m4_toupper(myvar)_CFLAGS_PUB)
    346      AC_SUBST(m4_toupper(myvar)_PCFILES_PUB)])
     342     AC_SUBST(m4_toupper(myvar)_PCFILES)])
    347343
    348344# Set up command line arguments with DEF_PRIM_ARGS and give FIND_PRIM_PKG
    349 # a chance. The result (coin_has_blas) will be one of yes (either the user
    350 # specified something or pkgconfig found something), no (user specified nothing
    351 # and pkgconfig found nothing) or skipping (user said do not use). We'll
    352 # also have variables blas_libs, blas_cflags, blas_data, and blas_pcfiles.
     345# a chance, just in case blas.pc exists. The result (coin_has_blas) will
     346# be one of yes (either the user specified something or pkgconfig found
     347# something), no (user specified nothing and pkgconfig found nothing) or
     348# skipping (user said do not use). We'll also have variables blas_lflags,
     349# blas_cflags, blas_data, and blas_pcfiles.
    353350
    354351  AC_COIN_DEF_PRIM_ARGS([blas],yes,yes,yes,no)
     
    361358    m4_if([$2],[nolinkcheck],[:],
    362359      [use_blas=
    363        AC_COIN_CHK_PKG_FLINK([use_blas],[daxpy],[$blas_libs])
     360       AC_COIN_CHK_PKG_FLINK([use_blas],[daxpy],[$blas_lflags])
    364361       if test -n "$use_blas" ; then
    365          blas_libs=$use_blas
     362         blas_lflags=$use_blas
    366363       else
    367          AC_MSG_WARN([BLAS failed to link with "$blas_libs"])
     364         AC_MSG_WARN([BLAS failed to link with "$blas_lflags"])
    368365       fi])
    369366
     
    377374      *-sgi-*)
    378375        AC_MSG_CHECKING([for BLAS in -lcomplib.sgimath])
    379         AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],[-lcomplib.sgimath])
     376        AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],[-lcomplib.sgimath])
    380377        ;;
    381378
     
    389386        # can arrange that explicitly.
    390387        AC_MSG_CHECKING([for BLAS in -lsunperf])
    391         AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],[-lsunperf])
     388        AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],[-lsunperf])
    392389        ;;
    393390       
     
    397394          cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
    398395            AC_MSG_CHECKING([for BLAS in MKL (32bit)])
    399             AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],
     396            AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],
    400397              [mkl_intel_c.lib mkl_sequential.lib mkl_core.lib])
    401             if test -z "$blas_libs" ; then
     398            if test -z "$blas_lflags" ; then
    402399              AC_MSG_CHECKING([for BLAS in MKL (64bit)])
    403               AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],
     400              AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],
    404401                [mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib])
    405402            fi
     
    410407       *-darwin*)
    411408        AC_MSG_CHECKING([for BLAS in Veclib])
    412         AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],[-framework Accelerate])
     409        AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],[-framework Accelerate])
    413410        ;;
    414411    esac
    415     if test -z "$blas_libs" ; then
    416       AC_MSG_CHECKING([whether -lblas has BLAS])
    417       AC_COIN_CHK_PKG_FLINK([blas_libs],[daxpy],[-lblas])
     412    if test -z "$blas_lflags" ; then
     413      AC_MSG_CHECKING([for BLAS in -lblas])
     414      AC_COIN_CHK_PKG_FLINK([blas_lflags],[daxpy],[-lblas])
    418415    fi
    419     if test -n "$blas_libs" ; then
     416    if test -n "$blas_lflags" ; then
    420417      coin_has_blas=yes
    421418    fi
     
    432429  if test $coin_has_blas = yes ; then
    433430    AC_DEFINE(m4_toupper(COIN_HAS_BLAS),[1],
    434       [Define to 1 if the BLAS package is available])
    435     if test $pubpriv = private ; then
    436       m4_foreach_w([myvar],[$1],
    437         [m4_toupper(myvar)_PCFILES="$blas_pcfiles $m4_toupper(myvar)_PCFILES"
    438          m4_toupper(myvar)_LIBS="$blas_libs $m4_toupper(myvar)_LIBS"
    439          m4_toupper(myvar)_CFLAGS="$blas_cflags $m4_toupper(myvar)_CFLAGS"])
    440     else
    441       m4_foreach_w([myvar],[$1],
    442         [m4_toupper(myvar)_PCFILES_PUB="$blas_pcfiles $m4_toupper(myvar)_PCFILES"_PUB
    443          m4_toupper(myvar)_LIBS_PUB="$blas_libs $m4_toupper(myvar)_LIBS_PUB"
    444          m4_toupper(myvar)_CFLAGS_PUB="$blas_cflags $m4_toupper(myvar)_CFLAGS_PUB"])
    445     fi
     431      [Define to 1 if BLAS is available.])
     432    m4_foreach_w([myvar],[$1],
     433      [m4_toupper(myvar)_PCFILES="$blas_pcfiles $m4_toupper(myvar)_PCFILES"
     434       m4_toupper(myvar)_LFLAGS="$blas_lflags $m4_toupper(myvar)_LFLAGS"
     435       m4_toupper(myvar)_CFLAGS="$blas_cflags $m4_toupper(myvar)_CFLAGS"])
    446436  else
    447437    AC_MSG_RESULT([$coin_has_blas])
    448438  fi
    449439
    450 ]) # AC_COIN_CHK_PKG_BLAS
    451 
    452 
    453 ###########################################################################
    454 #                       COIN_CHK_PKG_LAPACK                               #
    455 ###########################################################################
    456 
    457 # COIN_CHK_PKG_LAPACK([client packages],[public],[nolinkcheck])
     440]) # AC_COIN_CHK_BLAS
     441
     442
     443###########################################################################
     444#                       COIN_CHK_LAPACK                                   #
     445###########################################################################
     446
     447# COIN_CHK_LAPACK([client packages],[nolinkcheck])
    458448
    459449# This macro checks for a LAPACK library and adds the information necessary to
    460 # use it to the _LIBS, _CFLAGS, and _PCFILES variables of the client packages
     450# use it to the _LFLAGS, _CFLAGS, and _PCFILES variables of the client packages
    461451# passed as a space-separated list in parameter $1. These correspond to
    462452# Libs.private, Cflags.private, and Requires.private, respectively, in a .pc
    463 # file. To add to the public variables, specify 'public' as $2.
     453# file.
    464454
    465455# The algorithm first invokes FIND_PRIM_PKG. The parameters --with-lapack,
    466 # --with-lapack-libs, and --with-lapack-cflags are interpreted there. If
     456# --with-lapack-lflags, and --with-lapack-cflags are interpreted there. If
    467457# nothing is found, default locations are checked.
    468458
    469459# When checking default locations, the macro uses a link check because it's
    470 # the easiest way to decide if a guess is correct. But a link check is always
    471 # a good idea just in case FLIBS (Fortran intrinsic & runtime libraries) is
    472 # also necessary. You can suppress the link check for a library spec given on
    473 # the command line or obtained via a .pc file by adding `nolinkcheck' as $3.
    474 
    475 AC_DEFUN([AC_COIN_CHK_PKG_LAPACK],
     460# really the only way to decide if a guess is correct. But a link check is
     461# always a good idea just in case FLIBS (Fortran intrinsic & runtime libraries)
     462# is also necessary. You can suppress the link check for a library spec given
     463# on the command line or obtained via a .pc file by adding `nolinkcheck' as $2.
     464
     465AC_DEFUN([AC_COIN_CHK_LAPACK],
    476466[
    477467  AC_REQUIRE([AC_COIN_PROG_F77])
     
    481471# Make sure the necessary variables exist for each client package.
    482472
    483   pubpriv=m4_default([$2],[private])
    484473  m4_foreach_w([myvar],[$1],
    485474    [AC_SUBST(m4_toupper(myvar)_LIBS)
    486475     AC_SUBST(m4_toupper(myvar)_CFLAGS)
    487      AC_SUBST(m4_toupper(myvar)_PCFILES)
    488      AC_SUBST(m4_toupper(myvar)_LIBS_PUB)
    489      AC_SUBST(m4_toupper(myvar)_CFLAGS_PUB)
    490      AC_SUBST(m4_toupper(myvar)_PCFILES_PUB)])
     476     AC_SUBST(m4_toupper(myvar)_PCFILES)])
    491477
    492478# Set up command line arguments with DEF_PRIM_ARGS and give FIND_PRIM_PKG
    493 # a chance. The result (coin_has_blas) will be one of yes (either the user
    494 # specified something or pkgconfig found something), no (user specified nothing
    495 # and pkgconfig found nothing) or skipping (user said do not use). We'll
    496 # also have variables blas_libs, blas_cflags, blas_data, and blas_pcfiles.
     479# a chance, just in case lapack.pc exists. The result (coin_has_lapack)
     480# will be one of yes (either the user specified something or pkgconfig
     481# found something), no (user specified nothing and pkgconfig found nothing)
     482# or skipping (user said do not use). We'll also have variables lapack_lflags,
     483# lapack_cflags, lapack_data, and lapack_pcfiles.
    497484
    498485  AC_COIN_DEF_PRIM_ARGS([lapack],yes,yes,yes,no)
     
    500487
    501488# If FIND_PRIM_PKG found something and the user wants a link check, do it. For
    502 # a successful link check, update lapack_libs just in case FLIBS was added.
     489# a successful link check, update lapack_lflags just in case FLIBS was added.
    503490
    504491  if test "$coin_has_lapack" = yes ; then
    505492    m4_if([$2],[nolinkcheck],[:],
    506493      [use_lapack=
    507        AC_COIN_CHK_PKG_FLINK([use_lapack],[daxpy],[$lapack_libs])
     494       AC_COIN_CHK_PKG_FLINK([use_lapack],[daxpy],[$lapack_lflags])
    508495       if test -n "$use_lapack" ; then
    509          lapack_libs=$use_lapack
     496         lapack_lflags=$use_lapack
    510497       else
    511          AC_MSG_WARN([LAPACK failed to link with "$lapack_libs"])
     498         AC_MSG_WARN([LAPACK failed to link with "$lapack_lflags"])
    512499       fi])
    513500
    514 # If FIND_PRIM_PKG didn't find anything, try a few guesses. First, check if
    515 # the library for BLAS already includes LAPACK. Then try some specialised
    516 # checks based on the host system type first.  If none of them are applicable,
    517 # or the applicable one fails, try the generic -llapack.
     501# If FIND_PRIM_PKG didn't find anything, try a few guesses. First, try some
     502# specialised checks based on the host system type. If none of them are
     503# applicable, or the applicable one fails, try the generic -llapack.
    518504
    519505  elif test "$coin_has_lapack" = no ; then
    520506    AC_MSG_RESULT([nothing yet])
    521     if test x"$coin_has_blas" = xyes ; then
    522       AC_MSG_CHECKING([whether LAPACK is available in the BLAS library])
    523       AC_COIN_CHK_PKG_FLINK([lapack_libs],[dsyev],[$BLAS_LIBS])
     507    case $build in
     508      *-sgi-*)
     509        AC_MSG_CHECKING([for LAPACK in -lcomplib.sgimath])
     510        AC_COIN_CHK_PKG_FLINK([lapack_lflags],[dsyev],[-lcomplib.sgimath])
     511        ;;
     512
     513      *-*-solaris*)
     514        # See comments in COIN_CHK_PKG_BLAS.
     515        AC_MSG_CHECKING([for LAPACK in -lsunperf])
     516        AC_COIN_CHK_PKG_FLINK([lapack_lflags],[dsyev],[-lsunperf])
     517        ;;
     518
     519        # On cygwin, do this check only if doscompile is disabled. The
     520        # prebuilt library will want to link with cygwin, hence won't run
     521        # standalone in DOS.
     522
     523    esac
     524    if test -z "$lapack_lflags" ; then
     525      AC_MSG_CHECKING([for LAPACK in -llapack])
     526      AC_COIN_CHK_PKG_FLINK([lapack_lflags],[dsyev],[-llapack])
    524527    fi
    525 
    526 # 171116 (lh) Note that the libraries tested for SGI and Solaris are the same
    527 # ones we tested for BLAS. Since LAPACK needs BLAS, we should have already
    528 # performed those tests, hence the tests here are repetitive. I've left them
    529 # in on the sole justification that rechecking is robust against changes in
    530 # library content.
    531 
    532     if test -z "$lapack_libs" ; then
    533       case $build in
    534         *-sgi-*)
    535           AC_MSG_CHECKING([for LAPACK in -lcomplib.sgimath])
    536           AC_COIN_CHK_PKG_FLINK([lapack_libs],[dsyev],[-lcomplib.sgimath])
    537           ;;
    538 
    539         *-*-solaris*)
    540           # See comments in COIN_CHK_PKG_BLAS.
    541           AC_MSG_CHECKING([for LAPACK in -lsunperf])
    542           AC_COIN_CHK_PKG_FLINK([lapack_libs],[dsyev],[-lsunperf])
    543           ;;
    544 
    545           # On cygwin, do this check only if doscompile is disabled. The
    546           # prebuilt library will want to link with cygwin, hence won't run
    547           # standalone in DOS.
    548 
    549       esac
    550     fi
    551     if test -z "$lapack_libs" ; then
    552       AC_MSG_CHECKING([whether -llapack has LAPACK])
    553       AC_COIN_CHK_PKG_FLINK([lapack_libs],[dsyev],[-llapack])
    554     fi
    555     if test -n "$lapack_libs" ; then
     528    if test -n "$lapack_lflags" ; then
    556529      coin_has_lapack=yes
    557530    fi
     
    569542    AC_DEFINE(m4_toupper(COIN_HAS_LAPACK),[1],
    570543      [Define to 1 if the LAPACK package is available])
    571     if test $pubpriv = private ; then
    572       m4_foreach_w([myvar],[$1],
    573         [m4_toupper(myvar)_PCFILES="$lapack_pcfiles $m4_toupper(myvar)_PCFILES"
    574          m4_toupper(myvar)_LIBS="$lapack_libs $m4_toupper(myvar)_LIBS"
    575          m4_toupper(myvar)_CFLAGS="$lapack_cflags $m4_toupper(myvar)_CFLAGS"])
    576     else
    577       m4_foreach_w([myvar],[$1],
    578         [m4_toupper(myvar)_PCFILES_PUB="$lapack_pcfiles $m4_toupper(myvar)_PCFILES"_PUB
    579          m4_toupper(myvar)_LIBS_PUB="$lapack_libs $m4_toupper(myvar)_LIBS_PUB"
    580          m4_toupper(myvar)_CFLAGS_PUB="$lapack_cflags $m4_toupper(myvar)_CFLAGS_PUB"])
    581     fi
     544    m4_foreach_w([myvar],[$1],
     545      [m4_toupper(myvar)_PCFILES="$lapack_pcfiles $m4_toupper(myvar)_PCFILES"
     546       m4_toupper(myvar)_LFLAGS="$lapack_lflags $m4_toupper(myvar)_LFLAGS"
     547       m4_toupper(myvar)_CFLAGS="$lapack_cflags $m4_toupper(myvar)_CFLAGS"])
    582548  else
    583549    AC_MSG_RESULT([$coin_has_lapack])
    584550  fi
    585551
    586 ]) # AC_COIN_CHK_PKG_LAPACK
    587 
     552]) # AC_COIN_CHK_LAPACK
     553
Note: See TracChangeset for help on using the changeset viewer.