Skip to content

Commit 652c33d

Browse files
committed
added HAS_SPICELIB preprocessor if building with spice support
1 parent bdbfc67 commit 652c33d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/spice_ephemeris_module.f90 renamed to src/spice_ephemeris_module.F90

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module spice_ephemeris_module
3636

3737
end type spice_ephemeris
3838

39+
#ifdef HAS_SPICELIB
3940
!these routines are in the SPICELIB:
4041
interface
4142
subroutine trcoff()
@@ -83,6 +84,7 @@ subroutine spkgps ( targ, et, ref, obs, pos, lt )
8384
real(wp) :: lt
8485
end subroutine spkgps
8586
end interface
87+
#endif
8688

8789
contains
8890
!*****************************************************************************************
@@ -99,6 +101,8 @@ subroutine close_spice_ephemeris(me)
99101

100102
integer :: i !! counter
101103

104+
#ifdef HAS_SPICELIB
105+
102106
!unload all the kernels:
103107
if (allocated(me%kernels)) then
104108
do i=1,size(me%kernels)
@@ -110,6 +114,10 @@ subroutine close_spice_ephemeris(me)
110114
!clear the system:
111115
call kclear()
112116

117+
#else
118+
error stop 'this library was not built with SPICELIB support'
119+
#endif
120+
113121
end subroutine close_spice_ephemeris
114122
!*****************************************************************************************
115123

@@ -126,6 +134,8 @@ subroutine initialize_spice_ephemeris(me,kernels)
126134

127135
integer :: i !! counter
128136

137+
#ifdef HAS_SPICELIB
138+
129139
! disable the SPICE traceback system to speed it up.
130140
call trcoff()
131141

@@ -139,6 +149,10 @@ subroutine initialize_spice_ephemeris(me,kernels)
139149
call furnsh(trim(kernels(i)))
140150
end do
141151

152+
#else
153+
error stop 'this library was not built with SPICELIB support'
154+
#endif
155+
142156
end subroutine initialize_spice_ephemeris
143157
!*****************************************************************************************
144158

@@ -164,10 +178,16 @@ subroutine get_rv_from_spice_ephemeris(me,et,targ,obs,rv,status_ok)
164178

165179
real(wp) :: lt !! light time output from spkgeo
166180

181+
#ifdef HAS_SPICELIB
182+
167183
call spkgeo ( targ%id, et, 'J2000', obs%id, rv, lt )
168184

169185
status_ok = .not. failed()
170186

187+
#else
188+
error stop 'this library was not built with SPICELIB support'
189+
#endif
190+
171191
end subroutine get_rv_from_spice_ephemeris
172192
!*****************************************************************************************
173193

@@ -193,10 +213,16 @@ subroutine get_r_from_spice_ephemeris(me,et,targ,obs,r,status_ok)
193213

194214
real(wp) :: lt !! light time output from spkgeo
195215

216+
#ifdef HAS_SPICELIB
217+
196218
call spkgps ( targ%id, et, 'J2000', obs%id, r, lt )
197219

198220
status_ok = .not. failed()
199221

222+
#else
223+
error stop 'this library was not built with SPICELIB support'
224+
#endif
225+
200226
end subroutine get_r_from_spice_ephemeris
201227
!*****************************************************************************************
202228

0 commit comments

Comments
 (0)