forked from OS2World/LIB-libgpg-error
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos2.diff
134 lines (119 loc) · 4.13 KB
/
os2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
diff --git a/configure.ac b/configure.ac
index 3565b1a..cbf6d12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ AC_GNU_SOURCE
have_w32_system=no
have_w64_system=no
have_w32ce_system=no
+have_os2_system=no
case "${host}" in
x86_64-*mingw32*)
have_w32_system=yes
@@ -101,6 +102,9 @@ case "${host}" in
*-mingw32*)
have_w32_system=yes
;;
+ *-os2*)
+ have_os2_system=yes
+ ;;
*)
;;
esac
@@ -236,6 +240,10 @@ AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
AC_DEFINE_UNQUOTED(HOST_TRIPLET_STRING, "$host", [The host triplet])
+if test "$have_os2_system" = yes; then
+ AC_DEFINE(HAVE_OS2_SYSTEM,1,[Defined if we run on an OS/2 API based system])
+fi
+AM_CONDITIONAL(HAVE_OS2_SYSTEM, test "$have_os2_system" = yes)
#
# Provide information about the build.
diff --git a/src/Makefile.am b/src/Makefile.am
index e201cee..76920b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,9 +65,9 @@ BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
tmp_files = _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c
CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
- gpg-error.h mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
+ gpg-error.h mkerrcodes$(EXEEXT) mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
- gpg-extra/errno.h mkheader $(tmp_files) lock-obj-pub.native.h
+ gpg-extra/errno.h mkheader$(EXEEXT) $(tmp_files) lock-obj-pub.native.h
if HAVE_W32_SYSTEM
arch_sources = w32-gettext.c w32-lock.c w32-lock-obj.h w32-thread.c
@@ -97,7 +97,11 @@ intllibs =
else
arch_sources = posix-lock.c posix-lock-obj.h posix-thread.c
gpg_error_res =
+if HAVE_OS2_SYSTEM
+no_undefined = -no-undefined
+else
no_undefined =
+endif
export_symbols =
install-def-file:
uninstall-def-file:
@@ -181,7 +185,7 @@ gpg-error.def: Makefile gpg-error.def.in
# It is correct to use $(CC_FOR_BUILD) here. We want to run the
# program at build time.
-mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
+mkerrcodes$(EXEEXT): mkerrcodes.c mkerrcodes.h Makefile
$(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
if HAVE_W32CE_SYSTEM
@@ -191,7 +195,7 @@ mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile
$(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
endif
-code-from-errno.h: mkerrcodes Makefile
+code-from-errno.h: mkerrcodes$(EXEEXT) Makefile
./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
errnos-sym.h: Makefile mkstrtable.awk errnos.in
@@ -200,7 +204,7 @@ errnos-sym.h: Makefile mkstrtable.awk errnos.in
$(srcdir)/errnos.in >$@
-mkheader: mkheader.c Makefile
+mkheader$(EXEEXT): mkheader.c Makefile
$(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
parts_of_gpg_error_h = \
@@ -220,13 +224,13 @@ else
pre_mkheader_cmds = :
parts_of_gpg_error_h += ./lock-obj-pub.native.h
-lock-obj-pub.native.h: Makefile gen-posix-lock-obj posix-lock-obj.h
+lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h
./gen-posix-lock-obj >$@
endif
# We also depend on versioninfo.rc because that is build by
# config.status and thus has up-to-date version numbers.
-gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) versioninfo.rc
+gpg-error.h: Makefile mkheader$(EXEEXT) $(parts_of_gpg_error_h) versioninfo.rc
$(pre_mkheader_cmds)
./mkheader $(host_os) $(host_triplet) $(srcdir)/gpg-error.h.in \
$(PACKAGE_VERSION) $(VERSION_NUMBER) >$@
diff --git a/src/posix-thread.c b/src/posix-thread.c
index a739e40..4316f38 100644
--- a/src/posix-thread.c
+++ b/src/posix-thread.c
@@ -33,7 +33,12 @@
#if USE_POSIX_THREADS
# ifdef _POSIX_PRIORITY_SCHEDULING
-# include <sched.h>
+# ifdef __OS2__
+# define INCL_DOS
+# include <os2.h>
+# else
+# include <sched.h>
+# endif
# endif
#elif USE_SOLARIS_THREADS
# include <thread.h>
@@ -49,7 +54,11 @@ gpgrt_yield (void)
{
#if USE_POSIX_THREADS
# ifdef _POSIX_PRIORITY_SCHEDULING
+# ifdef __OS2__
+ DosSleep (1);
+# else
sched_yield ();
+# endif
# else
return GPG_ERR_NOT_SUPPORTED;
# endif