d_Gconvert=''
d_getaddrinfo=''
d_getcwd=''
+d_getenv_preserves_other_thread=''
d_getespwnam=''
d_getfsstat=''
d_getgrent=''
-r : reuse C symbols value if possible (skips costly nm extraction).
-s : silent mode, only echoes questions and essential information.
-D : define symbol to have some value:
- -D symbol symbol gets the value 'define'
- -D symbol=value symbol gets the value 'value'
+ -D symbol symbol gets the value 'define'
+ -D symbol='some value' symbol is set to 'some value'
common used examples (see INSTALL for more info):
-Duse64bitint use 64bit integers
-Duse64bitall use 64bit integers and pointers
* The Motorola 68881 had another "extended precision" format:
* sign:1 exp:15 zero:16 integer:1 mantissa:63
* for total of 96 bits of bytes. The zero bits were unused.
- * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
- * If it ever becomes relevant, this format should be allocated
- * a new doublekind code since it's quite different from the Intel x87.
+ * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
+ * If it ever becomes relevant, this format should be allocated a
+ * new doublekind code since it is quite different from the Intel x87.
*/
printf("4\n");
exit(0);
}
}
+void lencheck(int expect, int got)
+{
+ if (expect != got) {
+ printf("%s length mismatch: Expected %d, got %d\n",
+ myname, expect, got);
+ exit(1);
+ }
+}
+
int main()
{
char buf[64];
else
checkit("1e+34", buf);
+ /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See: *
+ * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
+
+ Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
+ lencheck(55, (int)strlen(buf));
+
/* For Perl, if you add additional tests here, also add them to
* t/base/num.t for benefit of platforms not using Configure or
* overriding d_Gconvert */
set getcwd d_getcwd
eval $inlibc
+: check for getenv behavior
+case "$d_getenv_preserves_other_thread" in
+'')
+$echo "Checking to see if getenv() preserves a different thread's results" >&4
+$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+# include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#$i_pthread I_PTHREAD
+#ifdef I_PTHREAD
+# include <pthread.h>
+#endif
+
+void *
+thread_start(void * arg)
+{
+ (void *) getenv("HOME");
+}
+
+int main() {
+ char * main_buffer;
+ char save_main_buffer[1000];
+ pthread_t subthread;
+ pthread_attr_t attr;
+
+ main_buffer = getenv("PATH");
+
+ /* If too large for our generous allowance, return we couldn't figure it
+ * out. */
+ if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
+ exit(2);
+ }
+
+ strcpy(save_main_buffer, main_buffer);
+
+ if (pthread_attr_init(&attr) != 0) {
+ exit(2);
+ }
+
+ if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
+ exit(2);
+ }
+
+ if (pthread_join(subthread, NULL) != 0) {
+ exit(2);
+ }
+
+ exit(! strcmp(main_buffer, save_main_buffer) == 0);
+}
+EOCP
+val=
+set try
+if eval $compile_ok; then
+ $run ./try
+ rc=$?
+ case "$rc" in
+ 0) echo "getenv() didn't destroy another thread's buffer" >&4
+ val=$define
+ ;;
+ 1) echo "getenv() does destroy another thread's buffer" >&4
+ val=$undef
+ ;;
+ *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
+ val=$undef
+ ;;
+ esac
+else
+ echo "(I can't seem to compile the test program.)" >&4
+ echo "Assuming that your C library's getenv destroys another thread's return value." >&4
+ val=$undef
+fi
+set d_getenv_preserves_other_thread
+eval $setvar
+$rm_try
+;;
+esac
+
: see if getespwnam exists
set getespwnam d_getespwnam
eval $inlibc
d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
d_getaddrinfo='$d_getaddrinfo'
d_getcwd='$d_getcwd'
+d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
d_getespwnam='$d_getespwnam'
d_getfsstat='$d_getfsstat'
d_getgrent='$d_getgrent'