Changeset 3854


Ignore:
Timestamp:
Oct 12, 2018 10:29:12 PM (12 months ago)
Author:
lou
Message:

Add a link check to COIN_CHK_LIB.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r3852 r3854  
    964964
    965965# COIN_FIND_PRIM_LIB([prim],[lflgs],[cflgs],[dflgs],
     966#                    [func],[other libraries],
    966967#                    [dfltaction],[cmdlineopts])
    967968
     
    969970# information on the required linker flags (prim_lflags), compiler flags
    970971# (prim_cflags), and data directories (prim_data) as specified by cmdlineopts.
    971 
    972 # cmdlineopts ($6) specifies the set of configure command line options
     972# Run a link check if the user provides [func]. Linker flags for the link are
     973# the concatenation of [lflgs] and [other libraries].
     974
     975# cmdlineopts ($8) specifies the set of configure command line options
    973976# defined and processed: 'nodata' produces --with-prim, --with-prim-lflags,
    974977# and --with-prim-cflags; 'dataonly' produces only --with-prim and
     
    9981001# parameters.
    9991002
    1000 # Default action ($5) (no, yes, build) is the default value of --with-prim
     1003# Default action ($7) (no, yes, build) is the default value of --with-prim
    10011004# if the user offers no guidance via command line parameters. The (hardwired)
    10021005# default is yes. `build' doesn't have a hope of working except for COIN
     
    10051008# file.
    10061009
    1007 # The macro doesn't test that the specified values actually work. This is
    1008 # deliberate --- there's no guarantee that the specified values actually
    1009 # exist just yet. Really all we're doing here is filling in variables using a
    1010 # complicated algorithm.
     1010# The macro doesn't test that the specified values actually work unless
     1011# [func] is given as a parameter. This is deliberate --- there's no guarantee
     1012# that the specified library can be accessed just yet with the specified
     1013# flags. Except for the link check, all we're doing here is filling in
     1014# variables using a complicated algorithm.
    10111015
    10121016AC_DEFUN([AC_COIN_FIND_PRIM_LIB],
    10131017[
    1014   dflt_action=m4_default([$5],[yes])
     1018  dflt_action=m4_default([$7],[yes])
    10151019
    10161020# Initialize variables for the primary library.
     
    10381042      * )
    10391043        m4_tolower(coin_has_$1)=yes
    1040         m4_if(m4_default($6,nodata),dataonly,
     1044        m4_if(m4_default($8,nodata),dataonly,
    10411045          [m4_tolower($1_data)=$withval],
    1042           [m4_tolower($1_libs)=$withval])
     1046          [m4_tolower($1_lflags)=$withval])
    10431047        ;;
    10441048    esac
     
    10491053# options for lflags and cflags.
    10501054
    1051   m4_if(m4_default($6,nodata),dataonly,[],
     1055  m4_if(m4_default($8,nodata),dataonly,[],
    10521056    [if test "$m4_tolower(coin_has_$1)" != skipping ; then
    10531057       withval=$m4_tolower(with_$1_lflags)
     
    10591063           * )
    10601064             m4_tolower(coin_has_$1)=yes
    1061              m4_tolower($1_libs)=$withval
     1065             m4_tolower($1_lflags)=$withval
    10621066             ;;
    10631067         esac
     
    10811085# Specifying --with-prim=no overrides the individual option for data.
    10821086
    1083   m4_if(m4_default($6,nodata),nodata,[],
     1087  m4_if(m4_default($8,nodata),nodata,[],
    10841088    [if test "$m4_tolower(coin_has_$1)" != skipping ; then
    10851089       withval=$m4_tolower(with_$1_data)
     
    11261130  case $m4_tolower(coin_has_$1) in
    11271131    build | requested)
    1128       m4_if(m4_default($6,nodata),dataonly,[],
     1132      m4_if(m4_default($8,nodata),dataonly,[],
    11291133        [m4_ifnblank([$2],
    11301134           [m4_tolower($1_lflags)=$2],
     
    11391143              m4_tolower($1_cflags)="-I\$(pkgincludedir)/ThirdParty"
    11401144            fi])])
    1141       m4_if(m4_default($6,nodata),nodata,[],
     1145      m4_if(m4_default($8,nodata),nodata,[],
    11421146        [m4_tolower($1_data)=m4_default([$3],
    11431147           [if test "$m4_tolower(coin_has_$1)" = build ; then
     
    11551159  esac
    11561160
    1157 # The final value of coin_has_prim will be yes or skipping.  Skipping means
    1158 # the user said `don't use.' Yes means we have something, from the user or
    1159 # macro parameters or invented. Note that we haven't run a useability test!
     1161# At this point, coin_has_prim is yes or skipping.  Time to run a link check,
     1162# if we have a function ($5). Use whatever we've collected for lflags, plus
     1163# other libraries ($6) as the other libraries parameter to AC_SEARCH_LIBS,
     1164# leaving the library parameter blank.
     1165
     1166  if test $m4_tolower(coin_has_$1) != skipping ; then
     1167    m4_ifnblank([$5],
     1168      [ac_save_LIBS=$LIBS
     1169       LIBS="$m4_tolower($1_lflags) $6"
     1170       AC_LINK_IFELSE(
     1171        [AC_LANG_PROGRAM(
     1172          [#ifdef __cplusplus
     1173             extern "C"
     1174           #endif
     1175           void $5();],
     1176          [$5()])],
     1177       [],
     1178       [m4_tolower(coin_has_$1)=no])
     1179       LIBS=$ac_save_LIBS],
     1180      [:])
     1181  fi
     1182
     1183# The final value of coin_has_prim will be yes, no, or skipping. No means that
     1184# the link check failed. Yes means that we passed the link check, or no link
     1185# check was performed. Skipping means the user said `don't use.'
    11601186
    11611187# Change the test to enable / disable debugging output
     
    11771203
    11781204# COIN_CHK_LIB([prim],[client packages],[lflgs],[cflgs],[dflgs],
     1205#              [func],[other libraries],
    11791206#              [dfltaction],[cmdopts])
    11801207
    11811208# Determine whether we can use primary library prim ($1) and assemble
    11821209# information on the required linker flags (prim_lflags), compiler flags
    1183 # (prim_cflags), and data directories (prim_data).
     1210# (prim_cflags), and data directories (prim_data). A link check will be
     1211# performed in COIN_FIND_PRIMN_LIB if [func] is specified, using link flags
     1212# formed by concatenating the values of [lflgs] and [other libraries].
    11841213
    11851214# The configure command line options offered to the user are controlled
    1186 # by cmdopts ($7). 'nodata' offers --with-prim, --with-prim-lflags, and
     1215# by cmdopts ($9). 'nodata' offers --with-prim, --with-prim-lflags, and
    11871216# --with-prim-cflags; 'dataonly' offers --with-prim and --with-prim-data;
    11881217# 'all' offers all four. DEF_PRIM_ARGS and FIND_PRIM_LIB are tailored
     
    11941223# any user-supplied value causes all macro parameters to be ignored.
    11951224
    1196 # Default action ($6) (no, yes, build) is the default action if the user
     1225# Default action ($8) (no, yes, build) is the default action if the user
    11971226# offers no guidance via command line parameters. Really, 'build' has no
    11981227# hope of working except for COIN ThirdParty packages. Don't use it for
     
    12111240# individual variables specifying the data directory for each primitive. Hence
    12121241# the macro defines PRIM_DATA for the primitive.
    1213 
    1214 # The macro doesn't test that the specified values actually work. This is
    1215 # deliberate.  There's no guarantee that user-specified libraries and/or
    1216 # directories actually exist yet. The same possibility exists for values
    1217 # returned when pkgconf checks the .pc file.
    12181242
    12191243AC_DEFUN([AC_COIN_CHK_LIB],
     
    12451269
    12461270  if test "$m4_tolower(coin_has_$1)" != skipping ; then
    1247     m4_case(m4_default($7,nodata),
     1271    m4_case(m4_default($9,nodata),
    12481272      nodata,[AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,no,$4)],
    12491273      dataonly,[AC_COIN_DEF_PRIM_ARGS([$1],yes,no,no,yes,$4)],
    12501274      [AC_COIN_DEF_PRIM_ARGS([$1],yes,yes,yes,yes,$4)])
    1251     AC_COIN_FIND_PRIM_LIB(m4_tolower($1),[$3],[$4],[$5],[$6],[$7])
     1275    AC_COIN_FIND_PRIM_LIB(m4_tolower($1),[$3],[$4],[$5],[$6],[$7],[$8],[$9])
    12521276    AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    12531277  else
     
    12551279  fi
    12561280
    1257 # Possibilities are `yes' or `skipping'. Normalise to `yes' or `no'.
     1281# Possibilities are `yes', `no', or `skipping'. Normalise to `yes' or `no'.
    12581282
    12591283  if test "$m4_tolower(coin_has_$1)" != yes ; then
     
    12791303# Finally, set up PRIM_DATA, unless the user specified nodata.
    12801304
    1281     m4_if(m4_default([$7],nodata),nodata,[],
     1305    m4_if(m4_default([$9],nodata),nodata,[],
    12821306      [AC_SUBST(m4_toupper($1)_DATA)
    12831307       m4_toupper($1)_DATA=$m4_tolower($1_data)])
Note: See TracChangeset for help on using the changeset viewer.