[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Check if the compiler supports c99
From: |
Carlos Eduardo Rodrigues Diógenes |
Subject: |
Check if the compiler supports c99 |
Date: |
Wed, 19 Apr 2006 20:30:48 -0300 |
Hi,
I'm not a experiencied user/programmer in the unix world, but I start to
maintaim the gnome-mag code sometime ago, so I'm still have some
difficulties in understand some concepts of autoconf and how to search
for information, so I think that ask it here is not so bad ;-).
I need to use round () in a part of the code and I saw that in GCC I
must pass the -std=c99 option to the compiler and the -lm option to the
linker.
I yet put it in my configure.in:
AC_CHECK_LIB(m, round, [M_LIBS="-lm"], AC_MSG_ERROR([libm is
required to build gnome-mag. This lib comes with GNU C libraries
(glibc) and you can find the lastest version from
http://www.gnu.org/software/libc/]))
AC_SUBST(M_LIBS)
This work for me check if the function round is present in libm, but if
I call this function in my code without the option -std=c99 to the
compiler, the code does not work properly. I found a middle solution
that is declare round () as an extern function.
But, for me this is not the best solution. If I could check if the
compiler supports the -std=c99 option I can use it to compile the code
and only declare round () as extern if the -std=c99 is not present but
the round function is in the libm.
I thinked in use AC_COMPILE_IFELSE, but don't realize how this can be
used to achieve this goal.
Any help will be very appreciated.
Thanks,
--
Carlos Eduardo Rodrigues Diógenes
- Check if the compiler supports c99,
Carlos Eduardo Rodrigues Diógenes <=