📄 configure.in
字号:
dnl ******************************************************************dnldnl File: configure.indnl Rev: b-1dnl Date: 02/28/2001dnldnl Copyright (c) 1998, 2001 by David M. Warmednldnl ******************************************************************dnldnl Process this file with autoconf to produce a configure scriptdnl for GeoSteiner.dnldnl ******************************************************************dnldnl Modification Log:dnldnl a-1: 12/20/98 warmednl : Created.dnl a-2: 08/07/97 warmednl : Added check for bison. This doesn't really workdnl : the way we would like it to. We would prefer thednl : configuration to FAIL if no bison can be found!dnl b-1: 02/28/2001 warmednl : Changes for 3.1 release. Added checks for -lpthread,dnl : -ffloat-store and Intel floating point precisiondnl : fix, GMP, and stderr being an lvalue.dnldnl ******************************************************************dnlAC_INIT(steiner.h)dnl This is where you set the software version number!GEOSTEINER_VERSION="3.1"AC_SUBST(GEOSTEINER_VERSION)AC_DEFINE_UNQUOTED(GEOSTEINER_VERSION_STRING, "$GEOSTEINER_VERSION")AC_PREFIX_DEFAULT(/usr/local)AC_CONFIG_HEADER(config.h)dnl Checks for programs.AC_PROG_CCAC_PROG_RANLIBAC_PROG_INSTALLAC_PROG_YACCAC_PROG_LEXAC_PROG_MAKE_SETdnl Make sure we have maximum compatibility with lex when using flex!if test "$LEX" = "flex"; then LEX='flex -l'; fidnl Checks for typedefs, structures, and compiler characteristics.AC_C_CONSTAC_C_INLINEAC_TYPE_SIGNALdnl Check for system header files we could use...AC_CHECK_HEADERS(sys/utsname.h)AC_HEADER_STDCdnl Check if -ffloat-store (or some other remedy) is needed...AC_CHECK_GCC_FLOAT_STOREdnl Determine whether Unix CPU time stuff is available.AC_CACHE_CHECK(for times() and CLK_TCK, ac_cv_header_unix_cpu_time,AC_TRY_COMPILE(#include <sys/types.h>#include <sys/time.h>#include <sys/times.h>#include <time.h>, clock_t ticks = CLK_TCK; clock_t total; struct tms t; times (&t); total = t.tms_utime + t.tms_stime + t.tms_cutime + t.tms_cstime; , ac_cv_header_unix_cpu_time=yes, ac_cv_header_unix_cpu_time=no))if test $ac_cv_header_unix_cpu_time = yes; then AC_DEFINE(UNIX_CPU_TIME)fidnl Determine whether the uname function works.AC_CACHE_CHECK(for working uname function, ac_cv_func_uname_works,AC_TRY_COMPILE(#include <sys/utsname.h>, struct utsname un; int total; uname (&un); total = *un.sysname + *un.nodename + *un.release + *un.version + *un.machine; printf ("%d\n", total);, ac_cv_func_uname_works=yes, ac_cv_func_uname_works=no))if test $ac_cv_func_uname_works = yes; then AC_DEFINE(UNAME_FUNCTION_WORKS)fidnl Check if popen and pclose are available.AC_CHECK_FUNCS(popen pclose)dnl Check for the uname command.AC_PATH_PROG(ac_cv_prog_uname_full_pathname, uname)if test -n "$ac_cv_prog_uname_full_pathname"then AC_DEFINE_UNQUOTED(UNAME_PATH, "$ac_cv_prog_uname_full_pathname")fidnl Check if stderr can be used as an lvalue...AC_CACHE_CHECK(if stderr is an lvalue, ac_cv_stderr_is_lvalue, AC_TRY_LINK([#include <stdio.h>], [ FILE * fp1; FILE * fp2; fp1 = stderr; fp2 = fopen ("/dev/null", "w"); stderr = fp2; fprintf (stderr, "Discarded output\n"); stderr = fp1; fclose (fp2);], ac_cv_stderr_is_lvalue=yes, ac_cv_stderr_is_lvalue=no))if test "$ac_cv_stderr_is_lvalue" = "yes"then AC_DEFINE(HAVE_STDERR_IS_LVALUE)fi# Override the cached CPLEX settings if environment vars are set!if test -n "$CPLEX_HEADER"then if test ! -r "$CPLEX_HEADER" then AC_MSG_ERROR(File given by \$CPLEX_HEADER unreadable!) fi ac_cv_cplex_header="$CPLEX_HEADER"fiif test -n "$CPLEX_LIB"then if test ! -r "$CPLEX_LIB" then AC_MSG_ERROR(File given by \$CPLEX_LIB unreadable!) fi ac_cv_cplex_lib="$CPLEX_LIB"fidnl See if the user has specified --with-cplex=no to override.AC_ARG_WITH(cplex,[ --with-cplex=no Do not use CPLEX, even if available],if test "$withval" = nothen with_cplex=no # Expunge cplex from the cache! ac_cv_cplex_header='' ac_cv_cplex_lib=''else if test "$withval" != yes then echo "Arg to --with-cplex must be yes or no!" 1>&2 exit 1 fi with_cplex=yesfi)if test "$with_cplex" != nothen # Look for the cplex command in the path. The header and library are # often in the same directory as the executable. AC_PATH_PROG(ac_cv_path_cplex, cplex) cplex_dir='.' if test -n "$ac_cv_path_cplex" then [cplex_dir="`echo $ac_cv_path_cplex | sed 's%/[^/]*$%%'`"] fi cpx_hdr_dirs="$cplex_dir /usr/include /usr/local/include" cpx_lib_dirs="$cplex_dir /usr/lib /usr/ccs/lib /usr/local/lib" # Look for cplex.h AC_CACHE_CHECK(for cplex.h, ac_cv_cplex_header, AC_FIND_FILE(ac_cv_cplex_header, cplex.h, -r, $cpx_hdr_dirs) ) # Look for libcplex.a AC_CACHE_CHECK(for libcplex.a, ac_cv_cplex_lib, AC_FIND_FILE(ac_cv_cplex_lib, libcplex.a, -r, $cpx_lib_dirs) ) if test -z "$ac_cv_cplex_header" || test -z "$ac_cv_cplex_lib" then # Start looking for CPLEX version 3 stuff... # Look for cpxdefs.inc AC_CACHE_CHECK(for cpxdefs.inc, ac_cv_cplex_header, AC_FIND_FILE(ac_cv_cplex_header, cpxdefs.inc, -r, $cpx_hdr_dirs) ) # Look for cplex.a AC_CACHE_CHECK(for cplex.a, ac_cv_cplex_lib, AC_FIND_FILE(ac_cv_cplex_lib, cplex.a, -r, $cpx_lib_dirs) ) fi # We assume at this point, the variables ac_cv_cplex_header and # ac_cv_cplex_lib have been set to the absolute pathnames of the # appropriate files, if they are available. # # The next thing to do is determine the version number of the # cplex being referenced, putting it in ac_cv_cplex_version. # Note: we use the version number in the header and assume that # the library matches!dnl A macro to determine the CPLEX version number from the cplex headerdnl file...define(AC_DETECT_CPLEX_VERSION,[ cpxh="$ac_cv_cplex_header" hdrname="`echo $cpxh | sed 's@^.*/@@'`" if test "$hdrname" = "cpxdefs.inc" then ac_cv_cplex_version=30 else vers="`grep Version <$cpxh | head -1 | \ sed 's@^.*Version[[ ]]*@@' | \ sed 's@\([[0-9]][[0-9]]*\)\.\([[0-9]]\).*[$]@\1\2@'`" ac_cv_cplex_version="$vers" fi]) if test -n "$ac_cv_cplex_header" && \ test -r "$ac_cv_cplex_header" && \ test -n "$ac_cv_cplex_lib" then # We have both a header and a library. Now we need the version. AC_MSG_CHECKING([cplex version number]) if test -n "$CPLEX_HEADER" || test -n "$CPLEX_LIB" then # User overrode, don't believe the cached value! AC_DETECT_CPLEX_VERSION else AC_CACHE_VAL(ac_cv_cplex_version, [AC_DETECT_CPLEX_VERSION]) fi AC_MSG_RESULT($ac_cv_cplex_version) fifi# Decide (finally) which LP solver to use!if test "$with_cplex" != no && \ test -n "$ac_cv_cplex_header" && \ test -r "$ac_cv_cplex_header" && \ test -n "$ac_cv_cplex_lib" && \ test -r "$ac_cv_cplex_lib" && \ test -n "$ac_cv_cplex_version"then # We have decided to use cplex! [hdrdir="`echo $ac_cv_cplex_header | sed 's%/[^/]*$%%'`"] LP_PKG=cplex LP_CFLAGS="-I$hdrdir" LP_DEPS="$ac_cv_cplex_header" LP_LIBS="$ac_cv_cplex_lib" AC_DEFINE_UNQUOTED(CPLEX, $ac_cv_cplex_version) # Check if we need to use -lpthread AC_CPLEX_CHECK_LIBPTHREAD if test "$ac_cv_cplex_libpthread" = yes then LP_LIBS="${LP_LIBS} -lpthread" fielse # We are unable to use cplex. Use lp_solve instead. if (test -n "$ac_cv_cplex_header" || \ test -n "$ac_cv_cplex_lib" || \ test -n "$ac_cv_prog_cplex") && \ test "$with_cplex" != no then # Warn user that we are falling back to lp_solve! AC_MSG_WARN(CPLEX not completely found -- using lp_solve instead...) fi LP_PKG=lp_solve LP_CFLAGS='-I$(LP_SOLVE_DIR)' LP_DEPS='$(LP_SOLVE_DIR)/lpkit.h' LP_LIBS='$(LP_SOLVE_DIR)/libLPS.a' AC_DEFINE(LPSOLVE)fiAC_SUBST(LP_PKG)AC_SUBST(LP_DEPS)AC_SUBST(LP_LIBS)AC_SUBST(LP_CFLAGS)dnl Permit the user to specify --with-machine=string to set thednl machine description string. This #define's MACHDESC todnl be a C string constant in config.h.define_machdesc=noAC_ARG_WITH(machine,[ --with-machine=string Force machine description string], ac_cv_machine_description_string="$withval" define_machdesc=yes,[if test -n "$ac_cv_machine_description_string" then define_machdesc=yes fi])if test $define_machdesc = yesthen AC_DEFINE_UNQUOTED(MACHDESC, "${ac_cv_machine_description_string}")fidnl Permit the user to specify environment variables that givednl the location of the GNU GMP header and library files.dnl If the user specifies --with-gmp=no, then ignore these environmentdnl vars.# Override the cached GMP settings if environment vars are set!if test -n "$GMP_HEADER"then if test ! -r "$GMP_HEADER" then AC_MSG_ERROR(File given by \$GMP_HEADER unreadable!) fi ac_cv_gmp_header="$GMP_HEADER"fiif test -n "$GMP_LIB"then if test ! -r "$GMP_LIB" then AC_MSG_ERROR(File given by \$GMP_LIB unreadable!) fi ac_cv_gmp_lib="$GMP_LIB"fidnl See if the user has specified --with-gmp=no to override.AC_ARG_WITH(gmp,[ --with-gmp=no Do not use GNU GMP, even if available],if test "$withval" = nothen with_gmp=no # Expunge GMP from the cache! ac_cv_gmp_header='' ac_cv_gmp_lib=''else if test "$withval" != yes then echo "Arg to --with-gmp must be yes or no!" 1>&2 exit 1 fi with_gmp=yesfi)if test -n "$ac_cv_gmp_header" && test -n "$ac_cv_gmp_lib" && \ test "$with_gmp" != nothen GMP_INCLUDE_DIR="`echo $ac_cv_gmp_header | sed -e 's@[[^/]]*$@@' -e 's@/$@@'`" if test -z "$GMP_INCLUDE_DIR"; then GMP_INCLUDE_DIR='.'; fi GMP_CFLAGS='-I$(GMP_INCLUDE_DIR)' GMP_LIBS="$ac_cv_gmp_lib" AC_DEFINE(HAVE_GMP)fiAC_SUBST(GMP_INCLUDE_DIR)AC_SUBST(GMP_CFLAGS)AC_SUBST(GMP_LIBS)dnl these two lines are added by AC_OUTPUT, but I need them todnl expand the prefix and exec_prefix variablestest "x$prefix" = xNONE && prefix=$ac_default_prefixtest "x$exec_prefix" = xNONE && exec_prefix='${prefix}'dnl C macro variable expansionAC_DEFINE_EXPAND_VALUE(INSTALLDIR_PREFIX, $prefix)AC_DEFINE_EXPAND_VALUE(INSTALLDIR_EXEC_PREFIX, $exec_prefix)AC_DEFINE_EXPAND_VALUE(INSTALLDIR_BINDIR, $bindir)AC_DEFINE_EXPAND_VALUE(INSTALLDIR_DATADIR, $datadir)AC_DEFINE_EXPAND_VALUE(INSTALLDIR_LIBDIR, $libdir)AC_DEFINE_EXPAND_VALUE(INSTALLDIR_LIBEXECDIR, $libexecdir)AC_OUTPUT(Makefile lp_solve_2.3/Makefile, echo timestamp >stamp-config-h)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -