📄 configure.ac
字号:
############################################################################### subsequent libraries are only for libctl front endmeep_save_LIBS=$LIBSAC_ARG_WITH(libctl, [AC_HELP_STRING([--with-libctl=<dir>],[specify libctl directory])], with_libctl=$withval, with_libctl=yes)if test "x$with_libctl" = "xno"; then :elif test "x$with_libctl" != "xyes"; then LIBCTL_DIR="$with_libctl"fiAM_CONDITIONAL(WITH_LIBCTL, test "x$with_libctl" != xno)############################################################################### Check for Guile library and its behavior (for libctl front end):if test "x$with_libctl" != xno; thenAC_CHECK_PROG(HAVE_GUILE_CONFIG, guile-config, yes, no)if test "$HAVE_GUILE_CONFIG" = "yes"; then CPPFLAGS="$CPPFLAGS `guile-config compile`" LIBS="`guile-config link` $LIBS" AC_MSG_CHECKING([if linking to guile works]) AC_TRY_LINK_FUNC(gh_enter, AC_MSG_RESULT(yes), [ AC_MSG_RESULT(no) AC_MSG_ERROR(guile-config is broken) ])else AC_CHECK_LIB(readline, readline) AC_CHECK_LIB(dl, dlopen) AC_CHECK_LIB(guile-ltdl, scm_lt_dlinit, [], [AC_CHECK_LIB(ltdl, dlopen)]) AC_CHECK_LIB(guile, gh_eval_str, [], [AC_MSG_ERROR([linking to guile failed])])fi# Check how smob types work in this Guile version:AC_CHECK_FUNCS(scm_make_smob_type)AC_MSG_CHECKING([for SCM_SMOB_PREDICATE])AC_TRY_LINK([#include <guile/gh.h>#include <libguile/smob.h>], [int x; SCM_SMOB_PREDICATE(1,x);], ok=yes, ok=no)AC_MSG_RESULT($ok)if test $ok = yes; then AC_DEFINE(HAVE_SCM_SMOB_PREDICATE, 1, [define if we have SCM_SMOB_PREDICATE])fiAC_MSG_CHECKING([for SCM_SMOB_DATA])AC_TRY_LINK([#include <guile/gh.h>#include <libguile/smob.h>], [int x; SCM_SMOB_DATA(x);], ok=yes, ok=no)AC_MSG_RESULT($ok)if test $ok = yes; then AC_DEFINE(HAVE_SCM_SMOB_DATA, 1, [define if we have SCM_SMOB_DATA])fiAC_MSG_CHECKING([for SCM_NEWSMOB])AC_TRY_LINK([#include <guile/gh.h>#include <libguile/smob.h>], [int x; SCM_NEWSMOB(x,1,0);], ok=yes, ok=no)AC_MSG_RESULT($ok)if test $ok = yes; then AC_DEFINE(HAVE_SCM_NEWSMOB, 1, [define if we have SCM_NEWSMOB])fi# Check how to activate Guile readline support:ACTIVATE_READLINE=""if test "x$cross_compiling" = xno; thenAC_MSG_CHECKING(how to activate readline in Guile)ractivate="(use-modules (readline-activator)) (activate-readline)"if guile -c "$ractivate" > /dev/null 2>&1; then AC_MSG_RESULT(readline-activator) ACTIVATE_READLINE="$ractivate"else ractivate="(use-modules (ice-9 readline)) (activate-readline)" if guile -c "$ractivate" >& /dev/null; then AC_MSG_RESULT(ice-9 readline) ACTIVATE_READLINE="$ractivate" else AC_MSG_RESULT(cannot) ACTIVATE_READLINE="" fififiAC_SUBST(ACTIVATE_READLINE)fi # if with_libctl############################################################################### Check for libctl library and filesif test "x$with_libctl" != xno; thenAC_MSG_CHECKING([for libctl dir])if test x != x"$LIBCTL_DIR" -a ! -r "$LIBCTL_DIR/base/ctl.scm"; then LIBCTL_DIR=""fiif test x = x"$LIBCTL_DIR" -a -r /usr/local/share/libctl/base/ctl.scm; then LIBCTL_DIR="/usr/local/share/libctl"fiif test x = x"$LIBCTL_DIR" -a -r /usr/share/libctl3/base/ctl.scm; then LIBCTL_DIR="/usr/share/libctl3"fiif test x = x"$LIBCTL_DIR" -a -r /usr/share/libctl/base/ctl.scm; then LIBCTL_DIR="/usr/share/libctl"fiif test x = x"$LIBCTL_DIR"; then AC_MSG_ERROR([could not find libctl files; use --with-libctl=<dir>])fiAC_MSG_RESULT($LIBCTL_DIR)AC_SUBST(LIBCTL_DIR)AC_CHECK_PROGS(GEN_CTL_IO, gen-ctl-io, echo)if test x"$GEN_CTL_IO" = xecho; then AC_MSG_ERROR([could not find gen-ctl-io program; check your PATH])fi# check for -lctl:AC_CHECK_LIB(ctl, ctl_get_vector3, [], [AC_MSG_ERROR([Couldn't find the required libctl library.])])# check for ctl.h (Fedora puts it in /usr/include/ctl, grrr)CTL_H_CPPFLAG=""AC_CHECK_HEADER(ctl.h, [CTL_H_CPPFLAG=" "], [ save_CPPFLAGS=$CPPFLAGS AC_MSG_CHECKING([for alternate ctl.h location]) for ctl_h_path in /usr/include/ctl /usr/local/include/ctl; do CPPFLAGS="$save_CPPFLAGS -I$ctl_h_path" AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <ctl.h>]],[]), [CTL_H_CPPFLAG=-I$ctl_h_path; break]) done AC_MSG_RESULT([$CTL_H_CPPFLAG]) CPPFLAGS=$save_CPPFLAGS])if test "x$CTL_H_CPPFLAG" = "x"; then AC_MSG_ERROR([Couldn't find the ctl.h header file for libctl.])fiAC_SUBST(CTL_H_CPPFLAG)# Check libctl version >= LIBCTL_MAJOR.LIBCTL_MINOR.LIBCTL_BUGFIXLIBCTL_MAJOR=3; LIBCTL_MINOR=0; LIBCTL_BUGFIX=3AC_MSG_CHECKING([whether libctl version is at least ${LIBCTL_MAJOR}.${LIBCTL_MINOR}.${LIBCTL_BUGFIX}])AC_EGREP_CPP(yes, [[#include <ctl.h>#if LIBCTL_MAJOR_VERSION > $LIBCTL_MAJOR || (LIBCTL_MAJOR_VERSION == $LIBCTL_MAJOR && (LIBCTL_MINOR_VERSION > $LIBCTL_MINOR || (LIBCTL_MINOR_VERSION == $LIBCTL_MINOR && LIBCTL_BUGFIX_VERSION >= $LIBCTL_BUGFIX))) yes#endif]], [AC_MSG_RESULT(ok)], [AC_MSG_ERROR([libctl version ${LIBCTL_MAJOR}.${LIBCTL_MINOR}.${LIBCTL_BUGFIX} or later is required])])# On IRIX, basename/dirname functions in libctl/main.c require -lgenAC_CHECK_LIB(gen, basename)fi # if with_libctl##############################################################################LIBCTL_LIBS=$LIBSAC_SUBST(LIBCTL_LIBS)LIBS=$meep_save_LIBS############################################################################### The following function is used only for debugging. Note that# we must test for it *after* setting the compiler flags (which# affect whether it is declared, as it is a GNU extension).# We need to #include <stdio.h> because that somehow affects whether# the function is declared with older gcc versions. We need# to use AC_TRY_COMPILE because the test in AC_HAVE_DECL seems# to be optimized out.AC_CHECK_FUNCS(feenableexcept) dnl GNU libc fp exception control functionAC_LANG_PUSH([C++])AC_MSG_CHECKING([whether feenableexcept declaration is usable])feenableexcept_decl_ok=yesAC_TRY_COMPILE([#include <stdio.h>#define _GNU_SOURCE 1#include <fenv.h>], [feenableexcept(0);],[AC_DEFINE([HAVE_DECL_FEENABLEEXCEPT],[1],[Define if fenv.h declares this.])],[feenableexcept_decl_ok=no])AC_MSG_RESULT($feenableexcept_decl_ok)AC_LANG_POP([C++])############################################################################### See if we need to catch SIGFPE to avoid crashing on underflow exceptions# etcetera, since some stupid operating systems (e.g. Alpha/Tru64) crash on # SIGFPE by default.AC_MSG_CHECKING([whether to catch and ignore SIGFPE signals])ignore_sigfpe=yesAC_RUN_IFELSE([AC_LANG_PROGRAM([], [volatile double x=1,y=0; return x/y;])], [ignore_sigfpe=no])AC_MSG_RESULT($ignore_sigfpe)if test $ignore_sigfpe = yes; then AC_DEFINE(IGNORE_SIGFPE, [1], [Define to catch and ignore SIGFPE signals])fi############################################################################### Miscellaneous function and header checksAC_HEADER_TIMEAC_CHECK_HEADERS([sys/time.h])AC_CHECK_FUNCS([BSDgettimeofday gettimeofday cblas_ddot cblas_daxpy])############################################################################### check for restrict keyword in C++AC_PREREQ(2.58) dnl for ac_c_restrictAC_LANG_PUSH([C++])AC_C_RESTRICTAC_LANG_POP([C++])##############################################################################AC_SUBST(MEEP_SUFFIX)program_transform_name="s,_,-,g;$program_transform_name"##############################################################################AC_CONFIG_FILES([ Makefile meep-pkgconfig src/Makefile hsrc/Makefile doc/Makefile tests/Makefile examples/Makefile libctl/Makefile libctl/meep.scm])AC_OUTPUT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -