@@ -671,6 +671,13 @@ int ModelicaInternal_getNumberOfFiles(_In_z_ const char* directory) {
671671
672672_Ret_z_ const char * ModelicaInternal_fullPathName (_In_z_ const char * name ) {
673673 /* Get full path name of file or directory */
674+ #undef MODELICA_INTERNAL_HAVE_POSIX_REALPATH
675+ #if defined(_BSD_SOURCE ) || \
676+ (defined(_XOPEN_SOURCE ) && _XOPEN_SOURCE >= 500 ) || \
677+ (defined(_XOPEN_SOURCE ) && defined(_XOPEN_SOURCE_EXTENDED )) || \
678+ _POSIX_VERSION >= 200112L
679+ #define MODELICA_INTERNAL_HAVE_POSIX_REALPATH
680+ #endif
674681
675682#if defined(_WIN32 )
676683 char * fullName ;
@@ -684,7 +691,7 @@ _Ret_z_ const char* ModelicaInternal_fullPathName(_In_z_ const char* name) {
684691 fullName = ModelicaDuplicateString (tempName );
685692 ModelicaConvertToUnixDirectorySeparator (fullName );
686693 return fullName ;
687- #elif ( _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _POSIX_VERSION >= 200112L )
694+ #elif defined( MODELICA_INTERNAL_HAVE_POSIX_REALPATH )
688695 char * fullName ;
689696 char localbuf [BUFFER_LENGTH ];
690697 size_t len ;
@@ -710,10 +717,10 @@ _Ret_z_ const char* ModelicaInternal_fullPathName(_In_z_ const char* name) {
710717 return fullName ;
711718#endif
712719
713- #if ( _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _POSIX_VERSION >= 200112L )
720+ #if defined( MODELICA_INTERNAL_HAVE_POSIX_REALPATH )
714721FALLBACK_getcwd :
715722#endif
716- #if ( _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || _POSIX_VERSION >= 200112L || _POSIX_ )
723+ #if defined( MODELICA_INTERNAL_HAVE_POSIX_REALPATH ) || defined( _POSIX_ )
717724 {
718725 /* No such system call in _POSIX_ available (except realpath for existing paths) */
719726 char * cwd = getcwd (localbuf , sizeof (localbuf ));
@@ -734,6 +741,7 @@ _Ret_z_ const char* ModelicaInternal_fullPathName(_In_z_ const char* name) {
734741 }
735742 return fullName ;
736743#endif
744+ #undef MODELICA_INTERNAL_HAVE_POSIX_REALPATH
737745}
738746
739747_Ret_z_ const char * ModelicaInternal_temporaryFileName (void ) {
0 commit comments