Changeset 11


Ignore:
Timestamp:
May 15, 2006 3:20:58 PM (14 years ago)
Author:
andreasw
Message:

added --enable-gnu-packages flag; third party solvers need to be provided with link flags

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makemain.inc

    r7 r11  
    5050        cd $(srcdir); svn update
    5151
    52 distclean-local: clean-externals-stamp
    53 
    54 clean-externals-stamp:
    55         rm -f .Externals-stamp
     52DISTCLEANFILES += .Externals-stamp
    5653
    5754EXTRA_DIST += Externals
  • trunk/coin.m4

    r10 r11  
    131131AC_DEFUN([AC_COIN_SRCDIR_INIT],
    132132[# Initialize the ADDLIBS variable (a number of library require -lm)
    133 ADDLIBS="-lm"
     133ADDLIBS="" #"-lm"
    134134AC_SUBST(ADDLIBS)
    135135
     
    10891089
    10901090###########################################################################
     1091#                       COIN_ENABLE_GNU_PACKAGES                          #
     1092###########################################################################
     1093
     1094# This macro defined the --enable-gnu-packages flag.  This can be used
     1095# to check if a user wants to compile GNU packges (such as readline or
     1096# zlib) into the executable.  By default, GNU packages are disabled.
     1097
     1098AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
     1099[AC_ARG_ENABLE([gnu-packages],
     1100               [AC_HELP_STRING([--enable-gnu-packages],
     1101                               [compile with GNU packages (disabled by default)])],
     1102               [coin_enable_gnu=$enableval],
     1103               [coin_enable_gnu=no])
     1104]) # AC_COIN_ENABLE_GNU_PACKAGES
     1105
     1106###########################################################################
    10911107#                             COIN_CHECK_ZLIB                             #
    10921108###########################################################################
     
    10951111
    10961112AC_DEFUN([AC_COIN_CHECK_ZLIB],
    1097 [AC_BEFORE([AC_COIN_PROG_CXX],[$0])
     1113[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
     1114AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    10981115AC_BEFORE([AC_COIN_PROG_CC],[$0])
    10991116AC_BEFORE([AC_COIN_PROG_F77],[$0])
    11001117AC_BEFORE([$0],[AC_COIN_FINISH])
    11011118
    1102 coin_has_zlib=no
    1103 AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
    1104 
    1105 if test $coin_has_zlib = yes; then
    1106   AC_CHECK_LIB([z],[gzopen],
    1107                [ADDLIBS="-lz $ADDLIBS"],
    1108                [coin_has_zlib=no])
    1109 fi
    1110 
    1111 if test $coin_has_zlib = yes; then
    1112   AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
     1119if test $coin_enable_gnu = yes; then
     1120  coin_has_zlib=no
     1121  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
     1122
     1123  if test $coin_has_zlib = yes; then
     1124    AC_CHECK_LIB([z],[gzopen],
     1125                 [ADDLIBS="-lz $ADDLIBS"],
     1126                 [coin_has_zlib=no])
     1127  fi
     1128
     1129  if test $coin_has_zlib = yes; then
     1130    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
     1131  fi
    11131132fi
    11141133]) # AC_COIN_CHECK_ZLIB
     
    11221141
    11231142AC_DEFUN([AC_COIN_CHECK_BZLIB],
    1124 [AC_BEFORE([AC_COIN_PROG_CXX],[$0])
     1143[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
     1144AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    11251145AC_BEFORE([AC_COIN_PROG_CC],[$0])
    11261146AC_BEFORE([AC_COIN_PROG_F77],[$0])
    11271147AC_BEFORE([$0],[AC_COIN_FINISH])
    11281148
    1129 coin_has_bzlib=no
    1130 AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
    1131 
    1132 if test $coin_has_bzlib = yes; then
    1133   AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
    1134                [ADDLIBS="-lbz2 $ADDLIBS"],
    1135                [coin_has_bzlib=no])
    1136 fi
    1137 
    1138 if test $coin_has_bzlib = yes; then
    1139   AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
     1149if test $coin_enable_gnu = yes; then
     1150  coin_has_bzlib=no
     1151  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
     1152
     1153  if test $coin_has_bzlib = yes; then
     1154    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
     1155                 [ADDLIBS="-lbz2 $ADDLIBS"],
     1156                 [coin_has_bzlib=no])
     1157  fi
     1158
     1159  if test $coin_has_bzlib = yes; then
     1160    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
     1161  fi
    11401162fi
    11411163]) # AC_COIN_CHECK_BZLIB
     
    11521174
    11531175AC_DEFUN([AC_COIN_CHECK_READLINE],
    1154 [AC_BEFORE([AC_COIN_PROG_CXX],[$0])
     1176[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
     1177AC_BEFORE([AC_COIN_PROG_CXX],[$0])
    11551178AC_BEFORE([AC_COIN_PROG_CC],[$0])
    11561179AC_BEFORE([AC_COIN_PROG_F77],[$0])
    11571180AC_BEFORE([$0],[AC_COIN_FINISH])
    11581181
    1159 coin_has_readline=no
    1160 AC_COIN_CHECK_HEADER([readline/readline.h],[coin_has_readline=yes],[],[#include <stdio.h>])
    1161 
    1162 coin_save_LIBS="$LIBS"
    1163 LIBS=
    1164 # First we check if tputs and friends are available
    1165 if test $coin_has_readline = yes; then
    1166   AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
     1182if test $coin_enable_gnu = yes; then
     1183  coin_has_readline=no
     1184  AC_COIN_CHECK_HEADER([readline/readline.h],
     1185                       [coin_has_readline=yes],[],
     1186                       [#include <stdio.h>])
     1187
     1188  coin_save_LIBS="$LIBS"
     1189  LIBS=
     1190  # First we check if tputs and friends are available
     1191  if test $coin_has_readline = yes; then
     1192    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
     1193                   [coin_has_readline=no])
     1194  fi
     1195
     1196  # Now we check for readline
     1197  if test $coin_has_readline = yes; then
     1198    AC_CHECK_LIB([readline],[readline],
     1199                 [ADDLIBS="-lreadline $LIBS $ADDLIBS"],
    11671200                 [coin_has_readline=no])
    1168 fi
    1169 
    1170 # Now we check for readline
    1171 if test $coin_has_readline = yes; then
    1172   AC_CHECK_LIB([readline],[readline],
    1173                [ADDLIBS="-lreadline $LIBS $ADDLIBS"],
    1174                [coin_has_readline=no])
    1175 fi
    1176 
    1177 if test $coin_has_readline = yes; then
    1178   AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
    1179 fi
    1180 
    1181 LIBS="$coin_save_LIBS"
     1201  fi
     1202
     1203  if test $coin_has_readline = yes; then
     1204    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
     1205  fi
     1206
     1207  LIBS="$coin_save_LIBS"
     1208fi
    11821209]) # AC_COIN_CHECK_READLINE
    11831210
     
    12891316
    12901317# This macro sets up usage of a library with header files.  It defines
    1291 # the LIBINCDIR variable, and it defines COIN_HAS_LBRY preprocessor
     1318# the LBRYINCDIR variable, and it defines COIN_HAS_LBRY preprocessor
    12921319# macro and makefile conditional.  The first argument should be the
    12931320# full name (LibraryName) of the library, and the second argument (in
    12941321# upper case letters) the abbreviation (LBRY).  This macro also
    12951322# introduces the configure arguments --with-libraryname-incdir and
    1296 # --with-libraryname-libdir which have to be both given by a user to
    1297 # use this solver to tell the configure script where the include files
    1298 # and the library are located.  Those arguments can also be given as
    1299 # environement variables LBRYINCDIR and LBRYLIBDIR, but a --with-*
    1300 # argument overwrites an environment variable.  The third argument
    1301 # indicates the name of the library, as the string after '-l' (e.g.,
    1302 # 'glpk' for -lglpk).  If a forth argument is given, it is assume that
    1303 # this is the name of a header file that can be checked for in the
    1304 # given include directory, and if a fifth argument is given, it is
    1305 # assumed to be the name of a C function which is given and defined in
    1306 # the library, and a test is done to check if that symbol is defined
    1307 # in the library.
     1323# --with-libraryname-lib which have to be both given by a user to use
     1324# this solver to tell the configure script where the include files and
     1325# the library are located.  Those arguments can also be given as
     1326# environement variables LBRYINCDIR and LBRYLIB, but a --with-*
     1327# argument overwrites an environment variable.  If a third argument is
     1328# given, it is assumed that this is the name of a header file that can
     1329# be checked for in the given include directory, and if a fourth
     1330# argument is given, it is assumed to be the name of a C function
     1331# which is given and defined in the library, and a test is done to
     1332# check if that symbol is defined in the library.
    13081333
    13091334AC_DEFUN([AC_COIN_HAS_USER_LIBRARY],
     
    13171342                           [$2INCDIR=`cd $withval; pwd`])
    13181343# Check for library directory
    1319 AC_ARG_WITH(m4_tolower($1)-libdir,
    1320             AC_HELP_STRING([--with-m4_tolower($1)-libdir],
    1321                            [specify the directory with the library $1]),
    1322                            [$2LIBDIR=`cd $withval; pwd`])
    1323 
    1324 if test x"$$2INCDIR" != x || test x"$$2LIBDIR" != x; then
     1344AC_ARG_WITH(m4_tolower($1)-lib,
     1345            AC_HELP_STRING([--with-m4_tolower($1)-lib],
     1346                           [specify the flags to link with the library $1]),
     1347                           [$2LIB=$withval])
     1348
     1349if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
    13251350  m4_tolower(coin_has_$2)=true
    13261351else
     
    13301355if test $m4_tolower(coin_has_$2) = true; then
    13311356# Check either both arguments or none are given
    1332   if test x"$$2INCDIR" = x || test x"$$2LIBDIR" = x; then
    1333     AC_MSG_ERROR([You need to specify both --with-m4_tolower($1)-incdir and --with-m4_tolower($1)-libdir if you want to use library $1])
     1357  if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
     1358    AC_MSG_ERROR([You need to specify both --with-m4_tolower($1)-incdir and --with-m4_tolower($1)-lib if you want to use library $1])
    13341359  fi
    13351360  AC_MSG_RESULT(yes)
    13361361  # Check if the given header file is there
    1337   m4_ifvaln([$4],[AC_CHECK_FILE([$$2INCDIR/$4],[],
    1338                  [AC_MSG_ERROR([Cannot find file $4 in $$2INCDIR])])])
     1362  m4_ifvaln([$3],[AC_CHECK_FILE([$$2INCDIR/$3],[],
     1363                 [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
    13391364  # Check if the symbol is provided in the library
    1340   m4_ifvaln([$5],[coin_save_LIBS="$LIBS"
    1341                   LIBS="-L$$2LIBDIR -l$3 $ADDLIBS"
    1342                   AC_CHECK_LIB([$3],[$5],[:],
    1343                                [AC_MSG_ERROR([Cannot find symbol $5 in library -l$3])])
     1365  # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
     1366  m4_ifvaln([$4],[coin_save_LIBS="$LIBS"
     1367                  LIBS="$$2LIB $ADDLIBS"
     1368                  AC_MSG_CHECKING([whether symbol $4 is available with $2])
     1369                  AC_TRY_LINK([extern "C" {void $4();}],[$4()],
     1370                              [AC_MSG_RESULT(yes)],
     1371                              [AC_MSG_RESULT(no)
     1372                               AC_MSG_ERROR([Cannot find symbol $4 with $2])])
    13441373                  LIBS="$coin_save_LIBS"])
    1345   ADDLIBS="-L$$2LIBDIR -l$3 $ADDLIBS"
     1374  ADDLIBS="$$2LIB $ADDLIBS"
    13461375  AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is used])
    13471376else
     
    13501379
    13511380AC_SUBST($2INCDIR)
    1352 AC_SUBST($2LIBDIR)
     1381AC_SUBST($2LIB)
    13531382AM_CONDITIONAL(COIN_HAS_$2,
    13541383               test $m4_tolower(coin_has_$2) = true)
Note: See TracChangeset for help on using the changeset viewer.