Use portable way to remove carriage returns.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
diff --git a/tests/parser.sh b/tests/parser.sh
index eb885e5..9829bbe 100755
--- a/tests/parser.sh
+++ b/tests/parser.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+# Copyright (C) 2021 Free Software Foundation, Inc.
 # Copyright (C) 2019 Red Hat, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -32,6 +33,17 @@
 	exit 1
 fi
 
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+# normalize output
+LC_ALL=C tr -d "$cr" < $TMPFILE > x$TMPFILE
+mv x$TMPFILE $TMPFILE
+
 diff ${TMPFILE} ${srcdir}/pkix.asn.out
 
 if test $? != 0;then