Newer
Older
fi
])
dnl CHECK_NEED_REENTRANT_FUNCTIONS_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl makes several _r functions compiler visible.
dnl Internal macro for CONFIGURE_REENTRANT.
AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R], [
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_STRERROR_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_STRTOK_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_LOCALTIME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GMTIME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_INET_NTOA_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GETSERVBYPORT_R
fi
])
AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG], [
CHECK_NEED_REENTRANT_STRERROR_R
CHECK_NEED_REENTRANT_LOCALTIME_R
CHECK_NEED_REENTRANT_GMTIME_R
CHECK_NEED_REENTRANT_INET_NTOA_R
CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
CHECK_NEED_REENTRANT_GETSERVBYPORT_R
])
dnl CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
dnl -------------------------------------------------
dnl This macro ensures that configuration tests done
dnl after this will execute with preprocessor symbol
dnl _REENTRANT defined. This macro also ensures that
dnl the generated config file will equally define it.
dnl Internal macro for CONFIGURE_REENTRANT.
AC_DEFUN([CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
AH_VERBATIM([NEED_REENTRANT],
[/* Configure process defines NEED_REENTRANT to 1 when it finds out that */
/* _REENTRANT is required or already defined for proper configuration. */
@%:@undef NEED_REENTRANT
@%:@if defined(NEED_REENTRANT) && !defined(_REENTRANT)
@%:@ define _REENTRANT
@%:@endif])
cat >>confdefs.h <<_ACEOF
[@%:@ifndef _REENTRANT
@%:@ define _REENTRANT
@%:@endif]
_ACEOF
AC_DEFINE(NEED_REENTRANT, 1, [])
])
dnl CONFIGURE_REENTRANT
dnl -------------------------------------------------
dnl This first checks if the preprocessor _REENTRANT
dnl symbol is already defined. If it isn't currently
dnl defined a set of checks are performed to verify
dnl if its definition is required to make visible to
dnl the compiler a set of *_r functions. Finally, if
dnl _REENTRANT is already defined or needed it takes
dnl care of making adjustments necessary to ensure
dnl that it is defined equally for further configure
dnl tests and generated config file.
AC_DEFUN([CONFIGURE_REENTRANT], [
#
AC_MSG_CHECKING([if _REENTRANT is already defined])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
]],[[
#ifdef _REENTRANT
int dummy=1;
#else
force compilation error
#endif
]])
],[
AC_MSG_RESULT([yes])
tmp_reentrant_initially_defined="yes"
],[
AC_MSG_RESULT([no])
tmp_reentrant_initially_defined="no"
])
#
if test "$tmp_reentrant_initially_defined" = "no"; then
AC_MSG_CHECKING([if _REENTRANT is actually needed])
ac_cv_need_reentrant="no"
CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG
if test "$ac_cv_need_reentrant" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
#
AC_MSG_CHECKING([if _REENTRANT is onwards defined])
if test "$tmp_reentrant_initially_defined" = "yes" ||
test "$ac_cv_need_reentrant" = "yes"; then
CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#
])