📄 acspecific.m4
字号:
dnl ### Checks for compiler characteristicsAC_DEFUN(AC_C_CROSS,[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])AC_DEFUN(AC_C_CHAR_UNSIGNED,[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,[if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies.AC_EGREP_CPP(yes,[#ifdef __CHAR_UNSIGNED__ yes#endif], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)elseAC_TRY_RUN([/* volatile prevents gcc2 from optimizing the test away on sparcs. */#if !defined(__STDC__) || __STDC__ != 1#define volatile#endifmain() { volatile char c = 255; exit(c < 0);}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)fi])if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then AC_DEFINE(__CHAR_UNSIGNED__)fi])AC_DEFUN(AC_C_LONG_DOUBLE,[AC_CACHE_CHECK(for long double, ac_cv_c_long_double,[if test "$GCC" = yes; then ac_cv_c_long_double=yeselseAC_TRY_RUN([int main() {/* The Stardent Vistra knows sizeof(long double), but does not support it. */long double foo = 0.0;/* On Ultrix 4.3 cc, long double is 4 and double is 8. */exit(sizeof(long double) < sizeof(double)); }],ac_cv_c_long_double=yes, ac_cv_c_long_double=no)fi])if test $ac_cv_c_long_double = yes; then AC_DEFINE(HAVE_LONG_DOUBLE)fi])AC_DEFUN(AC_INT_16_BITS,[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnlAC_MSG_CHECKING(whether int is 16 bits)AC_TRY_RUN([main() { exit(sizeof(int) != 2); }], [AC_MSG_RESULT(yes) AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))])AC_DEFUN(AC_LONG_64_BITS,[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnlAC_MSG_CHECKING(whether long int is 64 bits)AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }], [AC_MSG_RESULT(yes) AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))])AC_DEFUN(AC_C_BIGENDIAN,[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,[ac_cv_c_bigendian=unknown# See if sys/param.h defines the BYTE_ORDER macro.AC_TRY_COMPILE([#include <sys/types.h>#include <sys/param.h>], [#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.AC_TRY_COMPILE([#include <sys/types.h>#include <sys/param.h>], [#if BYTE_ORDER != BIG_ENDIAN not big endian#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])if test $ac_cv_c_bigendian = unknown; thenAC_TRY_RUN([main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1);}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)fi])if test $ac_cv_c_bigendian = yes; then AC_DEFINE(WORDS_BIGENDIAN)fi])dnl Do nothing if the compiler accepts the inline keyword.dnl Otherwise define inline to __inline__ or __inline if one of those work,dnl otherwise define inline to be empty.AC_DEFUN(AC_C_INLINE,[AC_CACHE_CHECK([for inline], ac_cv_c_inline,[ac_cv_c_inline=nofor ac_kw in inline __inline__ __inline; do AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break])done])case "$ac_cv_c_inline" in inline | yes) ;; no) AC_DEFINE(inline, ) ;; *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;;esac])AC_DEFUN(AC_C_CONST,[dnl This message is consistent in form with the other checking messages,dnl and with the result message.AC_CACHE_CHECK([for working const], ac_cv_c_const,[AC_TRY_COMPILE(,changequote(<<, >>)dnl<</* Ultrix mips cc rejects this. */typedef int charset[2]; const charset x;/* SunOS 4.1.1 cc rejects this. */char const *const *ccp;char **p;/* NEC SVR4.0.2 mips cc rejects this. */struct point {int x, y;};static struct point const zero = {0,0};/* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */const char *g = "string";ccp = &g + (g ? g-g : 0);/* HPUX 7.0 cc rejects these. */++ccp;p = (char**) ccp;ccp = (char const *const *) p;{ /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0;}{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo;}{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p;}{ /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5;}{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10;}>>,changequote([, ])dnlac_cv_c_const=yes, ac_cv_c_const=no)])if test $ac_cv_c_const = no; then AC_DEFINE(const, )fi])AC_DEFUN(AC_C_STRINGIZE, [AC_REQUIRE([AC_PROG_CPP])AC_MSG_CHECKING([for preprocessor stringizing operator])AC_CACHE_VAL(ac_cv_c_stringize,AC_EGREP_CPP([#teststring],[#define x(y) #ychar *s = x(teststring);], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))if test "${ac_cv_c_stringize}" = yesthen AC_DEFINE(HAVE_STRINGIZE)fiAC_MSG_RESULT([${ac_cv_c_stringize}])])dnldefine(AC_ARG_ARRAY,[errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments)m4exit(4)])dnl Check the object extension used by the compiler: typically .o ordnl .obj. If this is called, some other behaviour will change,dnl determined by ac_objext.AC_DEFUN(AC_OBJEXT,[AC_MSG_CHECKING([for object suffix])AC_CACHE_VAL(ac_cv_objext,[rm -f conftest*echo 'int i = 1;' > conftest.$ac_extif AC_TRY_EVAL(ac_compile); then for ac_file in conftest.*; do case $ac_file in *.c) ;; *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; esac doneelse AC_MSG_ERROR([installation or configuration problem; compiler does not work])firm -f conftest*])AC_MSG_RESULT($ac_cv_objext)OBJEXT=$ac_cv_objextac_objext=$ac_cv_objextAC_SUBST(OBJEXT)])dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77dnl intrinsic and run-time libraries that are required to successfullydnl link a Fortran 77 program or shared library. The output variablednl FLIBS is set to these flags.dnl dnl This macro is intended to be used in those situations when it isdnl necessary to mix, e.g. C++ and Fortran 77, source code into a singlednl program or shared library.dnl dnl For example, if object files from a C++ and Fortran 77 compiler mustdnl be linked together, then the C++ compiler/linker must be used fordnl linking (since special C++-ish things need to happen at link timednl like calling global constructors, instantiating templates, enablingdnl exception support, etc.).dnl dnl However, the Fortran 77 intrinsic and run-time libraries must bednl linked in as well, but the C++ compiler/linker doesn't know how todnl add these Fortran 77 libraries. Hence, the macrodnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77dnl libraries.dnldnl This macro was packaged in its current form by Matthew D. Langstondnl <langston@SLAC.Stanford.EDU>. However, nearly all of this macrodnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4',dnl and full credit should go to John W. Eaton for writing thisdnl extremely useful macro. Thank you John.dnldnl AC_F77_LIBRARY_LDFLAGS()AC_DEFUN(AC_F77_LIBRARY_LDFLAGS,[AC_MSG_CHECKING([for Fortran 77 libraries])AC_REQUIRE([AC_PROG_F77])AC_REQUIRE([AC_CANONICAL_HOST])AC_CACHE_VAL(ac_cv_flibs,[changequote(, )dnldnl Write a minimal program and compile it with -v. I don't know whatdnl to do if your compiler doesn't have -v...echo " END" > conftest.ffoutput=`${F77} -v -o conftest conftest.f 2>&1`dnldnl The easiest thing to do for xlf output is to replace all the commasdnl with spaces. Try to only do that if the output is really from xlf,dnl since doing that causes problems on other systems.dnlxlf_p=`echo $foutput | grep xlfentry`if test -n "$xlf_p"; then foutput=`echo $foutput | sed 's/,/ /g'`fidnlld_run_path=`echo $foutput | \ sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'`dnldnl We are only supposed to find this on Solaris systems...dnl Uh, the run path should be absolute, shouldn't it?dnlcase "$ld_run_path" in /*) if test "$ac_cv_prog_gcc" = yes; then ld_run_path="-Xlinker -R -Xlinker $ld_run_path" else ld_run_path="-R $ld_run_path" fi ;; *) ld_run_path= ;;esacdnlflibs=lflags=dnldnl If want_arg is set, we know we want the arg to be added to the list,dnl so we don't have to examine it.dnlwant_arg=dnlfor arg in $foutput; do old_want_arg=$want_arg want_arg=dnldnl None of the options that take arguments expect the argument todnl start with a -, so pretend we didn't see anything special.dnl if test -n "$old_want_arg"; then case "$arg" in -*) old_want_arg= ;; esac fi case "$old_want_arg" in '') case $arg in /*.a) exists=false for f in $lflags; do if test x$arg = x$f; then exists=true fi done if $exists; then arg= else lflags="$lflags $arg" fi ;; -bI:*) exists=false for f in $lflags; do if test x$arg = x$f; then exists=true fi done if $exists; then arg= else if test "$ac_cv_prog_gcc" = yes; then lflags="$lflags -Xlinker $arg" else lflags="$lflags $arg" fi fi ;; -lang* | -lcrt0.o | -lc | -lgcc) arg= ;; -[lLR]) want_arg=$arg arg= ;; -[lLR]*) exists=false for f in $lflags; do if test x$arg = x$f; then exists=true fi done if $exists; then arg= else case "$arg" in -lkernel32) case "$canonical_host_type" in *-*-cygwin*) arg= ;; *) lflags="$lflags $arg" ;; esac ;; -lm) ;; *) lflags="$lflags $arg" ;; esac fi ;; -u) want_arg=$arg arg= ;; -Y) want_arg=$arg arg= ;; *) arg= ;; esac ;; -[lLR]) arg="$old_want_arg $arg" ;; -u) arg="-u $arg" ;; -Y)dnldnl Should probably try to ensure unique directory options here too.dnl This probably only applies to Solaris systems, and then will onlydnl work with gcc...dnl arg=`echo $arg | sed -e 's%^P,%%'` SAVE_IFS=$IFS IFS=: list= for elt in $arg; do list="$list -L$elt" done IFS=$SAVE_IFS arg="$list" ;; esacdnl if test -n "$arg"; then flibs="$flibs $arg" fidoneif test -n "$ld_run_path"; then flibs_result="$ld_run_path $flibs"else flibs_result="$flibs"fichangequote([, ])dnlac_cv_flibs="$flibs_result"])FLIBS="$ac_cv_flibs"AC_SUBST(FLIBS)dnlAC_MSG_RESULT($FLIBS)])dnl ### Checks for operating system servicesAC_DEFUN(AC_SYS_INTERPRETER,[# Pull the hash mark out of the macro call to avoid m4 problems.ac_msg="whether #! works in shell scripts"AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter,[echo '#! /bin/catexit 69' > conftestchmod u+x conftest(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)if test $? -ne 69; then ac_cv_sys_interpreter=yeselse ac_cv_sys_interpreter=nofi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -