@@ -0,0 +1,250 @@
+--- gsm-1.0-pl12/Makefile
++++ gsm-1.0-pl12/Makefile
+@@ -96,7 +96,7 @@
+ # Other tools
+
+ SHELL = /bin/sh
+-LN = ln
++LN = ln -s
+ BASENAME = basename
+ AR = ar
+ ARFLAGS = cr
+@@ -140,6 +140,7 @@
+ # Targets
+
+ LIBGSM = $(LIB)/libgsm.a
++LIBGSMSO= $(LIB)/libgsm.so
+
+ TOAST = $(BIN)/toast
+ UNTOAST = $(BIN)/untoast
+@@ -279,7 +280,7 @@
+
+ # Target rules
+
+-all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
++all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
+ @-echo $(ROOT): Done.
+
+ tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
+@@ -299,6 +300,11 @@
+
+ # The basic API: libgsm
+
++$(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
++ $(LD) -o $@.1.0.12 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
++ ln -fs libgsm.so.1.0.12 lib/libgsm.so.1
++ ln -fs libgsm.so.1.0.12 lib/libgsm.so
++
+ $(LIBGSM): $(LIB) $(GSM_OBJECTS)
+ -rm $(RMFLAGS) $(LIBGSM)
+ $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
+@@ -308,15 +314,15 @@
+ # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
+
+ $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
+- $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
++ $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
+
+ $(UNTOAST): $(BIN) $(TOAST)
+ -rm $(RMFLAGS) $(UNTOAST)
+- $(LN) $(TOAST) $(UNTOAST)
++ $(LN) toast $(UNTOAST)
+
+ $(TCAT): $(BIN) $(TOAST)
+ -rm $(RMFLAGS) $(TCAT)
+- $(LN) $(TOAST) $(TCAT)
++ $(LN) toast $(TCAT)
+
+
+ # The local bin and lib directories
+@@ -426,7 +432,9 @@
+
+ clean: semi-clean
+ -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
+- $(TOAST) $(TCAT) $(UNTOAST) \
++ $(LIBGSMSO) $(LIB)/libgsm.so.1.0.12 \
++ $(LIB)libgsm.so.1 \
++ $(TOAST) $(TCAT) $(UNTOAST) \
+ $(ROOT)/gsm-1.0.tar.Z
+
+
+--- gsm-1.0-pl12/inc/config.h
++++ gsm-1.0-pl12/inc/config.h
+@@ -13,6 +13,7 @@
+ /*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */
+
+ #define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
++#define HAS_STDIO_H 1 /* /usr/include/stdio.h */
+ #define HAS_LIMITS_H 1 /* /usr/include/limits.h */
+ #define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */
+ #define HAS_ERRNO_DECL 1 /* errno.h declares errno */
+@@ -25,7 +26,7 @@
+ /*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */
+
+ #define HAS_STRING_H 1 /* /usr/include/string.h */
+-/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */
++#define HAS_STRINGS_H 1 /* /usr/include/strings.h */
+
+ #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
+ #define HAS_UTIME 1 /* POSIX utime(path, times) */
+--- gsm-1.0-pl12/inc/gsm.h
++++ gsm-1.0-pl12/inc/gsm.h
+@@ -54,6 +54,10 @@
+ #define GSM_OPT_FRAME_INDEX 5
+ #define GSM_OPT_FRAME_CHAIN 6
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern gsm gsm_create GSM_P((void));
+ extern void gsm_destroy GSM_P((gsm));
+
+@@ -66,6 +70,10 @@
+ extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
+ extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
+
++#ifdef __cplusplus
++}
++#endif
++
+ #undef GSM_P
+
+ #endif /* GSM_H */
+--- gsm-1.0-pl12/inc/toast.h
++++ gsm-1.0-pl12/inc/toast.h
+@@ -16,11 +16,12 @@
+
+ #include <stdio.h>
+ #include <ctype.h>
++#include <pthread.h>
+ #include <signal.h>
+
+ #include <errno.h>
+-#ifndef HAS_ERRNO_DECL
+- extern int errno;
++#ifndef errno
++ extern int errno;
+ #endif
+
+ #ifdef HAS_LIMITS_H
+@@ -37,6 +38,10 @@
+ # endif
+ #endif
+
++#ifdef HAS_STDIO_H
++# include <stdio.h>
++#endif
++
+ #include "gsm.h"
+
+ #ifndef S_ISREG
+--- gsm-1.0-pl12/src/code.c
++++ gsm-1.0-pl12/src/code.c
+@@ -9,8 +9,8 @@
+ #include "config.h"
+
+
+-#ifdef HAS_STDLIB_H
+-#include <stdlib.h>
++#ifdef HAS_STRING_H
++#include <string.h>
+ #else
+ # include "proto.h"
+ extern char * memcpy P((char *, char *, int));
+--- gsm-1.0-pl12/src/debug.c
++++ gsm-1.0-pl12/src/debug.c
+@@ -49,7 +49,7 @@
+ fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
+ while (from <= to) {
+
+- fprintf(stderr, "%d ", ptr[ from ] );
++ fprintf(stderr, "%ld ", ptr[ from ] );
+ from++;
+ if (nprinted++ >= 7) {
+ nprinted = 0;
+@@ -63,14 +63,14 @@
+ char * name,
+ longword value )
+ {
+- fprintf(stderr, "%s: %d\n", name, (long)value );
++ fprintf(stderr, "%s: %ld\n", name, (long)value );
+ }
+
+ void gsm_debug_word P2( (name, value),
+ char * name,
+ word value )
+ {
+- fprintf(stderr, "%s: %d\n", name, (long)value);
++ fprintf(stderr, "%s: %ld\n", name, (long)value);
+ }
+
+ #endif
+--- gsm-1.0-pl12/src/toast.c
++++ gsm-1.0-pl12/src/toast.c
+@@ -251,8 +251,8 @@
+ {
+ char * s;
+ if (!(s = malloc(len))) {
+- fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
+- progname, len);
++ fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
++ progname, (long) len);
+ onintr();
+ exit(1);
+ }
+@@ -270,7 +270,7 @@
+ maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
+ p = strcpy(emalloc(maxlen), name);
+
|