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

📄 aclocal.m4

📁 蒙特卡罗模拟光子成像C语言版,代码简洁专业
💻 M4
字号:
dnl --------------------------------------------------------------------
dnl Like AC_CHECK_LIB(), but put the library into a different output
dnl variables

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 --------------------------------------------------------------------

dnl CHECK_SPECIAL_LIBRARY(LIBRARY, FUNCTION, XTRALIBS)
dnl 
AC_DEFUN(CHECK_SPECIAL_LIBRARY, [ dnl
  ac_save_LIBS="$LIBS"
  LIBS="$LIBS -l$1 $3 $4"	dnl add extra libraries

  dnl Use a cache variable name containing both the library and
  dnl function name, same as AC_CHECK_LIB() would.

  ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`

  dnl First check for a cached value.  If not found, try to find the
  dnl  library by writing a small test program.

  AC_CACHE_CHECK([for $2 in -l$1], ac_cv_lib_$ac_lib_var,
    [ AC_TRY_LINK(ifelse([$2], [main], , dnl Avoid conflicting decl of main.
                         [ char $2(); ]),
                         [ $2()], 
                  eval "ac_cv_lib_$ac_lib_var=yes", 
                  eval "ac_cv_lib_$ac_lib_var=no" ) ])

  if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
    dnl Found the function in the library

    changequote(, )dnl
    ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
      -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
    changequote([, ])dnl

    AC_DEFINE_UNQUOTED($ac_tr_lib)
  fi

  LIBS="$ac_save_LIBS"
])

dnl --------------------------------------------------------------------
dnl Wrapper, check for all the different X11 aspects at once
dnl CHECK_X11(PATH)

AC_DEFUN(CHECK_X11,
[ acl_save_CFLAGS="${CFLAGS}"
  acl_save_LDFLAGS="${LDFLAGS}"

  X11CFLAGS="-I${x_includes}"
  X11LDFLAGS="-L${x_libraries}"
  X11LIBS=""

  CFLAGS="$CFLAGS $X11CFLAGS"
  LDFLAGS="$LDFLAGS $X11LDFLAGS"

  dnl check for the appropriate libraries and header files

  CHECK_SPECIAL_LIBRARY(X11,  main, "$X11LIBS")
  if test "$ac_cv_lib_X11_main" == "yes"; then
    X11LIBS="-lX11 $X11LIBS"
  fi

  CHECK_SPECIAL_LIBRARY(Xi,  main, "$X11LIBS")
  if test "$ac_cv_lib_Xi_main" == "yes"; then
    X11LIBS="-lXi $X11LIBS"
  fi

  CHECK_SPECIAL_LIBRARY(Xext,  main, "$X11LIBS")
  if test "$ac_cv_lib_Xext_main" == "yes"; then
    X11LIBS="-lXext $X11LIBS"
  fi

  CHECK_SPECIAL_LIBRARY(Xmu,  main, "$X11LIBS")
  if test "$ac_cv_lib_Xmu_main" == "yes"; then
    X11LIBS="-lXmu $X11LIBS"
  fi

  AC_MSG_CHECKING([for installed X11 components])

  if test "$ac_cv_lib_X11_main" == "yes" ; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_X11, 1, [Define if you have the X11 library.])

    AC_SUBST(X11CFLAGS)
    AC_SUBST(X11LDFLAGS)
    AC_SUBST(X11LIBS)
  else
    AC_MSG_RESULT(no)
  fi
])

dnl --------------------------------------------------------------------
dnl Wrapper, check for all the different GSL aspects at once
dnl CHECK_GSL(PATH)

AC_DEFUN(CHECK_GSL,
[ acl_save_CFLAGS="${CFLAGS}"
  acl_save_LDFLAGS="${LDFLAGS}"

  GSLCFLAGS=""
  GSLLDFLAGS=""
  GSLLIBS=""

  dnl Apply the user-specified path, if any
  
  if test "$with_GSL" != "yes"; then
    gsl_base="`echo $with_GSL | \
	      sed -e 's/\/$//g' -e 's/\/include$//g' -e 's/\/lib$//g'`"

    GSLCFLAGS="-I${gsl_base}/include"
    GSLLDFLAGS="-L${gsl_base}/lib"
  fi

  CFLAGS="${CFLAGS} ${GSLCFLAGS}"
  LDFLAGS="${LDFLAGS} ${GSLLDFLAGS}"

  dnl check for the appropriate libraries and header files

  CHECK_SPECIAL_LIBRARY(gsl, main, "$GSLLIBS")
  if test "$ac_cv_lib_gsl_main" == "yes"; then
    GSLLIBS="-lgsl $GSLLIBS"
  fi

  CHECK_SPECIAL_LIBRARY(gslcblas,  main, "$GSLLIBS")
  if test "$ac_cv_lib_gslcblas_main" == "yes"; then
    GSLLIBS="-lgslcblas $GSLLIBS"
  fi

  dnl restore default flags

  LDFLAGS="${acl_save_LDFLAGS}"
  CFLAGS="${acl_save_CFLAGS}"

  dnl Combine results

  if test "$with_GSL" != "yes"; then
    AC_MSG_CHECKING([for installed GSL components in ${gsl_base}])
  else
    AC_MSG_CHECKING([for installed GSL components])
  fi

  if test "$ac_cv_lib_gsl_main" == "yes"; then
    dnl Accept changes, save to outputs
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_GSL, 1, [Define if you have the GSL library.])

    AC_SUBST(GSLCFLAGS)
    AC_SUBST(GSLLDFLAGS)
    AC_SUBST(GSLLIBS)
  else
    dnl Reject changes, do not save
    AC_MSG_RESULT(no)

    AC_MSG_WARN([GSL library requested but not found])
  fi
])

dnl --------------------------------------------------------------------
dnl Wrapper, check for all the different OpenGL aspects at once.  Should
dnl be called only _after_ calling CHECK_X11().
dnl CHECK_OPENGL(PATH)

AC_DEFUN(CHECK_OPENGL,
[ acl_save_CFLAGS="${CFLAGS}"
  acl_save_LDFLAGS="${LDFLAGS}"

  CFLAGS="${CFLAGS} ${X11CFLAGS}"
  LDFLAGS="${LDFLAGS} ${X11LDFLAGS}"
  GLLIBS=""

  dnl check for the appropriate libraries and header files

  CHECK_SPECIAL_LIBRARY(GL,  main, "$GLLIBS")
  if test "$ac_cv_lib_GL_main" == "yes"; then
    GLLIBS="-lGL $GLLIBS"
  fi

  CHECK_SPECIAL_LIBRARY(GLU,  main, "$GLLIBS")
  if test "$ac_cv_lib_GLU_main" == "yes"; then
    GLLIBS="-lGLU $GLLIBS"
  fi

  CHECK_SPECIAL_LIBRARY(glut,  main, "$GLLIBS")
  if test "$ac_cv_lib_glut_main" == "yes"; then
    GLLIBS="-lglut $GLLIBS"
  fi

  dnl restore original flags

  LDFLAGS="${acl_save_LDFLAGS}"
  CFLAGS="${acl_save_CFLAGS}"

  dnl Combine results

  if test "$with_GSL" != "yes"; then
    AC_MSG_CHECKING([for installed GSL components in ${gsl_base}])
  else
    AC_MSG_CHECKING([for installed GSL components])
  fi

  if test "$ac_cv_lib_GL_main" == "yes"; then
    GLLIBS="-lGL $GLLIBS"
  fi

  if test "$ac_cv_lib_GLU_main" == "yes"; then
    GLLIBS="-lGLU $GLLIBS"
  fi

  if test "$ac_cv_lib_glut_main" == "yes"; then
    GLLIBS="-lglut $GLLIBS"
  fi

  AC_MSG_CHECKING([for OpenGL support])

  if test "$ac_cv_lib_GL_main" == "yes"; then
    dnl Accept changes, save to outputs
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_OPENGL, 1, [Define if you have OpenGL libraries.])

    AC_SUBST(GLLIBS)
  else
    dnl Reject changes, do not save
    AC_MSG_RESULT(no)
  fi
])

⌨️ 快捷键说明

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