⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.in

📁 蒙特卡罗模拟光子成像C语言版,代码简洁专业
💻 IN
字号:
dnl --------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.

dnl --------------------------------------------------------------------
dnl This file is part of tMCimg.
dnl 
dnl tMCimg is free software; you can redistribute it and/or modify it under
dnl the terms of the GNU General Public License as published by the Free
dnl Software Foundation; either version 2 of the License, or (at your option)
dnl any later version.
dnl 
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dnl for more details.
dnl 
dnl You should have received a copy of the GNU General Public License along
dnl with this program; if not, write to the Free Software Foundation, Inc.,
dnl 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dnl --------------------------------------------------------------------

AC_INIT(tMCimg.h)
AC_PREREQ(2.13)              dnl Older ver's may work, but I can't test.
AC_CONFIG_HEADER(config.h)

dnl --------------------------------------------------------------------
dnl Checks for programs.

AC_PROG_CC
AC_CHECK_PROG(AR, ar, ar)
AC_PROG_RANLIB
AC_PROG_MAKE_SET
AC_PROG_INSTALL

dnl Normal yacc won't do the trick, this MUST be flex
AC_CHECK_PROG(FLEX, flex, flex)

dnl Normal yacc won't work either, this MUST be bison
AC_CHECK_PROG(BISON, bison, bison)

AC_LANG_C

dnl --------------------------------------------------------------------
dnl Checks for libraries.

AC_CHECK_LIB(m, main)
AC_CHECK_LIB(pthread, pthread_exit)	dnl needed by some OpenGL libs

dnl --------------------------------------------------------------------
dnl Checks for header files.

AC_HEADER_STDC
AC_CHECK_HEADERS([getopt.h assert.h fcntl.h fpu_control.h stddef.h unistd.h])

dnl --------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.

AC_C_CONST
AC_TYPE_SIZE_T

dnl Checks for library functions.

AC_CHECK_FUNCS([getopt_long getopt erf pow sqrt perror fcntl])
AC_CHECK_FUNCS(snprintf [strdup rindex memset strchr])

dnl It's conceivalbe that assert exists but assert.h doesn't

dnl Check for an assert function, only include assert.h if we saw it above
AC_MSG_CHECKING(for assert)

if test "${ac_cv_header_assert_h}" == "yes"; then
	AC_CACHE_VAL(ac_cv_func_assert,
		[ AC_TRY_LINK([#include <assert.h>], [ assert(1) ],
				[ac_cv_func_assert="yes"],
				[ac_cv_func_assert="no"]) ])
else
    AC_CACHE_VAL(ac_cv_func_assert,
		[ AC_TRY_LINK([], [ assert(1) ],
				[ac_cv_func_assert="yes"],
				[ac_cv_func_assert="no"]) ])
fi

dnl store the results and define the variable for config.h

test "${ac_cv_func_assert}" == "yes" &&\
    AC_DEFINE(HAVE_ASSERT, 1, [Define if you have the assert function.])

AC_MSG_RESULT($ac_cv_func_assert)

dnl --------------------------------------------------------------------
dnl Local checks

AC_PATH_X
  
if test "${no_x}" != "yes" ; then
  X11CFLAGS="-I${x_includes}"
  X11LDFLAGS="-L${x_libraries}"

  CHECK_X11(${withval})
  CHECK_OPENGL(${withval})
fi

dnl AC_SUBST(X11CFLAGS)
dnl AC_SUBST(X11LDFLAGS)

AC_ARG_WITH(GSL,
    [  --with-GSL=path_to_lib  use Gnu Scientific Library code],
    [ if test "$with_GSL" != "no"; then
	CHECK_GSL(${withval})
      fi ])

dnl AC_SUBST(GSLLIBS)

dnl My own flag
use_MPI="no"

AC_ARG_WITH(MPI, 
    [  --with-MPI=path_to_lib  use MPI parallel library],
    [ if test "$with_MPI" != "no"; then
	use_MPI="yes"
      fi ])

if test "$use_MPI" == "yes"; then
    AC_CHECK_PROG(MPICC, mpicc, mpicc)

    if test "${ac_cv_prog_MPICC}" == "mpicc"; then
	ac_save_cpp="${ac_cpp}"
	ac_save_CC="${CC}"
        ac_save_CF="${CFLAGS}"

	ac_cpp="${ac_cv_prog_MPICC} -E"

	CC="${ac_cv_prog_MPICC}"
        CFLAGS="-O2 -Wall -g"

	dnl Check for MPI headers too
	AC_CHECK_HEADERS([mpi.h])

	if test "${ac_cv_header_mpi_h}" == "yes"; then
	    dnl Got it all, set the USE_MPI flag
	    AC_DEFINE(USE_MPI, 1, [build parallel Monte Carlo])

	    dnl Fake a result
	    AC_MSG_CHECKING("MPI library")
	    AC_MSG_RESULT([complete, building parallel version])
	else
	    dnl Header file not found, clear the USE_MPI flag
	    unset ac_cv_prog_MPICC

	    AC_MSG_CHECKING("MPI library")
            AC_MSG_RESULT([incomplete, parallel code will not be built])
	fi
	
	ac_cpp="${ac_save_cpp}"
	CC="${ac_save_CC}"
        CFLAGS="${ac_save_CF}"
    else
	dnl Fake a response
	AC_MSG_CHECKING("MPI library")
	AC_MSG_RESULT([incomplete, parallel code will not be built])
    fi
fi

AC_ARG_ENABLE(wide-tissue, 
    [  --enable-wide-tissue    used 16-bit tissue types (default 8-bit)],
       AC_DEFINE(WIDE_TISSUE,1,[16-bit tissue types]))

AC_ARG_ENABLE(small-twopt, 
    [  --enable-small-twopt    use floats for .2pt files (default double)],
       AC_DEFINE(SMALL_TWOPT,1,[single-precision .2pt files]))

AC_ARG_ENABLE(fpu-control, 
    [  --enable-fpu-control    set i386 FPU registers to checks for errors], 
       AC_DEFINE(DO_FPU_CONTROL,1,[Diddle FPU control registers]))

AC_ARG_ENABLE(paranoid, 
    [  --enable-paranoid       turn on additional program checks], 
       AC_DEFINE(PARANOID,1,[Paranoid checks]))

AC_ARG_ENABLE(debug, 
    [  --enable-debugging      extra debugging output, normally disabled],
       AC_DEFINE(DEBUG,1,[Debugging output]))

dnl --------------------------------------------------------------------
dnl Write out files

AC_OUTPUT(Makefile libmccore/Makefile libmcparse/Makefile\
	tMCimg/Makefile tFDimg/Makefile cfg2inp/Makefile)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -