root/branches/mcstas-1.x/aclocal.m4
| Revision 2058, 2.6 KB (checked in by pkwi, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | # |
| 2 | # This file is part of the McStas neutron ray-trace simulation package |
| 3 | # Copyright (C) 1997-2004, All rights reserved |
| 4 | # Risoe National Laborartory, Roskilde, Denmark |
| 5 | # Institut Laue Langevin, Grenoble, France |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; version 2 of the License. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program; if not, write to the Free Software |
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | # |
| 20 | AC_DEFUN([CF_ANSI_CC_CHECK], |
| 21 | [ |
| 22 | AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) |
| 23 | AC_CACHE_VAL(cf_cv_ansi_cc,[ |
| 24 | cf_cv_ansi_cc=no |
| 25 | cf_save_CFLAGS="$CFLAGS" |
| 26 | # Don't try gcc -ansi; that turns off useful extensions and |
| 27 | # breaks some systems' header files. |
| 28 | # AIX -qlanglvl=ansi |
| 29 | # Ultrix and OSF/1 -std1 |
| 30 | # HP-UX -Aa -D_HPUX_SOURCE |
| 31 | # SVR4 -Xc |
| 32 | # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) |
| 33 | for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc |
| 34 | do |
| 35 | CFLAGS="$cf_save_CFLAGS $cf_arg" |
| 36 | AC_TRY_COMPILE( |
| 37 | [ |
| 38 | #ifndef CC_HAS_PROTOS |
| 39 | #if !defined(__STDC__) || __STDC__ != 1 |
| 40 | choke me |
| 41 | #endif |
| 42 | #endif |
| 43 | ],[ |
| 44 | int test (int i, double x); |
| 45 | struct s1 {int (*f) (int a);}; |
| 46 | struct s2 {int (*f) (double a);};], |
| 47 | [cf_cv_ansi_cc="$cf_arg"; break]) |
| 48 | done |
| 49 | CFLAGS="$cf_save_CFLAGS" |
| 50 | ]) |
| 51 | AC_MSG_RESULT($cf_cv_ansi_cc) |
| 52 | |
| 53 | if test "$cf_cv_ansi_cc" != "no"; then |
| 54 | if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then |
| 55 | CFLAGS="$CFLAGS $cf_cv_ansi_cc" |
| 56 | else |
| 57 | AC_DEFINE(CC_HAS_PROTOS) |
| 58 | fi |
| 59 | fi |
| 60 | ])dnl |
| 61 | |
| 62 | |
| 63 | AC_DEFUN([MC_ANSI_MATH_PROTO], |
| 64 | [ |
| 65 | AC_MSG_CHECKING(for proper ANSI C math prototypes) |
| 66 | AC_CACHE_VAL(mc_cv_ansi_math_proto,[ |
| 67 | # OSF/1 (Digital/Compaq Unix) cc needs -std1 for full ANSI C math prototypes |
| 68 | AC_TRY_COMPILE( |
| 69 | [ |
| 70 | #include <math.h> |
| 71 | ],[ |
| 72 | { double a = sqrt(&a); }], |
| 73 | [mc_save_CFLAGS="$CFLAGS" |
| 74 | CFLAGS="$cf_save_CFLAGS -std1" |
| 75 | AC_TRY_COMPILE( |
| 76 | [ |
| 77 | #include <math.h> |
| 78 | ],[ |
| 79 | { double a = sqrt(&a); }], |
| 80 | [mc_cv_ansi_math_proto=no],[mc_cv_ansi_math_proto="-std1"]) |
| 81 | CFLAGS="$cf_save_CFLAGS"],[mc_cv_ansi_math_proto=yes]) |
| 82 | ]) |
| 83 | AC_MSG_RESULT($mc_cv_ansi_math_proto) |
| 84 | |
| 85 | if test "$mc_cv_ansi_math_proto" != "yes"; then |
| 86 | if test "$mc_cv_ansi_math_proto" != "no"; then |
| 87 | CFLAGS="$CFLAGS $mc_cv_ansi_math_proto" |
| 88 | else |
| 89 | AC_MSG_WARN(C compiler seems not to do ANSI math prototypes) |
| 90 | fi |
| 91 | fi |
| 92 | ])dnl |
Note: See TracBrowser
for help on using the browser.
