Skip to content

Commit

Permalink
Ensure SIZEOF_FORTRAN_T is not empty
Browse files Browse the repository at this point in the history
Makes sure that SIZEOF_FORTRAN_T is not given an empty
value that can bypass ifdef, and warns the user. Also
Checks in the Makefile for libAtoms that it has been
properly set so that compile failures are less confusing.

Fixes #26
  • Loading branch information
tdaff committed Feb 7, 2017
1 parent 21b8e64 commit 05a2989
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bin/find_sizeof_fortran_t
Expand Up @@ -33,8 +33,17 @@ program sizeof_fortran_t
end program sizeof_fortran_t
EOF

make -I ../../arch -I../.. sizeof_fortran_t > /dev/null
echo SIZEOF_FORTRAN_T=$(./sizeof_fortran_t)
# Using && prevents an empty value being added to the makefile
make -I ../../arch -I../.. sizeof_fortran_t > /dev/null && \
echo SIZEOF_FORTRAN_T=$(./sizeof_fortran_t)

# Try to warn that something is wrong
if [ $? -ne 0 ]; then
echo >&2
echo Unable to determine SIZEOF_FORTRAN_T >&2
echo Check that your compiler is working and try again! >&2
echo >&2
fi

rm sizeof_fortran_t.f90
rm sizeof_fortran_t
Expand Down
4 changes: 4 additions & 0 deletions src/libAtoms/Makefile
Expand Up @@ -44,6 +44,10 @@ endif
include Makefile.inc
include Makefile.rules

# indicator that compiler is not set up properly
ifeq (${SIZEOF_FORTRAN_T},)
$(error SIZEOF_FORTRAN_T is not set. Check compiler and re-run 'make config')
endif

LIBATOMS_F95_FILES = \
error \
Expand Down

0 comments on commit 05a2989

Please sign in to comment.