Skip to content

Commit

Permalink
pal: Use __STDC_VERSION__ if config.h is not being used
Browse files Browse the repository at this point in the history
So in the absence of configure tests we assume copysign() is
available if __STDC_VERSION__ indicates we are using c99.
  • Loading branch information
timj committed Jun 22, 2012
1 parent 4495ec8 commit 0a04330
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- component.xml. Generated from component.xml.in by configure. -->

<component id="pal" support="S">
<version>0.1.2</version>
<version>0.1.3</version>
<path>libraries/pal</path>
<description>Position Astronomy Library</description>
<abstract><p>
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script
AC_REVISION($Revision: 27534 $)

dnl Initialisation: package name and version number
AC_INIT(pal, 0.1.2, [email protected])
AC_INIT(pal, 0.1.3, [email protected])

dnl Require autoconf-2.50 at least
AC_PREREQ(2.50)
Expand Down
19 changes: 15 additions & 4 deletions palDfltin.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
* Initial version based on strtod
* 2012-06-21 (TIMJ):
* Provide a backup for missing copysign.
* 2012-06-22 (TIMJ):
* Check __STDC_VERSION__
* {enter_further_changes_here}
* Copyright:
Expand Down Expand Up @@ -89,14 +91,23 @@
*-
*/

#if HAVE_CONFIG_H
#include <config.h>
#endif

/* Shenanigans for isblank() which is C99 only */
#define _POSIX_C_SOURCE 200112L
#define _ISOC99_SOURCE

/* Use the config file if we have one, else look at
compiler defines to see if we have C99 */
#if HAVE_CONFIG_H
#include <config.h>
#else
#ifdef __STDC_VERSION__
# if (__STDC_VERSION__ >= 199901L)
# define HAVE_COPYSIGN 1
# endif
#endif
#endif

/* System include files */
#include <stdlib.h>
#include <string.h>
#include <errno.h>
Expand Down
10 changes: 10 additions & 0 deletions palPertue.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
* Initial version direct conversion of SLA/F.
* 2012-06-21 (TIMJ):
* Support a lack of copysign() function.
* 2012-06-22 (TIMJ):
* Check __STDC_VERSION__
* {enter_further_changes_here}
* Copyright:
Expand Down Expand Up @@ -180,8 +182,16 @@
*-
*/

/* Use the config file if we have one, else look at
compiler defines to see if we have C99 */
#if HAVE_CONFIG_H
#include <config.h>
#else
#ifdef __STDC_VERSION__
# if (__STDC_VERSION__ >= 199901L)
# define HAVE_COPYSIGN 1
# endif
#endif
#endif

#include <math.h>
Expand Down

0 comments on commit 0a04330

Please sign in to comment.