Commit afde7866dc5f37b7427d8a34fcabd5384298b4fa

Authored by Perry Werneck
1 parent 197dc506
Exists in master

Refactoring configuration for version 5.2.

.gitignore
... ... @@ -21,4 +21,5 @@ rpm/RPMS
21 21 rpm/SOURCES
22 22 rpm/SPECS
23 23 rpm/SRPMS
24   -
  24 +scripts
  25 +*.[0-9]
... ...
autogen.sh
1 1 #!/bin/bash
2 2  
3   -APPLEVEL="0"
4   -
5 3 test -n "$srcdir" || srcdir=`dirname "$0"`
6 4 test -n "$srcdir" || srcdir=.
7 5  
8 6 olddir=`pwd`
9 7 cd "$srcdir"
10 8  
11   -if test -e revision ; then
12   - . revision
13   -fi
14   -
15   -touch ChangeLog
16   -
17   -# Inicia com os defaults
18   -TEMPFILE=autogen.tmp
19   -
20   -if [ -d .svn ]; then
21   -
22   - # Tenta detectar a versão
23   - SVNVERSION=$(which svnversion 2> /dev/null)
24   - if test -x "${SVNVERSION}" ; then
25   - svnversion | cut -d: -f2 | sed 's@[M|m]@@g' > ${TEMPFILE} 2> /dev/null
26   - if [ "$?" == "0" ]; then
27   - PACKAGE_REVISION=$(cat ${TEMPFILE})
28   - fi
29   - fi
30   -
31   - # Tenta detectar a URL
32   - SVN=$(which svn 2> /dev/null)
33   - if test -x "${SVN}" ; then
34   -
35   - LANG="EN_US" "${SVN}" info > ${TEMPFILE} 2>&1
36   - if [ "$?" == "0" ]; then
37   - PACKAGE_SOURCE=$(cat ${TEMPFILE} | grep "^URL: " | cut -d" " -f2)
38   - fi
39   -
40   - fi
41   -
42   -elif [ -d .git ]; then
43   -
44   - # Obtém revisão via git
45   - # Referência: http://stackoverflow.com/questions/4120001/what-is-the-git-equivalent-for-revision-number
46   -
47   - # Obtém URL via git
48   - PACKAGE_SOURCE=$(git config --get remote.origin.url)
49   -
50   - # Obtém número total de commits
51   - PACKAGE_REVISION=$(git rev-list HEAD --count)
52   -
53   -fi
54   -
55   -
56   -rm -f $TEMPFILE
57   -
58   -if test -z ${PACKAGE_REVISION} ; then
59   - echo "Can´t detect package revision, using current date"
60   - PACKAGE_REVISION=`date +%y%m%d`
61   -fi
62   -
63   -if test -z ${PACKAGE_SOURCE} ; then
64   - echo "Can´t detect package source"
65   - exit -1
66   -fi
67   -
68   -#echo "PACKAGE_REVISION=${PACKAGE_REVISION}" > $srcdir/revision
69   -#echo "PACKAGE_SOURCE=${PACKAGE_SOURCE}" >> $srcdir/revision
70   -#echo "PACKAGE_LEVEL=${APPLEVEL}" >> $srcdir/revision
71   -
72   -#echo "m4_define([SVN_REVISION], ${PACKAGE_REVISION})" > $srcdir/revision.m4
73   -#echo "m4_define([SVN_URL], ${PACKAGE_SOURCE})" >> $srcdir/revision.m4
74   -#echo "m4_define([APP_LEVEL], ${APPLEVEL})" >> $srcdir/revision.m4
75   -
76 9 aclocal
77 10 if test $? != 0 ; then
78 11 echo "aclocal failed."
... ... @@ -85,10 +18,12 @@ if test $? != 0 ; then
85 18 exit -1
86 19 fi
87 20  
  21 +mkdir -p scripts
  22 +automake --add-missing 2> /dev/null | true
  23 +
88 24 cd "$olddir"
89 25 test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
90 26  
91   -echo "Package set to revision $PACKAGE_REVISION and source $PACKAGE_SOURCE"
92 27  
93 28  
94 29  
... ...
configure.ac
... ... @@ -27,11 +27,11 @@ dnl
27 27 dnl Process this file with autoconf to produce a configure script.
28 28  
29 29 dnl The minimum version of autoconf required.
30   -AC_PREREQ(2.59)
  30 +AC_PREREQ(2.61)
31 31  
32 32 dnl Initialise automake with the package name, version and
33 33 dnl bug-reporting address.
34   -AC_INIT([python-pw3270], [5.1], [perry.werneck@gmail.com])
  34 +AC_INIT([py3270], [5.2], [perry.werneck@gmail.com])
35 35  
36 36 dnl Place auxilliary scripts here.
37 37 AC_CONFIG_AUX_DIR([scripts])
... ... @@ -40,7 +40,7 @@ dnl Compute the canonical host-system type
40 40 AC_CANONICAL_HOST
41 41  
42 42 dnl Put macro definitions here (though they aren't used).
43   -AC_CONFIG_HEADER([src/config.h])
  43 +AC_CONFIG_HEADER([src/include/config.h])
44 44  
45 45 dnl Initialise automake stuff.
46 46 AM_INIT_AUTOMAKE
... ... @@ -49,8 +49,8 @@ dnl Check for iconv
49 49 AM_ICONV
50 50  
51 51 dnl Checks for programs.
52   -AC_PROG_CXX
53 52 AC_PROG_CC
  53 +AC_PROG_CXX
54 54 AC_PROG_SED
55 55 AC_PROG_LN_S
56 56  
... ... @@ -59,123 +59,114 @@ AC_LANG([C++])
59 59 dnl ---------------------------------------------------------------------------
60 60 dnl Initialize defaults
61 61 dnl ---------------------------------------------------------------------------
62   -DLLFLAGS="-shared -Wl,-soname,\$(@F)"
63   -DBG_CFLAGS="-DDEBUG=1"
  62 +
  63 +DBG_CFLAGS="-g -fstack-check -DDEBUG=1"
64 64 RLS_CFLAGS="-DNDEBUG=1"
  65 +PLUGINS=""
  66 +APP_RESOURCES=""
  67 +APP_LDFLAGS=""
  68 +DLL_LDFLAGS="-shared -Wl,-soname,\$(@F)"
  69 +DEPENDS=""
65 70  
66 71 dnl ---------------------------------------------------------------------------
67   -dnl Check for OS specifics
  72 +dnl Version info
68 73 dnl ---------------------------------------------------------------------------
69 74  
70   -case "$host" in
71   - *-mingw32)
72   -
73   - EXEEXT=".exe"
74   - DLLPREFIX=""
75   - DLLEXT=".dll"
76   -
77   - CFLAGS="$CFLAGS -Wall -Werror -D_WIN32_WINNT=0x0600"
78   - LIBS="$LIBS -lws2_32 -lntdll -lwtsapi32"
79   -
80   - ;;
  75 +AC_SUBST(PACKAGE_DESCRIPTION,"Python binding for pw3270/lib3270")
81 76  
82   - *)
83   - EXEEXT=""
  77 +app_vrs_major=$(echo $VERSION | cut -d. -f1)
  78 +app_vrs_minor=$(echo $VERSION | cut -d. -f2)
84 79  
85   - DLLEXT=".so"
  80 +AC_DEFINE_UNQUOTED(PACKAGE_MAJOR_VERSION, $app_vrs_major)
  81 +AC_DEFINE_UNQUOTED(PACKAGE_MINOR_VERSION, $app_vrs_minor)
86 82  
87   - CFLAGS="$CFLAGS -Wall -Werror"
  83 +AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major)
  84 +AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor)
88 85  
89   - # LIBS="-Wl,--no-allow-shlib-undefined,--as-needed,--no-undefined -pthread $LIBS"
90   - LIBS="-pthread $LIBS"
  86 +AC_ARG_WITH([release], [AS_HELP_STRING([--with-release], [Set release])], [ app_cv_release="$withval" ],[ app_cv_release="`date +%-y`.`date +%-m`.`date +%-d`" ])
91 87  
92   -esac
  88 +app_rls_major=$(echo $app_cv_release.0.0 | cut -d. -f1)
  89 +app_rls_minor=$(echo $app_cv_release.0.0 | cut -d. -f2)
93 90  
94   -AC_SUBST(LIBS)
  91 +AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, $app_cv_release)
  92 +AC_DEFINE_UNQUOTED(PACKAGE_MAJOR_RELEASE, $app_rls_major)
  93 +AC_DEFINE_UNQUOTED(PACKAGE_MINOR_RELEASE, $app_rls_minor)
95 94  
96   -AC_SUBST(DBG_CFLAGS)
97   -AC_SUBST(RLS_CFLAGS)
  95 +AC_SUBST(PACKAGE_RELEASE,$app_cv_release)
  96 +AC_SUBST(PACKAGE_MAJOR_RELEASE,$app_rls_major)
  97 +AC_SUBST(PACKAGE_MINOR_RELEASE,$app_rls_minor)
98 98  
99   -AC_SUBST(DBG_LDFLAGS)
100   -AC_SUBST(RLS_LDFLAGS)
  99 +AC_ARG_WITH([application-datadir], [AS_HELP_STRING([--with-application-datadir], [Set path for configuration file])], [ app_cv_source_appdatadir="$withval" ],[ app_cv_source_appdatadir="\$(datarootdir)/\$(PACKAGE_NAME)" ])
101 100  
102   -AC_SUBST(EXEEXT)
103   -AC_SUBST(DLLEXT)
104   -AC_SUBST(DLLPREFIX)
  101 +AC_DEFINE_UNQUOTED(APPDATADIR, $app_cv_source_appdatadir)
  102 +AC_SUBST(APPDATADIR,$app_cv_source_appdatadir)
105 103  
106 104 dnl ---------------------------------------------------------------------------
107   -dnl Check for other programs
108   -dnl ---------------------------------------------------------------------------
109   -AC_PATH_TOOL([STRIP], [strip])
110   -AC_PATH_TOOL([RPMBUILD], [rpmbuild], [no])
111   -AC_PATH_TOOL([MAKENSIS], [makensis], [no])
112   -AC_PATH_TOOL([VALGRIND], [valgrind], [no])
113   -AC_PATH_TOOL([WINDRES], [windres], [no])
114   -AC_PATH_TOOL([ZIP], [zip], [zip])
115   -AC_PATH_TOOL([FIND], [find], [find])
116   -AC_PATH_TOOL([AR], [ar], [ar])
117   -
118   -PKG_CHECK_EXISTS
119   -
120   -dnl ---------------------------------------------------------------------------
121   -dnl Version info
  105 +dnl Check for OS specifics
122 106 dnl ---------------------------------------------------------------------------
123 107  
124   -app_vrs_major=$(echo $VERSION | cut -d. -f1)
125   -app_vrs_minor=$(echo $VERSION | cut -d. -f2)
126   -
127   -AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major)
128   -AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor)
129   -
130   -AC_DEFINE_UNQUOTED(PACKAGE_MAJOR_VERSION, $app_vrs_major)
131   -AC_DEFINE_UNQUOTED(PACKAGE_MINOR_VERSION, $app_vrs_minor)
  108 +case "$host" in
  109 + *-mingw32|*-pc-msys)
  110 + app_cv_osname="windows"
132 111  
133   -AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major)
134   -AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor)
  112 + CFLAGS="$CFLAGS -pthread -D_WIN32_WINNT=0x0600"
  113 + LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32"
  114 + DLLEXT=".dll"
135 115  
136   -app_cv_description="Python binding for pw3270/lib3270"
  116 + app_win32_revision=$(date +%-y.%-m.%-d.%-H)
  117 + AC_SUBST(WIN32_VERSION,$app_win32_revision)
137 118  
138   -AC_DEFINE_UNQUOTED(PACKAGE_DESCRIPTION,"$app_cv_description")
139   -AC_SUBST(PACKAGE_DESCRIPTION,"$app_cv_description")
  119 + app_win32_file_version=$(date +%-y,%-m,%-d,%-H)
  120 + AC_SUBST(WIN32_FILE_VERSION,$app_win32_file_version)
140 121  
141   -dnl ---------------------------------------------------------------------------
142   -dnl Check for Python
143   -dnl ---------------------------------------------------------------------------
  122 +dnl AC_CONFIG_FILES(src/core/windows/resources.rc)
  123 +dnl AC_CONFIG_FILES(win/py3270.nsi)
144 124  
145   -PKG_CHECK_MODULES( [PYTHON], [python], AC_DEFINE(HAVE_PYTHON))
  125 + if test "$host_cpu" = "x86_64"; then
  126 + app_cv_programfiles="PROGRAMFILES64"
  127 + app_cv_winarch="64"
  128 + else
  129 + app_cv_programfiles="PROGRAMFILES"
  130 + app_cv_winarch="32"
  131 + fi
146 132  
147   -AC_SUBST(PYTHON_LIBS)
148   -AC_SUBST(PYTHON_CFLAGS)
  133 + AC_SUBST(PROGRAMFILES,$app_cv_programfiles)
  134 + AC_SUBST(WINARCH,$app_cv_winarch)
  135 + AC_SUBST(SONAME,py3270.dll)
149 136  
150   -dnl ---------------------------------------------------------------------------
151   -dnl Check for D-Bus
152   -dnl ---------------------------------------------------------------------------
  137 + ;;
153 138  
154   -PKG_CHECK_MODULES( [DBUS], [dbus-1], AC_DEFINE(HAVE_DBUS), AC_MSG_NOTICE([ No DBUS support.]) )
155   -AC_SUBST(DBUS_LIBS)
156   -AC_SUBST(DBUS_CFLAGS)
  139 + *)
  140 + CFLAGS="$CFLAGS -pthread"
  141 + LDFLAGS="$LDFLAGS -pthread"
  142 + app_cv_datadir="/usr/share"
  143 + app_cv_confdir="/etc"
  144 + app_cv_osname="linux"
  145 + LOGDIR="/var/log"
  146 + DLLEXT=".so"
  147 + AC_SUBST(SONAME,py3270.so.$app_vrs_major.$app_vrs_minor)
157 148  
158   -dnl ---------------------------------------------------------------------------
159   -dnl Check for integer types & library functions
160   -dnl ---------------------------------------------------------------------------
  149 +esac
161 150  
162   -AC_CHECK_TYPES([pid_t, uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
163   -AC_CHECK_FUNCS(srandom random getopt asprintf vasprintf)
164   -AC_CHECK_FUNCS(getaddrinfo sendfile poll eventfd statfs64)
  151 +AC_SUBST(DATADIR,$app_cv_datadir)
  152 +AC_SUBST(CONFDIR,$app_cv_confdir)
  153 +AC_SUBST(OSNAME,$app_cv_osname)
  154 +AC_SUBST(LIBS)
  155 +AC_SUBST(LOGDIR)
  156 +AC_SUBST(DLLEXT)
  157 +AC_SUBST(DLLPREFIX)
  158 +AC_SUBST(LDFLAGS)
  159 +AC_SUBST(DLL_LDFLAGS)
165 160  
166 161 dnl ---------------------------------------------------------------------------
167   -dnl Check for libintl
  162 +dnl Check for other programs
168 163 dnl ---------------------------------------------------------------------------
169 164  
170   -AC_PATH_TOOL([XGETTEXT], [xgettext], [no])
171   -AC_PATH_TOOL([MSGCAT], [msgcat], [no])
172   -AC_PATH_TOOL([MSGINIT], [msginit], [no])
173   -AC_PATH_TOOL([MSGMERGE], [msgmerge], [no])
174   -AC_PATH_TOOL([MSGFMT], [msgfmt], [no])
  165 +AC_PATH_TOOL([AR], [ar], [ar])
  166 +AC_PATH_TOOL([WINDRES], [windres], [no])
  167 +AC_PATH_TOOL([VALGRIND], [valgrind], [no])
175 168  
176   -AC_CHECK_HEADER(libintl.h, [
177   - AC_DEFINE(HAVE_LIBINTL, 1)
178   -])
  169 +PKG_CHECK_EXISTS
179 170  
180 171 dnl ---------------------------------------------------------------------------
181 172 dnl Check for C++ 2011 support
... ... @@ -199,118 +190,95 @@ AS_VAR_POPDEF([CACHEVAR])dnl
199 190 AX_CHECK_COMPILE_FLAG([-std=gnu++11], [CFLAGS="$CFLAGS -std=gnu++11"])
200 191  
201 192 dnl ---------------------------------------------------------------------------
202   -dnl Check for ELF symbol visibility support
  193 +dnl Check for IPC3270
203 194 dnl ---------------------------------------------------------------------------
204   -m4_define([GLIB_CHECK_COMPILE_WARNINGS],
205   -[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
206   -rm -f conftest.$ac_objext
207   -glib_ac_compile_save="$ac_compile"
208   -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext'
209   -AS_IF([_AC_EVAL_STDERR($ac_compile) &&
210   - AC_TRY_COMMAND([(if test -s conftest.err; then false ; else true; fi)])],
211   - [$2],
212   - [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
213   -cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
214   -m4_ifvaln([$3],[$3])dnl])
215   -ac_compile="$glib_ac_compile_save"
216   -rm -f conftest.$ac_objext conftest.err m4_ifval([$1], [conftest.$ac_ext])[]dnl
217   -])# GLIB_CHECK_COMPILE_WARNINGS
218   -
219   -AC_MSG_CHECKING(for GNUC visibility attribute)
220   -GLIB_CHECK_COMPILE_WARNINGS([
221   -void
222   -__attribute__ ((visibility ("hidden")))
223   - f_hidden (void)
224   -{
225   -}
226   -void
227   -__attribute__ ((visibility ("internal")))
228   - f_internal (void)
229   -{
230   -}
231   -void
232   -__attribute__ ((visibility ("protected")))
233   - f_protected (void)
234   -{
235   -}
236   -void
237   -__attribute__ ((visibility ("default")))
238   - f_default (void)
239   -{
240   -}
241   -int main (int argc, char **argv)
242   -{
243   - f_hidden();
244   - f_internal();
245   - f_protected();
246   - f_default();
247   - return 0;
248   -}
249   -],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no)
250   -AC_MSG_RESULT($g_have_gnuc_visibility)
251   -if test x$g_have_gnuc_visibility = xyes; then
252   - AC_DEFINE(HAVE_GNUC_VISIBILITY, 1, [supports GCC visibility attributes])
  195 +
  196 +AC_ARG_WITH([static-ipc3270],
  197 + [AS_HELP_STRING([--with-static-ipc3270], [Uses static version of ipc3270])],
  198 +[
  199 + app_cv_static_ipc3270=$withval
  200 +],[
  201 + app_cv_static_ipc3270="auto"
  202 +])
  203 +
  204 +if test "$app_cv_static_ipc3270" == "auto"; then
  205 + case "$host" in
  206 + *-mingw32|*-pc-msys)
  207 + app_cv_static_ipc3270="yes"
  208 + ;;
  209 +
  210 + *)
  211 + app_cv_static_ipc3270="no"
  212 +
  213 + esac
  214 +
  215 +fi
  216 +
  217 +if test "$app_cv_static_ipc3270" == "yes"; then
  218 + LDFLAGS="-static -static-libgcc -static-libstdc++ $LDFLAGS"
  219 + PKG_CHECK_MODULES( [IPC3270], [ipc3270-static], AC_DEFINE(USING_STATIC_IPC3270), AC_MSG_ERROR([IPC3270 not present.]))
  220 +else
  221 + PKG_CHECK_MODULES( [IPC3270], [ipc3270], AC_DEFINE(USING_SHARED_IPC3270), AC_MSG_ERROR([IPC3270 not present.]))
253 222 fi
254 223  
  224 +AC_SUBST(IPC3270_LIBS)
  225 +AC_SUBST(IPC3270_CFLAGS)
  226 +
  227 +AC_ARG_WITH([product-name], [AS_HELP_STRING([--with-product-name], [Set product name])], [ app_cv_product="$withval" ],[ app_cv_product=`pkg-config --variable=product_name ipc3270` ])
  228 +AC_DEFINE_UNQUOTED(PRODUCT_NAME, $app_cv_product)
  229 +AC_SUBST(PRODUCT_NAME,$app_cv_product)
  230 +
255 231 dnl ---------------------------------------------------------------------------
256   -dnl Check for compiler visibility flag
  232 +dnl Check for Python
257 233 dnl ---------------------------------------------------------------------------
258   -dnl AC_MSG_CHECKING(whether $CC accepts -fvisibility=hidden)
259   -dnl AC_CACHE_VAL(app_cv_fvisibility_ok,
260   -dnl [ac_save_cc="$CC"
261   -dnl CC="$CC -fvisibility=hidden"
262   -dnl AC_TRY_RUN([int main() { return 0; }],
263   -dnl app_cv_fvisibility_ok=yes,
264   -dnl app_cv_fvisibility_ok=no,
265   -dnl app_cv_fvisibility_ok=no)
266   -dnl CC="$ac_save_cc"])
267   -dnl AC_MSG_RESULT($app_cv_fvisibility_ok)
268   -dnl if test $app_cv_fvisibility_ok = yes; then
269   -dnl CFLAGS="$CFLAGS -fvisibility=hidden"
270   -dnl fi
  234 +
  235 +PKG_CHECK_MODULES( [PYTHON], [python], AC_DEFINE(HAVE_PYTHON), AC_MSG_ERROR([Python devel is unavailable]))
  236 +
  237 +AC_SUBST(PYTHON_LIBS)
  238 +AC_SUBST(PYTHON_CFLAGS)
  239 +
271 240  
272 241 dnl ---------------------------------------------------------------------------
273 242 dnl Check for pic
274 243 dnl ---------------------------------------------------------------------------
  244 +
275 245 AC_ARG_ENABLE([pic],
276 246 [AS_HELP_STRING([--disable-pic], [disable support for PIC libraries (required to compile on 64bits)])],
277 247 [
278 248 app_cv_pic="$enableval"
279 249 ],[
280 250  
281   - case "$host" in
282   - *-mingw32)
283   - app_cv_pic="no"
284   - ;;
  251 + case "$host_cpu" in
  252 + x86_64)
  253 + app_cv_pic="yes"
  254 + ;;
  255 +
  256 + aarch64)
  257 + app_cv_pic="yes"
  258 + ;;
285 259  
286 260 *)
287   - if test "$host_cpu" = "x86_64"; then
288   - app_cv_pic="yes"
289   - else
290   - app_cv_pic="no"
291   - fi
  261 + app_cv_pic="no"
292 262 esac
  263 +
293 264 ])
294 265  
295 266 if test "$app_cv_pic" == "yes"; then
296 267 CFLAGS="$CFLAGS -fPIC"
  268 + CXXFLAGS="$CXXFLAGS -fPIC"
297 269 fi
298 270  
299 271 dnl ---------------------------------------------------------------------------
300   -dnl Output config
301   -dnl ---------------------------------------------------------------------------
302   -
303   -AC_SUBST(BASEDIR,$ac_pwd)
304   -
305   -dnl ---------------------------------------------------------------------------
306 272 dnl Configure which files to generate.
307 273 dnl ---------------------------------------------------------------------------
308 274  
309   -AC_CONFIG_FILES(Makefile)
  275 +# AC_CONFIG_FILES(Makefile)
310 276  
311 277 dnl ---------------------------------------------------------------------------
312 278 dnl Output the generated config.status script.
313 279 dnl ---------------------------------------------------------------------------
  280 +AC_SUBST(BASEDIR,$ac_pwd)
  281 +
314 282 AC_OUTPUT
315 283  
316 284  
... ...
scripts/config.guess
... ... @@ -1,1526 +0,0 @@
1   -#! /bin/sh
2   -# Attempt to guess a canonical system name.
3   -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4   -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
5   -# Free Software Foundation, Inc.
6   -
7   -timestamp='2008-01-23'
8   -
9   -# This file is free software; you can redistribute it and/or modify it
10   -# under the terms of the GNU General Public License as published by
11   -# the Free Software Foundation; either version 2 of the License, or
12   -# (at your option) any later version.
13   -#
14   -# This program is distributed in the hope that it will be useful, but
15   -# WITHOUT ANY WARRANTY; without even the implied warranty of
16   -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   -# General Public License for more details.
18   -#
19   -# You should have received a copy of the GNU General Public License
20   -# along with this program; if not, write to the Free Software
21   -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22   -# 02110-1301, USA.
23   -#
24   -# As a special exception to the GNU General Public License, if you
25   -# distribute this file as part of a program that contains a
26   -# configuration script generated by Autoconf, you may include it under
27   -# the same distribution terms that you use for the rest of that program.
28   -
29   -
30   -# Originally written by Per Bothner <per@bothner.com>.
31   -# Please send patches to <config-patches@gnu.org>. Submit a context
32   -# diff and a properly formatted ChangeLog entry.
33   -#
34   -# This script attempts to guess a canonical system name similar to
35   -# config.sub. If it succeeds, it prints the system name on stdout, and
36   -# exits with 0. Otherwise, it exits with 1.
37   -#
38   -# The plan is that this can be called by configure scripts if you
39   -# don't specify an explicit build system type.
40   -
41   -me=`echo "$0" | sed -e 's,.*/,,'`
42   -
43   -usage="\
44   -Usage: $0 [OPTION]
45   -
46   -Output the configuration name of the system \`$me' is run on.
47   -
48   -Operation modes:
49   - -h, --help print this help, then exit
50   - -t, --time-stamp print date of last modification, then exit
51   - -v, --version print version number, then exit
52   -
53   -Report bugs and patches to <config-patches@gnu.org>."
54   -
55   -version="\
56   -GNU config.guess ($timestamp)
57   -
58   -Originally written by Per Bothner.
59   -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
60   -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
61   -
62   -This is free software; see the source for copying conditions. There is NO
63   -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
64   -
65   -help="
66   -Try \`$me --help' for more information."
67   -
68   -# Parse command line
69   -while test $# -gt 0 ; do
70   - case $1 in
71   - --time-stamp | --time* | -t )
72   - echo "$timestamp" ; exit ;;
73   - --version | -v )
74   - echo "$version" ; exit ;;
75   - --help | --h* | -h )
76   - echo "$usage"; exit ;;
77   - -- ) # Stop option processing
78   - shift; break ;;
79   - - ) # Use stdin as input.
80   - break ;;
81   - -* )
82   - echo "$me: invalid option $1$help" >&2
83   - exit 1 ;;
84   - * )
85   - break ;;
86   - esac
87   -done
88   -
89   -if test $# != 0; then
90   - echo "$me: too many arguments$help" >&2
91   - exit 1
92   -fi
93   -
94   -trap 'exit 1' 1 2 15
95   -
96   -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97   -# compiler to aid in system detection is discouraged as it requires
98   -# temporary files to be created and, as you can see below, it is a
99   -# headache to deal with in a portable fashion.
100   -
101   -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
102   -# use `HOST_CC' if defined, but it is deprecated.
103   -
104   -# Portable tmp directory creation inspired by the Autoconf team.
105   -
106   -set_cc_for_build='
107   -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108   -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109   -: ${TMPDIR=/tmp} ;
110   - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111   - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112   - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113   - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114   -dummy=$tmp/dummy ;
115   -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116   -case $CC_FOR_BUILD,$HOST_CC,$CC in
117   - ,,) echo "int x;" > $dummy.c ;
118   - for c in cc gcc c89 c99 ; do
119   - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
120   - CC_FOR_BUILD="$c"; break ;
121   - fi ;
122   - done ;
123   - if test x"$CC_FOR_BUILD" = x ; then
124   - CC_FOR_BUILD=no_compiler_found ;
125   - fi
126   - ;;
127   - ,,*) CC_FOR_BUILD=$CC ;;
128   - ,*,*) CC_FOR_BUILD=$HOST_CC ;;
129   -esac ; set_cc_for_build= ;'
130   -
131   -# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
132   -# (ghazi@noc.rutgers.edu 1994-08-24)
133   -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
134   - PATH=$PATH:/.attbin ; export PATH
135   -fi
136   -
137   -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
138   -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139   -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
140   -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141   -
142   -# Note: order is significant - the case branches are not exclusive.
143   -
144   -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
145   - *:NetBSD:*:*)
146   - # NetBSD (nbsd) targets should (where applicable) match one or
147   - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
148   - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
149   - # switched to ELF, *-*-netbsd* would select the old
150   - # object file format. This provides both forward
151   - # compatibility and a consistent mechanism for selecting the
152   - # object file format.
153   - #
154   - # Note: NetBSD doesn't particularly care about the vendor
155   - # portion of the name. We always set it to "unknown".
156   - sysctl="sysctl -n hw.machine_arch"
157   - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
158   - /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
159   - case "${UNAME_MACHINE_ARCH}" in
160   - armeb) machine=armeb-unknown ;;
161   - arm*) machine=arm-unknown ;;
162   - sh3el) machine=shl-unknown ;;
163   - sh3eb) machine=sh-unknown ;;
164   - sh5el) machine=sh5le-unknown ;;
165   - *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
166   - esac
167   - # The Operating System including object format, if it has switched
168   - # to ELF recently, or will in the future.
169   - case "${UNAME_MACHINE_ARCH}" in
170   - arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171   - eval $set_cc_for_build
172   - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173   - | grep __ELF__ >/dev/null
174   - then
175   - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176   - # Return netbsd for either. FIX?
177   - os=netbsd
178   - else
179   - os=netbsdelf
180   - fi
181   - ;;
182   - *)
183   - os=netbsd
184   - ;;
185   - esac
186   - # The OS release
187   - # Debian GNU/NetBSD machines have a different userland, and
188   - # thus, need a distinct triplet. However, they do not need
189   - # kernel version information, so it can be replaced with a
190   - # suitable tag, in the style of linux-gnu.
191   - case "${UNAME_VERSION}" in
192   - Debian*)
193   - release='-gnu'
194   - ;;
195   - *)
196   - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
197   - ;;
198   - esac
199   - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
200   - # contains redundant information, the shorter form:
201   - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
202   - echo "${machine}-${os}${release}"
203   - exit ;;
204   - *:OpenBSD:*:*)
205   - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
206   - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
207   - exit ;;
208   - *:ekkoBSD:*:*)
209   - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
210   - exit ;;
211   - *:SolidBSD:*:*)
212   - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
213   - exit ;;
214   - macppc:MirBSD:*:*)
215   - echo powerpc-unknown-mirbsd${UNAME_RELEASE}
216   - exit ;;
217   - *:MirBSD:*:*)
218   - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
219   - exit ;;
220   - alpha:OSF1:*:*)
221   - case $UNAME_RELEASE in
222   - *4.0)
223   - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
224   - ;;
225   - *5.*)
226   - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
227   - ;;
228   - esac
229   - # According to Compaq, /usr/sbin/psrinfo has been available on
230   - # OSF/1 and Tru64 systems produced since 1995. I hope that
231   - # covers most systems running today. This code pipes the CPU
232   - # types through head -n 1, so we only detect the type of CPU 0.
233   - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
234   - case "$ALPHA_CPU_TYPE" in
235   - "EV4 (21064)")
236   - UNAME_MACHINE="alpha" ;;
237   - "EV4.5 (21064)")
238   - UNAME_MACHINE="alpha" ;;
239   - "LCA4 (21066/21068)")
240   - UNAME_MACHINE="alpha" ;;
241   - "EV5 (21164)")
242   - UNAME_MACHINE="alphaev5" ;;
243   - "EV5.6 (21164A)")
244   - UNAME_MACHINE="alphaev56" ;;
245   - "EV5.6 (21164PC)")
246   - UNAME_MACHINE="alphapca56" ;;
247   - "EV5.7 (21164PC)")
248   - UNAME_MACHINE="alphapca57" ;;
249   - "EV6 (21264)")
250   - UNAME_MACHINE="alphaev6" ;;
251   - "EV6.7 (21264A)")
252   - UNAME_MACHINE="alphaev67" ;;
253   - "EV6.8CB (21264C)")
254   - UNAME_MACHINE="alphaev68" ;;
255   - "EV6.8AL (21264B)")
256   - UNAME_MACHINE="alphaev68" ;;
257   - "EV6.8CX (21264D)")
258   - UNAME_MACHINE="alphaev68" ;;
259   - "EV6.9A (21264/EV69A)")
260   - UNAME_MACHINE="alphaev69" ;;
261   - "EV7 (21364)")
262   - UNAME_MACHINE="alphaev7" ;;
263   - "EV7.9 (21364A)")
264   - UNAME_MACHINE="alphaev79" ;;
265   - esac
266   - # A Pn.n version is a patched version.
267   - # A Vn.n version is a released version.
268   - # A Tn.n version is a released field test version.
269   - # A Xn.n version is an unreleased experimental baselevel.
270   - # 1.2 uses "1.2" for uname -r.
271   - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
272   - exit ;;
273   - Alpha\ *:Windows_NT*:*)
274   - # How do we know it's Interix rather than the generic POSIX subsystem?
275   - # Should we change UNAME_MACHINE based on the output of uname instead
276   - # of the specific Alpha model?
277   - echo alpha-pc-interix
278   - exit ;;
279   - 21064:Windows_NT:50:3)
280   - echo alpha-dec-winnt3.5
281   - exit ;;
282   - Amiga*:UNIX_System_V:4.0:*)
283   - echo m68k-unknown-sysv4
284   - exit ;;
285   - *:[Aa]miga[Oo][Ss]:*:*)
286   - echo ${UNAME_MACHINE}-unknown-amigaos
287   - exit ;;
288   - *:[Mm]orph[Oo][Ss]:*:*)
289   - echo ${UNAME_MACHINE}-unknown-morphos
290   - exit ;;
291   - *:OS/390:*:*)
292   - echo i370-ibm-openedition
293   - exit ;;
294   - *:z/VM:*:*)
295   - echo s390-ibm-zvmoe
296   - exit ;;
297   - *:OS400:*:*)
298   - echo powerpc-ibm-os400
299   - exit ;;
300   - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
301   - echo arm-acorn-riscix${UNAME_RELEASE}
302   - exit ;;
303   - arm:riscos:*:*|arm:RISCOS:*:*)
304   - echo arm-unknown-riscos
305   - exit ;;
306   - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
307   - echo hppa1.1-hitachi-hiuxmpp
308   - exit ;;
309   - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
310   - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
311   - if test "`(/bin/universe) 2>/dev/null`" = att ; then
312   - echo pyramid-pyramid-sysv3
313   - else
314   - echo pyramid-pyramid-bsd
315   - fi
316   - exit ;;
317   - NILE*:*:*:dcosx)
318   - echo pyramid-pyramid-svr4
319   - exit ;;
320   - DRS?6000:unix:4.0:6*)
321   - echo sparc-icl-nx6
322   - exit ;;
323   - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
324   - case `/usr/bin/uname -p` in
325   - sparc) echo sparc-icl-nx7; exit ;;
326   - esac ;;
327   - sun4H:SunOS:5.*:*)
328   - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
329   - exit ;;
330   - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331   - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
332   - exit ;;
333   - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
334   - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335   - exit ;;
336   - sun4*:SunOS:6*:*)
337   - # According to config.sub, this is the proper way to canonicalize
338   - # SunOS6. Hard to guess exactly what SunOS6 will be like, but
339   - # it's likely to be more like Solaris than SunOS4.
340   - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
341   - exit ;;
342   - sun4*:SunOS:*:*)
343   - case "`/usr/bin/arch -k`" in
344   - Series*|S4*)
345   - UNAME_RELEASE=`uname -v`
346   - ;;
347   - esac
348   - # Japanese Language versions have a version number like `4.1.3-JL'.
349   - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
350   - exit ;;
351   - sun3*:SunOS:*:*)
352   - echo m68k-sun-sunos${UNAME_RELEASE}
353   - exit ;;
354   - sun*:*:4.2BSD:*)
355   - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
356   - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
357   - case "`/bin/arch`" in
358   - sun3)
359   - echo m68k-sun-sunos${UNAME_RELEASE}
360   - ;;
361   - sun4)
362   - echo sparc-sun-sunos${UNAME_RELEASE}
363   - ;;
364   - esac
365   - exit ;;
366   - aushp:SunOS:*:*)
367   - echo sparc-auspex-sunos${UNAME_RELEASE}
368   - exit ;;
369   - # The situation for MiNT is a little confusing. The machine name
370   - # can be virtually everything (everything which is not
371   - # "atarist" or "atariste" at least should have a processor
372   - # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
373   - # to the lowercase version "mint" (or "freemint"). Finally
374   - # the system name "TOS" denotes a system which is actually not
375   - # MiNT. But MiNT is downward compatible to TOS, so this should
376   - # be no problem.
377   - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
378   - echo m68k-atari-mint${UNAME_RELEASE}
379   - exit ;;
380   - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
381   - echo m68k-atari-mint${UNAME_RELEASE}
382   - exit ;;
383   - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
384   - echo m68k-atari-mint${UNAME_RELEASE}
385   - exit ;;
386   - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
387   - echo m68k-milan-mint${UNAME_RELEASE}
388   - exit ;;
389   - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
390   - echo m68k-hades-mint${UNAME_RELEASE}
391   - exit ;;
392   - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
393   - echo m68k-unknown-mint${UNAME_RELEASE}
394   - exit ;;
395   - m68k:machten:*:*)
396   - echo m68k-apple-machten${UNAME_RELEASE}
397   - exit ;;
398   - powerpc:machten:*:*)
399   - echo powerpc-apple-machten${UNAME_RELEASE}
400   - exit ;;
401   - RISC*:Mach:*:*)
402   - echo mips-dec-mach_bsd4.3
403   - exit ;;
404   - RISC*:ULTRIX:*:*)
405   - echo mips-dec-ultrix${UNAME_RELEASE}
406   - exit ;;
407   - VAX*:ULTRIX*:*:*)
408   - echo vax-dec-ultrix${UNAME_RELEASE}
409   - exit ;;
410   - 2020:CLIX:*:* | 2430:CLIX:*:*)
411   - echo clipper-intergraph-clix${UNAME_RELEASE}
412   - exit ;;
413   - mips:*:*:UMIPS | mips:*:*:RISCos)
414   - eval $set_cc_for_build
415   - sed 's/^ //' << EOF >$dummy.c
416   -#ifdef __cplusplus
417   -#include <stdio.h> /* for printf() prototype */
418   - int main (int argc, char *argv[]) {
419   -#else
420   - int main (argc, argv) int argc; char *argv[]; {
421   -#endif
422   - #if defined (host_mips) && defined (MIPSEB)
423   - #if defined (SYSTYPE_SYSV)
424   - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
425   - #endif
426   - #if defined (SYSTYPE_SVR4)
427   - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
428   - #endif
429   - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
430   - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
431   - #endif
432   - #endif
433   - exit (-1);
434   - }
435   -EOF
436   - $CC_FOR_BUILD -o $dummy $dummy.c &&
437   - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
438   - SYSTEM_NAME=`$dummy $dummyarg` &&
439   - { echo "$SYSTEM_NAME"; exit; }
440   - echo mips-mips-riscos${UNAME_RELEASE}
441   - exit ;;
442   - Motorola:PowerMAX_OS:*:*)
443   - echo powerpc-motorola-powermax
444   - exit ;;
445   - Motorola:*:4.3:PL8-*)
446   - echo powerpc-harris-powermax
447   - exit ;;
448   - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
449   - echo powerpc-harris-powermax
450   - exit ;;
451   - Night_Hawk:Power_UNIX:*:*)
452   - echo powerpc-harris-powerunix
453   - exit ;;
454   - m88k:CX/UX:7*:*)
455   - echo m88k-harris-cxux7
456   - exit ;;
457   - m88k:*:4*:R4*)
458   - echo m88k-motorola-sysv4
459   - exit ;;
460   - m88k:*:3*:R3*)
461   - echo m88k-motorola-sysv3
462   - exit ;;
463   - AViiON:dgux:*:*)
464   - # DG/UX returns AViiON for all architectures
465   - UNAME_PROCESSOR=`/usr/bin/uname -p`
466   - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
467   - then
468   - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
469   - [ ${TARGET_BINARY_INTERFACE}x = x ]
470   - then
471   - echo m88k-dg-dgux${UNAME_RELEASE}
472   - else
473   - echo m88k-dg-dguxbcs${UNAME_RELEASE}
474   - fi
475   - else
476   - echo i586-dg-dgux${UNAME_RELEASE}
477   - fi
478   - exit ;;
479   - M88*:DolphinOS:*:*) # DolphinOS (SVR3)
480   - echo m88k-dolphin-sysv3
481   - exit ;;
482   - M88*:*:R3*:*)
483   - # Delta 88k system running SVR3
484   - echo m88k-motorola-sysv3
485   - exit ;;
486   - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
487   - echo m88k-tektronix-sysv3
488   - exit ;;
489   - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
490   - echo m68k-tektronix-bsd
491   - exit ;;
492   - *:IRIX*:*:*)
493   - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
494   - exit ;;
495   - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
496   - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
497   - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
498   - i*86:AIX:*:*)
499   - echo i386-ibm-aix
500   - exit ;;
501   - ia64:AIX:*:*)
502   - if [ -x /usr/bin/oslevel ] ; then
503   - IBM_REV=`/usr/bin/oslevel`
504   - else
505   - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
506   - fi
507   - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
508   - exit ;;
509   - *:AIX:2:3)
510   - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
511   - eval $set_cc_for_build
512   - sed 's/^ //' << EOF >$dummy.c
513   - #include <sys/systemcfg.h>
514   -
515   - main()
516   - {
517   - if (!__power_pc())
518   - exit(1);
519   - puts("powerpc-ibm-aix3.2.5");
520   - exit(0);
521   - }
522   -EOF
523   - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
524   - then
525   - echo "$SYSTEM_NAME"
526   - else
527   - echo rs6000-ibm-aix3.2.5
528   - fi
529   - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
530   - echo rs6000-ibm-aix3.2.4
531   - else
532   - echo rs6000-ibm-aix3.2
533   - fi
534   - exit ;;
535   - *:AIX:*:[456])
536   - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
537   - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
538   - IBM_ARCH=rs6000
539   - else
540   - IBM_ARCH=powerpc
541   - fi
542   - if [ -x /usr/bin/oslevel ] ; then
543   - IBM_REV=`/usr/bin/oslevel`
544   - else
545   - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
546   - fi
547   - echo ${IBM_ARCH}-ibm-aix${IBM_REV}
548   - exit ;;
549   - *:AIX:*:*)
550   - echo rs6000-ibm-aix
551   - exit ;;
552   - ibmrt:4.4BSD:*|romp-ibm:BSD:*)
553   - echo romp-ibm-bsd4.4
554   - exit ;;
555   - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
556   - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
557   - exit ;; # report: romp-ibm BSD 4.3
558   - *:BOSX:*:*)
559   - echo rs6000-bull-bosx
560   - exit ;;
561   - DPX/2?00:B.O.S.:*:*)
562   - echo m68k-bull-sysv3
563   - exit ;;
564   - 9000/[34]??:4.3bsd:1.*:*)
565   - echo m68k-hp-bsd
566   - exit ;;
567   - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
568   - echo m68k-hp-bsd4.4
569   - exit ;;
570   - 9000/[34678]??:HP-UX:*:*)
571   - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
572   - case "${UNAME_MACHINE}" in
573   - 9000/31? ) HP_ARCH=m68000 ;;
574   - 9000/[34]?? ) HP_ARCH=m68k ;;
575   - 9000/[678][0-9][0-9])
576   - if [ -x /usr/bin/getconf ]; then
577   - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
578   - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
579   - case "${sc_cpu_version}" in
580   - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
581   - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
582   - 532) # CPU_PA_RISC2_0
583   - case "${sc_kernel_bits}" in
584   - 32) HP_ARCH="hppa2.0n" ;;
585   - 64) HP_ARCH="hppa2.0w" ;;
586   - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
587   - esac ;;
588   - esac
589   - fi
590   - if [ "${HP_ARCH}" = "" ]; then
591   - eval $set_cc_for_build
592   - sed 's/^ //' << EOF >$dummy.c
593   -
594   - #define _HPUX_SOURCE
595   - #include <stdlib.h>
596   - #include <unistd.h>
597   -
598   - int main ()
599   - {
600   - #if defined(_SC_KERNEL_BITS)
601   - long bits = sysconf(_SC_KERNEL_BITS);
602   - #endif
603   - long cpu = sysconf (_SC_CPU_VERSION);
604   -
605   - switch (cpu)
606   - {
607   - case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
608   - case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
609   - case CPU_PA_RISC2_0:
610   - #if defined(_SC_KERNEL_BITS)
611   - switch (bits)
612   - {
613   - case 64: puts ("hppa2.0w"); break;
614   - case 32: puts ("hppa2.0n"); break;
615   - default: puts ("hppa2.0"); break;
616   - } break;
617   - #else /* !defined(_SC_KERNEL_BITS) */
618   - puts ("hppa2.0"); break;
619   - #endif
620   - default: puts ("hppa1.0"); break;
621   - }
622   - exit (0);
623   - }
624   -EOF
625   - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
626   - test -z "$HP_ARCH" && HP_ARCH=hppa
627   - fi ;;
628   - esac
629   - if [ ${HP_ARCH} = "hppa2.0w" ]
630   - then
631   - eval $set_cc_for_build
632   -
633   - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
634   - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
635   - # generating 64-bit code. GNU and HP use different nomenclature:
636   - #
637   - # $ CC_FOR_BUILD=cc ./config.guess
638   - # => hppa2.0w-hp-hpux11.23
639   - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
640   - # => hppa64-hp-hpux11.23
641   -
642   - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
643   - grep __LP64__ >/dev/null
644   - then
645   - HP_ARCH="hppa2.0w"
646   - else
647   - HP_ARCH="hppa64"
648   - fi
649   - fi
650   - echo ${HP_ARCH}-hp-hpux${HPUX_REV}
651   - exit ;;
652   - ia64:HP-UX:*:*)
653   - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
654   - echo ia64-hp-hpux${HPUX_REV}
655   - exit ;;
656   - 3050*:HI-UX:*:*)
657   - eval $set_cc_for_build
658   - sed 's/^ //' << EOF >$dummy.c
659   - #include <unistd.h>
660   - int
661   - main ()
662   - {
663   - long cpu = sysconf (_SC_CPU_VERSION);
664   - /* The order matters, because CPU_IS_HP_MC68K erroneously returns
665   - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
666   - results, however. */
667   - if (CPU_IS_PA_RISC (cpu))
668   - {
669   - switch (cpu)
670   - {
671   - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
672   - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
673   - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
674   - default: puts ("hppa-hitachi-hiuxwe2"); break;
675   - }
676   - }
677   - else if (CPU_IS_HP_MC68K (cpu))
678   - puts ("m68k-hitachi-hiuxwe2");
679   - else puts ("unknown-hitachi-hiuxwe2");
680   - exit (0);
681   - }
682   -EOF
683   - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
684   - { echo "$SYSTEM_NAME"; exit; }
685   - echo unknown-hitachi-hiuxwe2
686   - exit ;;
687   - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
688   - echo hppa1.1-hp-bsd
689   - exit ;;
690   - 9000/8??:4.3bsd:*:*)
691   - echo hppa1.0-hp-bsd
692   - exit ;;
693   - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
694   - echo hppa1.0-hp-mpeix
695   - exit ;;
696   - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
697   - echo hppa1.1-hp-osf
698   - exit ;;
699   - hp8??:OSF1:*:*)
700   - echo hppa1.0-hp-osf
701   - exit ;;
702   - i*86:OSF1:*:*)
703   - if [ -x /usr/sbin/sysversion ] ; then
704   - echo ${UNAME_MACHINE}-unknown-osf1mk
705   - else
706   - echo ${UNAME_MACHINE}-unknown-osf1
707   - fi
708   - exit ;;
709   - parisc*:Lites*:*:*)
710   - echo hppa1.1-hp-lites
711   - exit ;;
712   - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
713   - echo c1-convex-bsd
714   - exit ;;
715   - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
716   - if getsysinfo -f scalar_acc
717   - then echo c32-convex-bsd
718   - else echo c2-convex-bsd
719   - fi
720   - exit ;;
721   - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
722   - echo c34-convex-bsd
723   - exit ;;
724   - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
725   - echo c38-convex-bsd
726   - exit ;;
727   - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
728   - echo c4-convex-bsd
729   - exit ;;
730   - CRAY*Y-MP:*:*:*)
731   - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
732   - exit ;;
733   - CRAY*[A-Z]90:*:*:*)
734   - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
735   - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
736   - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
737   - -e 's/\.[^.]*$/.X/'
738   - exit ;;
739   - CRAY*TS:*:*:*)
740   - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
741   - exit ;;
742   - CRAY*T3E:*:*:*)
743   - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
744   - exit ;;
745   - CRAY*SV1:*:*:*)
746   - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
747   - exit ;;
748   - *:UNICOS/mp:*:*)
749   - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
750   - exit ;;
751   - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
752   - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
753   - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
754   - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
755   - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
756   - exit ;;
757   - 5000:UNIX_System_V:4.*:*)
758   - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
759   - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
760   - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
761   - exit ;;
762   - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
763   - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
764   - exit ;;
765   - sparc*:BSD/OS:*:*)
766   - echo sparc-unknown-bsdi${UNAME_RELEASE}
767   - exit ;;
768   - *:BSD/OS:*:*)
769   - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
770   - exit ;;
771   - *:FreeBSD:*:*)
772   - case ${UNAME_MACHINE} in
773   - pc98)
774   - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
775   - amd64)
776   - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
777   - *)
778   - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
779   - esac
780   - exit ;;
781   - i*:CYGWIN*:*)
782   - echo ${UNAME_MACHINE}-pc-cygwin
783   - exit ;;
784   - *:MINGW*:*)
785   - echo ${UNAME_MACHINE}-pc-mingw32
786   - exit ;;
787   - i*:windows32*:*)
788   - # uname -m includes "-pc" on this system.
789   - echo ${UNAME_MACHINE}-mingw32
790   - exit ;;
791   - i*:PW*:*)
792   - echo ${UNAME_MACHINE}-pc-pw32
793   - exit ;;
794   - *:Interix*:[3456]*)
795   - case ${UNAME_MACHINE} in
796   - x86)
797   - echo i586-pc-interix${UNAME_RELEASE}
798   - exit ;;
799   - EM64T | authenticamd)
800   - echo x86_64-unknown-interix${UNAME_RELEASE}
801   - exit ;;
802   - IA64)
803   - echo ia64-unknown-interix${UNAME_RELEASE}
804   - exit ;;
805   - esac ;;
806   - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
807   - echo i${UNAME_MACHINE}-pc-mks
808   - exit ;;
809   - i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
810   - # How do we know it's Interix rather than the generic POSIX subsystem?
811   - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
812   - # UNAME_MACHINE based on the output of uname instead of i386?
813   - echo i586-pc-interix
814   - exit ;;
815   - i*:UWIN*:*)
816   - echo ${UNAME_MACHINE}-pc-uwin
817   - exit ;;
818   - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
819   - echo x86_64-unknown-cygwin
820   - exit ;;
821   - p*:CYGWIN*:*)
822   - echo powerpcle-unknown-cygwin
823   - exit ;;
824   - prep*:SunOS:5.*:*)
825   - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
826   - exit ;;
827   - *:GNU:*:*)
828   - # the GNU system
829   - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
830   - exit ;;
831   - *:GNU/*:*:*)
832   - # other systems with GNU libc and userland
833   - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
834   - exit ;;
835   - i*86:Minix:*:*)
836   - echo ${UNAME_MACHINE}-pc-minix
837   - exit ;;
838   - arm*:Linux:*:*)
839   - eval $set_cc_for_build
840   - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
841   - | grep -q __ARM_EABI__
842   - then
843   - echo ${UNAME_MACHINE}-unknown-linux-gnu
844   - else
845   - echo ${UNAME_MACHINE}-unknown-linux-gnueabi
846   - fi
847   - exit ;;
848   - avr32*:Linux:*:*)
849   - echo ${UNAME_MACHINE}-unknown-linux-gnu
850   - exit ;;
851   - cris:Linux:*:*)
852   - echo cris-axis-linux-gnu
853   - exit ;;
854   - crisv32:Linux:*:*)
855   - echo crisv32-axis-linux-gnu
856   - exit ;;
857   - frv:Linux:*:*)
858   - echo frv-unknown-linux-gnu
859   - exit ;;
860   - ia64:Linux:*:*)
861   - echo ${UNAME_MACHINE}-unknown-linux-gnu
862   - exit ;;
863   - m32r*:Linux:*:*)
864   - echo ${UNAME_MACHINE}-unknown-linux-gnu
865   - exit ;;
866   - m68*:Linux:*:*)
867   - echo ${UNAME_MACHINE}-unknown-linux-gnu
868   - exit ;;
869   - mips:Linux:*:*)
870   - eval $set_cc_for_build
871   - sed 's/^ //' << EOF >$dummy.c
872   - #undef CPU
873   - #undef mips
874   - #undef mipsel
875   - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
876   - CPU=mipsel
877   - #else
878   - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
879   - CPU=mips
880   - #else
881   - CPU=
882   - #endif
883   - #endif
884   -EOF
885   - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
886   - /^CPU/{
887   - s: ::g
888   - p
889   - }'`"
890   - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
891   - ;;
892   - mips64:Linux:*:*)
893   - eval $set_cc_for_build
894   - sed 's/^ //' << EOF >$dummy.c
895   - #undef CPU
896   - #undef mips64
897   - #undef mips64el
898   - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
899   - CPU=mips64el
900   - #else
901   - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
902   - CPU=mips64
903   - #else
904   - CPU=
905   - #endif
906   - #endif
907   -EOF
908   - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
909   - /^CPU/{
910   - s: ::g
911   - p
912   - }'`"
913   - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
914   - ;;
915   - or32:Linux:*:*)
916   - echo or32-unknown-linux-gnu
917   - exit ;;
918   - ppc:Linux:*:*)
919   - echo powerpc-unknown-linux-gnu
920   - exit ;;
921   - ppc64:Linux:*:*)
922   - echo powerpc64-unknown-linux-gnu
923   - exit ;;
924   - alpha:Linux:*:*)
925   - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
926   - EV5) UNAME_MACHINE=alphaev5 ;;
927   - EV56) UNAME_MACHINE=alphaev56 ;;
928   - PCA56) UNAME_MACHINE=alphapca56 ;;
929   - PCA57) UNAME_MACHINE=alphapca56 ;;
930   - EV6) UNAME_MACHINE=alphaev6 ;;
931   - EV67) UNAME_MACHINE=alphaev67 ;;
932   - EV68*) UNAME_MACHINE=alphaev68 ;;
933   - esac
934   - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
935   - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
936   - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
937   - exit ;;
938   - parisc:Linux:*:* | hppa:Linux:*:*)
939   - # Look for CPU level
940   - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
941   - PA7*) echo hppa1.1-unknown-linux-gnu ;;
942   - PA8*) echo hppa2.0-unknown-linux-gnu ;;
943   - *) echo hppa-unknown-linux-gnu ;;
944   - esac
945   - exit ;;
946   - parisc64:Linux:*:* | hppa64:Linux:*:*)
947   - echo hppa64-unknown-linux-gnu
948   - exit ;;
949   - s390:Linux:*:* | s390x:Linux:*:*)
950   - echo ${UNAME_MACHINE}-ibm-linux
951   - exit ;;
952   - sh64*:Linux:*:*)
953   - echo ${UNAME_MACHINE}-unknown-linux-gnu
954   - exit ;;
955   - sh*:Linux:*:*)
956   - echo ${UNAME_MACHINE}-unknown-linux-gnu
957   - exit ;;
958   - sparc:Linux:*:* | sparc64:Linux:*:*)
959   - echo ${UNAME_MACHINE}-unknown-linux-gnu
960   - exit ;;
961   - vax:Linux:*:*)
962   - echo ${UNAME_MACHINE}-dec-linux-gnu
963   - exit ;;
964   - x86_64:Linux:*:*)
965   - echo x86_64-unknown-linux-gnu
966   - exit ;;
967   - xtensa*:Linux:*:*)
968   - echo ${UNAME_MACHINE}-unknown-linux-gnu
969   - exit ;;
970   - i*86:Linux:*:*)
971   - # The BFD linker knows what the default object file format is, so
972   - # first see if it will tell us. cd to the root directory to prevent
973   - # problems with other programs or directories called `ld' in the path.
974   - # Set LC_ALL=C to ensure ld outputs messages in English.
975   - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
976   - | sed -ne '/supported targets:/!d
977   - s/[ ][ ]*/ /g
978   - s/.*supported targets: *//
979   - s/ .*//
980   - p'`
981   - case "$ld_supported_targets" in
982   - elf32-i386)
983   - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
984   - ;;
985   - a.out-i386-linux)
986   - echo "${UNAME_MACHINE}-pc-linux-gnuaout"
987   - exit ;;
988   - coff-i386)
989   - echo "${UNAME_MACHINE}-pc-linux-gnucoff"
990   - exit ;;
991   - "")
992   - # Either a pre-BFD a.out linker (linux-gnuoldld) or
993   - # one that does not give us useful --help.
994   - echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
995   - exit ;;
996   - esac
997   - # Determine whether the default compiler is a.out or elf
998   - eval $set_cc_for_build
999   - sed 's/^ //' << EOF >$dummy.c
1000   - #include <features.h>
1001   - #ifdef __ELF__
1002   - # ifdef __GLIBC__
1003   - # if __GLIBC__ >= 2
1004   - LIBC=gnu
1005   - # else
1006   - LIBC=gnulibc1
1007   - # endif
1008   - # else
1009   - LIBC=gnulibc1
1010   - # endif
1011   - #else
1012   - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1013   - LIBC=gnu
1014   - #else
1015   - LIBC=gnuaout
1016   - #endif
1017   - #endif
1018   - #ifdef __dietlibc__
1019   - LIBC=dietlibc
1020   - #endif
1021   -EOF
1022   - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1023   - /^LIBC/{
1024   - s: ::g
1025   - p
1026   - }'`"
1027   - test x"${LIBC}" != x && {
1028   - echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1029   - exit
1030   - }
1031   - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1032   - ;;
1033   - i*86:DYNIX/ptx:4*:*)
1034   - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1035   - # earlier versions are messed up and put the nodename in both
1036   - # sysname and nodename.
1037   - echo i386-sequent-sysv4
1038   - exit ;;
1039   - i*86:UNIX_SV:4.2MP:2.*)
1040   - # Unixware is an offshoot of SVR4, but it has its own version
1041   - # number series starting with 2...
1042   - # I am not positive that other SVR4 systems won't match this,
1043   - # I just have to hope. -- rms.
1044   - # Use sysv4.2uw... so that sysv4* matches it.
1045   - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1046   - exit ;;
1047   - i*86:OS/2:*:*)
1048   - # If we were able to find `uname', then EMX Unix compatibility
1049   - # is probably installed.
1050   - echo ${UNAME_MACHINE}-pc-os2-emx
1051   - exit ;;
1052   - i*86:XTS-300:*:STOP)
1053   - echo ${UNAME_MACHINE}-unknown-stop
1054   - exit ;;
1055   - i*86:atheos:*:*)
1056   - echo ${UNAME_MACHINE}-unknown-atheos
1057   - exit ;;
1058   - i*86:syllable:*:*)
1059   - echo ${UNAME_MACHINE}-pc-syllable
1060   - exit ;;
1061   - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1062   - echo i386-unknown-lynxos${UNAME_RELEASE}
1063   - exit ;;
1064   - i*86:*DOS:*:*)
1065   - echo ${UNAME_MACHINE}-pc-msdosdjgpp
1066   - exit ;;
1067   - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1068   - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1069   - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1070   - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1071   - else
1072   - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1073   - fi
1074   - exit ;;
1075   - i*86:*:5:[678]*)
1076   - # UnixWare 7.x, OpenUNIX and OpenServer 6.
1077   - case `/bin/uname -X | grep "^Machine"` in
1078   - *486*) UNAME_MACHINE=i486 ;;
1079   - *Pentium) UNAME_MACHINE=i586 ;;
1080   - *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1081   - esac
1082   - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1083   - exit ;;
1084   - i*86:*:3.2:*)
1085   - if test -f /usr/options/cb.name; then
1086   - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1087   - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1088   - elif /bin/uname -X 2>/dev/null >/dev/null ; then
1089   - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1090   - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1091   - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1092   - && UNAME_MACHINE=i586
1093   - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1094   - && UNAME_MACHINE=i686
1095   - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1096   - && UNAME_MACHINE=i686
1097   - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1098   - else
1099   - echo ${UNAME_MACHINE}-pc-sysv32
1100   - fi
1101   - exit ;;
1102   - pc:*:*:*)
1103   - # Left here for compatibility:
1104   - # uname -m prints for DJGPP always 'pc', but it prints nothing about
1105   - # the processor, so we play safe by assuming i386.
1106   - echo i386-pc-msdosdjgpp
1107   - exit ;;
1108   - Intel:Mach:3*:*)
1109   - echo i386-pc-mach3
1110   - exit ;;
1111   - paragon:*:*:*)
1112   - echo i860-intel-osf1
1113   - exit ;;
1114   - i860:*:4.*:*) # i860-SVR4
1115   - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1116   - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1117   - else # Add other i860-SVR4 vendors below as they are discovered.
1118   - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1119   - fi
1120   - exit ;;
1121   - mini*:CTIX:SYS*5:*)
1122   - # "miniframe"
1123   - echo m68010-convergent-sysv
1124   - exit ;;
1125   - mc68k:UNIX:SYSTEM5:3.51m)
1126   - echo m68k-convergent-sysv
1127   - exit ;;
1128   - M680?0:D-NIX:5.3:*)
1129   - echo m68k-diab-dnix
1130   - exit ;;
1131   - M68*:*:R3V[5678]*:*)
1132   - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1133   - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1134   - OS_REL=''
1135   - test -r /etc/.relid \
1136   - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1137   - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1138   - && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1139   - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1140   - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1141   - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1142   - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1143   - && { echo i486-ncr-sysv4; exit; } ;;
1144   - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1145   - echo m68k-unknown-lynxos${UNAME_RELEASE}
1146   - exit ;;
1147   - mc68030:UNIX_System_V:4.*:*)
1148   - echo m68k-atari-sysv4
1149   - exit ;;
1150   - TSUNAMI:LynxOS:2.*:*)
1151   - echo sparc-unknown-lynxos${UNAME_RELEASE}
1152   - exit ;;
1153   - rs6000:LynxOS:2.*:*)
1154   - echo rs6000-unknown-lynxos${UNAME_RELEASE}
1155   - exit ;;
1156   - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1157   - echo powerpc-unknown-lynxos${UNAME_RELEASE}
1158   - exit ;;
1159   - SM[BE]S:UNIX_SV:*:*)
1160   - echo mips-dde-sysv${UNAME_RELEASE}
1161   - exit ;;
1162   - RM*:ReliantUNIX-*:*:*)
1163   - echo mips-sni-sysv4
1164   - exit ;;
1165   - RM*:SINIX-*:*:*)
1166   - echo mips-sni-sysv4
1167   - exit ;;
1168   - *:SINIX-*:*:*)
1169   - if uname -p 2>/dev/null >/dev/null ; then
1170   - UNAME_MACHINE=`(uname -p) 2>/dev/null`
1171   - echo ${UNAME_MACHINE}-sni-sysv4
1172   - else
1173   - echo ns32k-sni-sysv
1174   - fi
1175   - exit ;;
1176   - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1177   - # says <Richard.M.Bartel@ccMail.Census.GOV>
1178   - echo i586-unisys-sysv4
1179   - exit ;;
1180   - *:UNIX_System_V:4*:FTX*)
1181   - # From Gerald Hewes <hewes@openmarket.com>.
1182   - # How about differentiating between stratus architectures? -djm
1183   - echo hppa1.1-stratus-sysv4
1184   - exit ;;
1185   - *:*:*:FTX*)
1186   - # From seanf@swdc.stratus.com.
1187   - echo i860-stratus-sysv4
1188   - exit ;;
1189   - i*86:VOS:*:*)
1190   - # From Paul.Green@stratus.com.
1191   - echo ${UNAME_MACHINE}-stratus-vos
1192   - exit ;;
1193   - *:VOS:*:*)
1194   - # From Paul.Green@stratus.com.
1195   - echo hppa1.1-stratus-vos
1196   - exit ;;
1197   - mc68*:A/UX:*:*)
1198   - echo m68k-apple-aux${UNAME_RELEASE}
1199   - exit ;;
1200   - news*:NEWS-OS:6*:*)
1201   - echo mips-sony-newsos6
1202   - exit ;;
1203   - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1204   - if [ -d /usr/nec ]; then
1205   - echo mips-nec-sysv${UNAME_RELEASE}
1206   - else
1207   - echo mips-unknown-sysv${UNAME_RELEASE}
1208   - fi
1209   - exit ;;
1210   - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1211   - echo powerpc-be-beos
1212   - exit ;;
1213   - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1214   - echo powerpc-apple-beos
1215   - exit ;;
1216   - BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1217   - echo i586-pc-beos
1218   - exit ;;
1219   - SX-4:SUPER-UX:*:*)
1220   - echo sx4-nec-superux${UNAME_RELEASE}
1221   - exit ;;
1222   - SX-5:SUPER-UX:*:*)
1223   - echo sx5-nec-superux${UNAME_RELEASE}
1224   - exit ;;
1225   - SX-6:SUPER-UX:*:*)
1226   - echo sx6-nec-superux${UNAME_RELEASE}
1227   - exit ;;
1228   - SX-7:SUPER-UX:*:*)
1229   - echo sx7-nec-superux${UNAME_RELEASE}
1230   - exit ;;
1231   - SX-8:SUPER-UX:*:*)
1232   - echo sx8-nec-superux${UNAME_RELEASE}
1233   - exit ;;
1234   - SX-8R:SUPER-UX:*:*)
1235   - echo sx8r-nec-superux${UNAME_RELEASE}
1236   - exit ;;
1237   - Power*:Rhapsody:*:*)
1238   - echo powerpc-apple-rhapsody${UNAME_RELEASE}
1239   - exit ;;
1240   - *:Rhapsody:*:*)
1241   - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1242   - exit ;;
1243   - *:Darwin:*:*)
1244   - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1245   - case $UNAME_PROCESSOR in
1246   - unknown) UNAME_PROCESSOR=powerpc ;;
1247   - esac
1248   - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1249   - exit ;;
1250   - *:procnto*:*:* | *:QNX:[0123456789]*:*)
1251   - UNAME_PROCESSOR=`uname -p`
1252   - if test "$UNAME_PROCESSOR" = "x86"; then
1253   - UNAME_PROCESSOR=i386
1254   - UNAME_MACHINE=pc
1255   - fi
1256   - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1257   - exit ;;
1258   - *:QNX:*:4*)
1259   - echo i386-pc-qnx
1260   - exit ;;
1261   - NSE-?:NONSTOP_KERNEL:*:*)
1262   - echo nse-tandem-nsk${UNAME_RELEASE}
1263   - exit ;;
1264   - NSR-?:NONSTOP_KERNEL:*:*)
1265   - echo nsr-tandem-nsk${UNAME_RELEASE}
1266   - exit ;;
1267   - *:NonStop-UX:*:*)
1268   - echo mips-compaq-nonstopux
1269   - exit ;;
1270   - BS2000:POSIX*:*:*)
1271   - echo bs2000-siemens-sysv
1272   - exit ;;
1273   - DS/*:UNIX_System_V:*:*)
1274   - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1275   - exit ;;
1276   - *:Plan9:*:*)
1277   - # "uname -m" is not consistent, so use $cputype instead. 386
1278   - # is converted to i386 for consistency with other x86
1279   - # operating systems.
1280   - if test "$cputype" = "386"; then
1281   - UNAME_MACHINE=i386
1282   - else
1283   - UNAME_MACHINE="$cputype"
1284   - fi
1285   - echo ${UNAME_MACHINE}-unknown-plan9
1286   - exit ;;
1287   - *:TOPS-10:*:*)
1288   - echo pdp10-unknown-tops10
1289   - exit ;;
1290   - *:TENEX:*:*)
1291   - echo pdp10-unknown-tenex
1292   - exit ;;
1293   - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1294   - echo pdp10-dec-tops20
1295   - exit ;;
1296   - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1297   - echo pdp10-xkl-tops20
1298   - exit ;;
1299   - *:TOPS-20:*:*)
1300   - echo pdp10-unknown-tops20
1301   - exit ;;
1302   - *:ITS:*:*)
1303   - echo pdp10-unknown-its
1304   - exit ;;
1305   - SEI:*:*:SEIUX)
1306   - echo mips-sei-seiux${UNAME_RELEASE}
1307   - exit ;;
1308   - *:DragonFly:*:*)
1309   - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1310   - exit ;;
1311   - *:*VMS:*:*)
1312   - UNAME_MACHINE=`(uname -p) 2>/dev/null`
1313   - case "${UNAME_MACHINE}" in
1314   - A*) echo alpha-dec-vms ; exit ;;
1315   - I*) echo ia64-dec-vms ; exit ;;
1316   - V*) echo vax-dec-vms ; exit ;;
1317   - esac ;;
1318   - *:XENIX:*:SysV)
1319   - echo i386-pc-xenix
1320   - exit ;;
1321   - i*86:skyos:*:*)
1322   - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1323   - exit ;;
1324   - i*86:rdos:*:*)
1325   - echo ${UNAME_MACHINE}-pc-rdos
1326   - exit ;;
1327   -esac
1328   -
1329   -#echo '(No uname command or uname output not recognized.)' 1>&2
1330   -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1331   -
1332   -eval $set_cc_for_build
1333   -cat >$dummy.c <<EOF
1334   -#ifdef _SEQUENT_
1335   -# include <sys/types.h>
1336   -# include <sys/utsname.h>
1337   -#endif
1338   -main ()
1339   -{
1340   -#if defined (sony)
1341   -#if defined (MIPSEB)
1342   - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1343   - I don't know.... */
1344   - printf ("mips-sony-bsd\n"); exit (0);
1345   -#else
1346   -#include <sys/param.h>
1347   - printf ("m68k-sony-newsos%s\n",
1348   -#ifdef NEWSOS4
1349   - "4"
1350   -#else
1351   - ""
1352   -#endif
1353   - ); exit (0);
1354   -#endif
1355   -#endif
1356   -
1357   -#if defined (__arm) && defined (__acorn) && defined (__unix)
1358   - printf ("arm-acorn-riscix\n"); exit (0);
1359   -#endif
1360   -
1361   -#if defined (hp300) && !defined (hpux)
1362   - printf ("m68k-hp-bsd\n"); exit (0);
1363   -#endif
1364   -
1365   -#if defined (NeXT)
1366   -#if !defined (__ARCHITECTURE__)
1367   -#define __ARCHITECTURE__ "m68k"
1368   -#endif
1369   - int version;
1370   - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1371   - if (version < 4)
1372   - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1373   - else
1374   - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1375   - exit (0);
1376   -#endif
1377   -
1378   -#if defined (MULTIMAX) || defined (n16)
1379   -#if defined (UMAXV)
1380   - printf ("ns32k-encore-sysv\n"); exit (0);
1381   -#else
1382   -#if defined (CMU)
1383   - printf ("ns32k-encore-mach\n"); exit (0);
1384   -#else
1385   - printf ("ns32k-encore-bsd\n"); exit (0);
1386   -#endif
1387   -#endif
1388   -#endif
1389   -
1390   -#if defined (__386BSD__)
1391   - printf ("i386-pc-bsd\n"); exit (0);
1392   -#endif
1393   -
1394   -#if defined (sequent)
1395   -#if defined (i386)
1396   - printf ("i386-sequent-dynix\n"); exit (0);
1397   -#endif
1398   -#if defined (ns32000)
1399   - printf ("ns32k-sequent-dynix\n"); exit (0);
1400   -#endif
1401   -#endif
1402   -
1403   -#if defined (_SEQUENT_)
1404   - struct utsname un;
1405   -
1406   - uname(&un);
1407   -
1408   - if (strncmp(un.version, "V2", 2) == 0) {
1409   - printf ("i386-sequent-ptx2\n"); exit (0);
1410   - }
1411   - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1412   - printf ("i386-sequent-ptx1\n"); exit (0);
1413   - }
1414   - printf ("i386-sequent-ptx\n"); exit (0);
1415   -
1416   -#endif
1417   -
1418   -#if defined (vax)
1419   -# if !defined (ultrix)
1420   -# include <sys/param.h>
1421   -# if defined (BSD)
1422   -# if BSD == 43
1423   - printf ("vax-dec-bsd4.3\n"); exit (0);
1424   -# else
1425   -# if BSD == 199006
1426   - printf ("vax-dec-bsd4.3reno\n"); exit (0);
1427   -# else
1428   - printf ("vax-dec-bsd\n"); exit (0);
1429   -# endif
1430   -# endif
1431   -# else
1432   - printf ("vax-dec-bsd\n"); exit (0);
1433   -# endif
1434   -# else
1435   - printf ("vax-dec-ultrix\n"); exit (0);
1436   -# endif
1437   -#endif
1438   -
1439   -#if defined (alliant) && defined (i860)
1440   - printf ("i860-alliant-bsd\n"); exit (0);
1441   -#endif
1442   -
1443   - exit (1);
1444   -}
1445   -EOF
1446   -
1447   -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1448   - { echo "$SYSTEM_NAME"; exit; }
1449   -
1450   -# Apollos put the system type in the environment.
1451   -
1452   -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1453   -
1454   -# Convex versions that predate uname can use getsysinfo(1)
1455   -
1456   -if [ -x /usr/convex/getsysinfo ]
1457   -then
1458   - case `getsysinfo -f cpu_type` in
1459   - c1*)
1460   - echo c1-convex-bsd
1461   - exit ;;
1462   - c2*)
1463   - if getsysinfo -f scalar_acc
1464   - then echo c32-convex-bsd
1465   - else echo c2-convex-bsd
1466   - fi
1467   - exit ;;
1468   - c34*)
1469   - echo c34-convex-bsd
1470   - exit ;;
1471   - c38*)
1472   - echo c38-convex-bsd
1473   - exit ;;
1474   - c4*)
1475   - echo c4-convex-bsd
1476   - exit ;;
1477   - esac
1478   -fi
1479   -
1480   -cat >&2 <<EOF
1481   -$0: unable to guess system type
1482   -
1483   -This script, last modified $timestamp, has failed to recognize
1484   -the operating system you are using. It is advised that you
1485   -download the most up to date version of the config scripts from
1486   -
1487   - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1488   -and
1489   - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1490   -
1491   -If the version you run ($0) is already up to date, please
1492   -send the following data and any information you think might be
1493   -pertinent to <config-patches@gnu.org> in order to provide the needed
1494   -information to handle your system.
1495   -
1496   -config.guess timestamp = $timestamp
1497   -
1498   -uname -m = `(uname -m) 2>/dev/null || echo unknown`
1499   -uname -r = `(uname -r) 2>/dev/null || echo unknown`
1500   -uname -s = `(uname -s) 2>/dev/null || echo unknown`
1501   -uname -v = `(uname -v) 2>/dev/null || echo unknown`
1502   -
1503   -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1504   -/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1505   -
1506   -hostinfo = `(hostinfo) 2>/dev/null`
1507   -/bin/universe = `(/bin/universe) 2>/dev/null`
1508   -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1509   -/bin/arch = `(/bin/arch) 2>/dev/null`
1510   -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1511   -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1512   -
1513   -UNAME_MACHINE = ${UNAME_MACHINE}
1514   -UNAME_RELEASE = ${UNAME_RELEASE}
1515   -UNAME_SYSTEM = ${UNAME_SYSTEM}
1516   -UNAME_VERSION = ${UNAME_VERSION}
1517   -EOF
1518   -
1519   -exit 1
1520   -
1521   -# Local variables:
1522   -# eval: (add-hook 'write-file-hooks 'time-stamp)
1523   -# time-stamp-start: "timestamp='"
1524   -# time-stamp-format: "%:y-%02m-%02d"
1525   -# time-stamp-end: "'"
1526   -# End:
scripts/config.sub
... ... @@ -1,1658 +0,0 @@
1   -#! /bin/sh
2   -# Configuration validation subroutine script.
3   -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4   -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
5   -# Free Software Foundation, Inc.
6   -
7   -timestamp='2008-01-16'
8   -
9   -# This file is (in principle) common to ALL GNU software.
10   -# The presence of a machine in this file suggests that SOME GNU software
11   -# can handle that machine. It does not imply ALL GNU software can.
12   -#
13   -# This file is free software; you can redistribute it and/or modify
14   -# it under the terms of the GNU General Public License as published by
15   -# the Free Software Foundation; either version 2 of the License, or
16   -# (at your option) any later version.
17   -#
18   -# This program is distributed in the hope that it will be useful,
19   -# but WITHOUT ANY WARRANTY; without even the implied warranty of
20   -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21   -# GNU General Public License for more details.
22   -#
23   -# You should have received a copy of the GNU General Public License
24   -# along with this program; if not, write to the Free Software
25   -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
26   -# 02110-1301, USA.
27   -#
28   -# As a special exception to the GNU General Public License, if you
29   -# distribute this file as part of a program that contains a
30   -# configuration script generated by Autoconf, you may include it under
31   -# the same distribution terms that you use for the rest of that program.
32   -
33   -
34   -# Please send patches to <config-patches@gnu.org>. Submit a context
35   -# diff and a properly formatted ChangeLog entry.
36   -#
37   -# Configuration subroutine to validate and canonicalize a configuration type.
38   -# Supply the specified configuration type as an argument.
39   -# If it is invalid, we print an error message on stderr and exit with code 1.
40   -# Otherwise, we print the canonical config type on stdout and succeed.
41   -
42   -# This file is supposed to be the same for all GNU packages
43   -# and recognize all the CPU types, system types and aliases
44   -# that are meaningful with *any* GNU software.
45   -# Each package is responsible for reporting which valid configurations
46   -# it does not support. The user should be able to distinguish
47   -# a failure to support a valid configuration from a meaningless
48   -# configuration.
49   -
50   -# The goal of this file is to map all the various variations of a given
51   -# machine specification into a single specification in the form:
52   -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
53   -# or in some cases, the newer four-part form:
54   -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
55   -# It is wrong to echo any other type of specification.
56   -
57   -me=`echo "$0" | sed -e 's,.*/,,'`
58   -
59   -usage="\
60   -Usage: $0 [OPTION] CPU-MFR-OPSYS
61   - $0 [OPTION] ALIAS
62   -
63   -Canonicalize a configuration name.
64   -
65   -Operation modes:
66   - -h, --help print this help, then exit
67   - -t, --time-stamp print date of last modification, then exit
68   - -v, --version print version number, then exit
69   -
70   -Report bugs and patches to <config-patches@gnu.org>."
71   -
72   -version="\
73   -GNU config.sub ($timestamp)
74   -
75   -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
76   -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
77   -
78   -This is free software; see the source for copying conditions. There is NO
79   -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
80   -
81   -help="
82   -Try \`$me --help' for more information."
83   -
84   -# Parse command line
85   -while test $# -gt 0 ; do
86   - case $1 in
87   - --time-stamp | --time* | -t )
88   - echo "$timestamp" ; exit ;;
89   - --version | -v )
90   - echo "$version" ; exit ;;
91   - --help | --h* | -h )
92   - echo "$usage"; exit ;;
93   - -- ) # Stop option processing
94   - shift; break ;;
95   - - ) # Use stdin as input.
96   - break ;;
97   - -* )
98   - echo "$me: invalid option $1$help"
99   - exit 1 ;;
100   -
101   - *local*)
102   - # First pass through any local machine types.
103   - echo $1
104   - exit ;;
105   -
106   - * )
107   - break ;;
108   - esac
109   -done
110   -
111   -case $# in
112   - 0) echo "$me: missing argument$help" >&2
113   - exit 1;;
114   - 1) ;;
115   - *) echo "$me: too many arguments$help" >&2
116   - exit 1;;
117   -esac
118   -
119   -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
120   -# Here we must recognize all the valid KERNEL-OS combinations.
121   -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
122   -case $maybe_os in
123   - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
124   - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
125   - storm-chaos* | os2-emx* | rtmk-nova*)
126   - os=-$maybe_os
127   - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
128   - ;;
129   - *)
130   - basic_machine=`echo $1 | sed 's/-[^-]*$//'`
131   - if [ $basic_machine != $1 ]
132   - then os=`echo $1 | sed 's/.*-/-/'`
133   - else os=; fi
134   - ;;
135   -esac
136   -
137   -### Let's recognize common machines as not being operating systems so
138   -### that things like config.sub decstation-3100 work. We also
139   -### recognize some manufacturers as not being operating systems, so we
140   -### can provide default operating systems below.
141   -case $os in
142   - -sun*os*)
143   - # Prevent following clause from handling this invalid input.
144   - ;;
145   - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
146   - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
147   - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
148   - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
149   - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
150   - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
151   - -apple | -axis | -knuth | -cray)
152   - os=
153   - basic_machine=$1
154   - ;;
155   - -sim | -cisco | -oki | -wec | -winbond)
156   - os=
157   - basic_machine=$1
158   - ;;
159   - -scout)
160   - ;;
161   - -wrs)
162   - os=-vxworks
163   - basic_machine=$1
164   - ;;
165   - -chorusos*)
166   - os=-chorusos
167   - basic_machine=$1
168   - ;;
169   - -chorusrdb)
170   - os=-chorusrdb
171   - basic_machine=$1
172   - ;;
173   - -hiux*)
174   - os=-hiuxwe2
175   - ;;
176   - -sco6)
177   - os=-sco5v6
178   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
179   - ;;
180   - -sco5)
181   - os=-sco3.2v5
182   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
183   - ;;
184   - -sco4)
185   - os=-sco3.2v4
186   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
187   - ;;
188   - -sco3.2.[4-9]*)
189   - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
190   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
191   - ;;
192   - -sco3.2v[4-9]*)
193   - # Don't forget version if it is 3.2v4 or newer.
194   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
195   - ;;
196   - -sco5v6*)
197   - # Don't forget version if it is 3.2v4 or newer.
198   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
199   - ;;
200   - -sco*)
201   - os=-sco3.2v2
202   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
203   - ;;
204   - -udk*)
205   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206   - ;;
207   - -isc)
208   - os=-isc2.2
209   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
210   - ;;
211   - -clix*)
212   - basic_machine=clipper-intergraph
213   - ;;
214   - -isc*)
215   - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
216   - ;;
217   - -lynx*)
218   - os=-lynxos
219   - ;;
220   - -ptx*)
221   - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
222   - ;;
223   - -windowsnt*)
224   - os=`echo $os | sed -e 's/windowsnt/winnt/'`
225   - ;;
226   - -psos*)
227   - os=-psos
228   - ;;
229   - -mint | -mint[0-9]*)
230   - basic_machine=m68k-atari
231   - os=-mint
232   - ;;
233   -esac
234   -
235   -# Decode aliases for certain CPU-COMPANY combinations.
236   -case $basic_machine in
237   - # Recognize the basic CPU types without company name.
238   - # Some are omitted here because they have special meanings below.
239   - 1750a | 580 \
240   - | a29k \
241   - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
242   - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
243   - | am33_2.0 \
244   - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
245   - | bfin \
246   - | c4x | clipper \
247   - | d10v | d30v | dlx | dsp16xx \
248   - | fido | fr30 | frv \
249   - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
250   - | i370 | i860 | i960 | ia64 \
251   - | ip2k | iq2000 \
252   - | m32c | m32r | m32rle | m68000 | m68k | m88k \
253   - | maxq | mb | microblaze | mcore | mep \
254   - | mips | mipsbe | mipseb | mipsel | mipsle \
255   - | mips16 \
256   - | mips64 | mips64el \
257   - | mips64vr | mips64vrel \
258   - | mips64orion | mips64orionel \
259   - | mips64vr4100 | mips64vr4100el \
260   - | mips64vr4300 | mips64vr4300el \
261   - | mips64vr5000 | mips64vr5000el \
262   - | mips64vr5900 | mips64vr5900el \
263   - | mipsisa32 | mipsisa32el \
264   - | mipsisa32r2 | mipsisa32r2el \
265   - | mipsisa64 | mipsisa64el \
266   - | mipsisa64r2 | mipsisa64r2el \
267   - | mipsisa64sb1 | mipsisa64sb1el \
268   - | mipsisa64sr71k | mipsisa64sr71kel \
269   - | mipstx39 | mipstx39el \
270   - | mn10200 | mn10300 \
271   - | mt \
272   - | msp430 \
273   - | nios | nios2 \
274   - | ns16k | ns32k \
275   - | or32 \
276   - | pdp10 | pdp11 | pj | pjl \
277   - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
278   - | pyramid \
279   - | score \
280   - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
281   - | sh64 | sh64le \
282   - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
283   - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
284   - | spu | strongarm \
285   - | tahoe | thumb | tic4x | tic80 | tron \
286   - | v850 | v850e \
287   - | we32k \
288   - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
289   - | z8k)
290   - basic_machine=$basic_machine-unknown
291   - ;;
292   - m6811 | m68hc11 | m6812 | m68hc12)
293   - # Motorola 68HC11/12.
294   - basic_machine=$basic_machine-unknown
295   - os=-none
296   - ;;
297   - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
298   - ;;
299   - ms1)
300   - basic_machine=mt-unknown
301   - ;;
302   -
303   - # We use `pc' rather than `unknown'
304   - # because (1) that's what they normally are, and
305   - # (2) the word "unknown" tends to confuse beginning users.
306   - i*86 | x86_64)
307   - basic_machine=$basic_machine-pc
308   - ;;
309   - # Object if more than one company name word.
310   - *-*-*)
311   - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
312   - exit 1
313   - ;;
314   - # Recognize the basic CPU types with company name.
315   - 580-* \
316   - | a29k-* \
317   - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
318   - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
319   - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
320   - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
321   - | avr-* | avr32-* \
322   - | bfin-* | bs2000-* \
323   - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
324   - | clipper-* | craynv-* | cydra-* \
325   - | d10v-* | d30v-* | dlx-* \
326   - | elxsi-* \
327   - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
328   - | h8300-* | h8500-* \
329   - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
330   - | i*86-* | i860-* | i960-* | ia64-* \
331   - | ip2k-* | iq2000-* \
332   - | m32c-* | m32r-* | m32rle-* \
333   - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
334   - | m88110-* | m88k-* | maxq-* | mcore-* \
335   - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
336   - | mips16-* \
337   - | mips64-* | mips64el-* \
338   - | mips64vr-* | mips64vrel-* \
339   - | mips64orion-* | mips64orionel-* \
340   - | mips64vr4100-* | mips64vr4100el-* \
341   - | mips64vr4300-* | mips64vr4300el-* \
342   - | mips64vr5000-* | mips64vr5000el-* \
343   - | mips64vr5900-* | mips64vr5900el-* \
344   - | mipsisa32-* | mipsisa32el-* \
345   - | mipsisa32r2-* | mipsisa32r2el-* \
346   - | mipsisa64-* | mipsisa64el-* \
347   - | mipsisa64r2-* | mipsisa64r2el-* \
348   - | mipsisa64sb1-* | mipsisa64sb1el-* \
349   - | mipsisa64sr71k-* | mipsisa64sr71kel-* \
350   - | mipstx39-* | mipstx39el-* \
351   - | mmix-* \
352   - | mt-* \
353   - | msp430-* \
354   - | nios-* | nios2-* \
355   - | none-* | np1-* | ns16k-* | ns32k-* \
356   - | orion-* \
357   - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
358   - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
359   - | pyramid-* \
360   - | romp-* | rs6000-* \
361   - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
362   - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
363   - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
364   - | sparclite-* \
365   - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
366   - | tahoe-* | thumb-* \
367   - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
368   - | tron-* \
369   - | v850-* | v850e-* | vax-* \
370   - | we32k-* \
371   - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
372   - | xstormy16-* | xtensa*-* \
373   - | ymp-* \
374   - | z8k-*)
375   - ;;
376   - # Recognize the basic CPU types without company name, with glob match.
377   - xtensa*)
378   - basic_machine=$basic_machine-unknown
379   - ;;
380   - # Recognize the various machine names and aliases which stand
381   - # for a CPU type and a company and sometimes even an OS.
382   - 386bsd)
383   - basic_machine=i386-unknown
384   - os=-bsd
385   - ;;
386   - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
387   - basic_machine=m68000-att
388   - ;;
389   - 3b*)
390   - basic_machine=we32k-att
391   - ;;
392   - a29khif)
393   - basic_machine=a29k-amd
394   - os=-udi
395   - ;;
396   - abacus)
397   - basic_machine=abacus-unknown
398   - ;;
399   - adobe68k)
400   - basic_machine=m68010-adobe
401   - os=-scout
402   - ;;
403   - alliant | fx80)
404   - basic_machine=fx80-alliant
405   - ;;
406   - altos | altos3068)
407   - basic_machine=m68k-altos
408   - ;;
409   - am29k)
410   - basic_machine=a29k-none
411   - os=-bsd
412   - ;;
413   - amd64)
414   - basic_machine=x86_64-pc
415   - ;;
416   - amd64-*)
417   - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
418   - ;;
419   - amdahl)
420   - basic_machine=580-amdahl
421   - os=-sysv
422   - ;;
423   - amiga | amiga-*)
424   - basic_machine=m68k-unknown
425   - ;;
426   - amigaos | amigados)
427   - basic_machine=m68k-unknown
428   - os=-amigaos
429   - ;;
430   - amigaunix | amix)
431   - basic_machine=m68k-unknown
432   - os=-sysv4
433   - ;;
434   - apollo68)
435   - basic_machine=m68k-apollo
436   - os=-sysv
437   - ;;
438   - apollo68bsd)
439   - basic_machine=m68k-apollo
440   - os=-bsd
441   - ;;
442   - aux)
443   - basic_machine=m68k-apple
444   - os=-aux
445   - ;;
446   - balance)
447   - basic_machine=ns32k-sequent
448   - os=-dynix
449   - ;;
450   - blackfin)
451   - basic_machine=bfin-unknown
452   - os=-linux
453   - ;;
454   - blackfin-*)
455   - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
456   - os=-linux
457   - ;;
458   - c90)
459   - basic_machine=c90-cray
460   - os=-unicos
461   - ;;
462   - convex-c1)
463   - basic_machine=c1-convex
464   - os=-bsd
465   - ;;
466   - convex-c2)
467   - basic_machine=c2-convex
468   - os=-bsd
469   - ;;
470   - convex-c32)
471   - basic_machine=c32-convex
472   - os=-bsd
473   - ;;
474   - convex-c34)
475   - basic_machine=c34-convex
476   - os=-bsd
477   - ;;
478   - convex-c38)
479   - basic_machine=c38-convex
480   - os=-bsd
481   - ;;
482   - cray | j90)
483   - basic_machine=j90-cray
484   - os=-unicos
485   - ;;
486   - craynv)
487   - basic_machine=craynv-cray
488   - os=-unicosmp
489   - ;;
490   - cr16)
491   - basic_machine=cr16-unknown
492   - os=-elf
493   - ;;
494   - crds | unos)
495   - basic_machine=m68k-crds
496   - ;;
497   - crisv32 | crisv32-* | etraxfs*)
498   - basic_machine=crisv32-axis
499   - ;;
500   - cris | cris-* | etrax*)
501   - basic_machine=cris-axis
502   - ;;
503   - crx)
504   - basic_machine=crx-unknown
505   - os=-elf
506   - ;;
507   - da30 | da30-*)
508   - basic_machine=m68k-da30
509   - ;;
510   - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
511   - basic_machine=mips-dec
512   - ;;
513   - decsystem10* | dec10*)
514   - basic_machine=pdp10-dec
515   - os=-tops10
516   - ;;
517   - decsystem20* | dec20*)
518   - basic_machine=pdp10-dec
519   - os=-tops20
520   - ;;
521   - delta | 3300 | motorola-3300 | motorola-delta \
522   - | 3300-motorola | delta-motorola)
523   - basic_machine=m68k-motorola
524   - ;;
525   - delta88)
526   - basic_machine=m88k-motorola
527   - os=-sysv3
528   - ;;
529   - djgpp)
530   - basic_machine=i586-pc
531   - os=-msdosdjgpp
532   - ;;
533   - dpx20 | dpx20-*)
534   - basic_machine=rs6000-bull
535   - os=-bosx
536   - ;;
537   - dpx2* | dpx2*-bull)
538   - basic_machine=m68k-bull
539   - os=-sysv3
540   - ;;
541   - ebmon29k)
542   - basic_machine=a29k-amd
543   - os=-ebmon
544   - ;;
545   - elxsi)
546   - basic_machine=elxsi-elxsi
547   - os=-bsd
548   - ;;
549   - encore | umax | mmax)
550   - basic_machine=ns32k-encore
551   - ;;
552   - es1800 | OSE68k | ose68k | ose | OSE)
553   - basic_machine=m68k-ericsson
554   - os=-ose
555   - ;;
556   - fx2800)
557   - basic_machine=i860-alliant
558   - ;;
559   - genix)
560   - basic_machine=ns32k-ns
561   - ;;
562   - gmicro)
563   - basic_machine=tron-gmicro
564   - os=-sysv
565   - ;;
566   - go32)
567   - basic_machine=i386-pc
568   - os=-go32
569   - ;;
570   - h3050r* | hiux*)
571   - basic_machine=hppa1.1-hitachi
572   - os=-hiuxwe2
573   - ;;
574   - h8300hms)
575   - basic_machine=h8300-hitachi
576   - os=-hms
577   - ;;
578   - h8300xray)
579   - basic_machine=h8300-hitachi
580   - os=-xray
581   - ;;
582   - h8500hms)
583   - basic_machine=h8500-hitachi
584   - os=-hms
585   - ;;
586   - harris)
587   - basic_machine=m88k-harris
588   - os=-sysv3
589   - ;;
590   - hp300-*)
591   - basic_machine=m68k-hp
592   - ;;
593   - hp300bsd)
594   - basic_machine=m68k-hp
595   - os=-bsd
596   - ;;
597   - hp300hpux)
598   - basic_machine=m68k-hp
599   - os=-hpux
600   - ;;
601   - hp3k9[0-9][0-9] | hp9[0-9][0-9])
602   - basic_machine=hppa1.0-hp
603   - ;;
604   - hp9k2[0-9][0-9] | hp9k31[0-9])
605   - basic_machine=m68000-hp
606   - ;;
607   - hp9k3[2-9][0-9])
608   - basic_machine=m68k-hp
609   - ;;
610   - hp9k6[0-9][0-9] | hp6[0-9][0-9])
611   - basic_machine=hppa1.0-hp
612   - ;;
613   - hp9k7[0-79][0-9] | hp7[0-79][0-9])
614   - basic_machine=hppa1.1-hp
615   - ;;
616   - hp9k78[0-9] | hp78[0-9])
617   - # FIXME: really hppa2.0-hp
618   - basic_machine=hppa1.1-hp
619   - ;;
620   - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
621   - # FIXME: really hppa2.0-hp
622   - basic_machine=hppa1.1-hp
623   - ;;
624   - hp9k8[0-9][13679] | hp8[0-9][13679])
625   - basic_machine=hppa1.1-hp
626   - ;;
627   - hp9k8[0-9][0-9] | hp8[0-9][0-9])
628   - basic_machine=hppa1.0-hp
629   - ;;
630   - hppa-next)
631   - os=-nextstep3
632   - ;;
633   - hppaosf)
634   - basic_machine=hppa1.1-hp
635   - os=-osf
636   - ;;
637   - hppro)
638   - basic_machine=hppa1.1-hp
639   - os=-proelf
640   - ;;
641   - i370-ibm* | ibm*)
642   - basic_machine=i370-ibm
643   - ;;
644   -# I'm not sure what "Sysv32" means. Should this be sysv3.2?
645   - i*86v32)
646   - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
647   - os=-sysv32
648   - ;;
649   - i*86v4*)
650   - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
651   - os=-sysv4
652   - ;;
653   - i*86v)
654   - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
655   - os=-sysv
656   - ;;
657   - i*86sol2)
658   - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
659   - os=-solaris2
660   - ;;
661   - i386mach)
662   - basic_machine=i386-mach
663   - os=-mach
664   - ;;
665   - i386-vsta | vsta)
666   - basic_machine=i386-unknown
667   - os=-vsta
668   - ;;
669   - iris | iris4d)
670   - basic_machine=mips-sgi
671   - case $os in
672   - -irix*)
673   - ;;
674   - *)
675   - os=-irix4
676   - ;;
677   - esac
678   - ;;
679   - isi68 | isi)
680   - basic_machine=m68k-isi
681   - os=-sysv
682   - ;;
683   - m68knommu)
684   - basic_machine=m68k-unknown
685   - os=-linux
686   - ;;
687   - m68knommu-*)
688   - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
689   - os=-linux
690   - ;;
691   - m88k-omron*)
692   - basic_machine=m88k-omron
693   - ;;
694   - magnum | m3230)
695   - basic_machine=mips-mips
696   - os=-sysv
697   - ;;
698   - merlin)
699   - basic_machine=ns32k-utek
700   - os=-sysv
701   - ;;
702   - mingw32)
703   - basic_machine=i386-pc
704   - os=-mingw32
705   - ;;
706   - mingw32ce)
707   - basic_machine=arm-unknown
708   - os=-mingw32ce
709   - ;;
710   - miniframe)
711   - basic_machine=m68000-convergent
712   - ;;
713   - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
714   - basic_machine=m68k-atari
715   - os=-mint
716   - ;;
717   - mips3*-*)
718   - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
719   - ;;
720   - mips3*)
721   - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
722   - ;;
723   - monitor)
724   - basic_machine=m68k-rom68k
725   - os=-coff
726   - ;;
727   - morphos)
728   - basic_machine=powerpc-unknown
729   - os=-morphos
730   - ;;
731   - msdos)
732   - basic_machine=i386-pc
733   - os=-msdos
734   - ;;
735   - ms1-*)
736   - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
737   - ;;
738   - mvs)
739   - basic_machine=i370-ibm
740   - os=-mvs
741   - ;;
742   - ncr3000)
743   - basic_machine=i486-ncr
744   - os=-sysv4
745   - ;;
746   - netbsd386)
747   - basic_machine=i386-unknown
748   - os=-netbsd
749   - ;;
750   - netwinder)
751   - basic_machine=armv4l-rebel
752   - os=-linux
753   - ;;
754   - news | news700 | news800 | news900)
755   - basic_machine=m68k-sony
756   - os=-newsos
757   - ;;
758   - news1000)
759   - basic_machine=m68030-sony
760   - os=-newsos
761   - ;;
762   - news-3600 | risc-news)
763   - basic_machine=mips-sony
764   - os=-newsos
765   - ;;
766   - necv70)
767   - basic_machine=v70-nec
768   - os=-sysv
769   - ;;
770   - next | m*-next )
771   - basic_machine=m68k-next
772   - case $os in
773   - -nextstep* )
774   - ;;
775   - -ns2*)
776   - os=-nextstep2
777   - ;;
778   - *)
779   - os=-nextstep3
780   - ;;
781   - esac
782   - ;;
783   - nh3000)
784   - basic_machine=m68k-harris
785   - os=-cxux
786   - ;;
787   - nh[45]000)
788   - basic_machine=m88k-harris
789   - os=-cxux
790   - ;;
791   - nindy960)
792   - basic_machine=i960-intel
793   - os=-nindy
794   - ;;
795   - mon960)
796   - basic_machine=i960-intel
797   - os=-mon960
798   - ;;
799   - nonstopux)
800   - basic_machine=mips-compaq
801   - os=-nonstopux
802   - ;;
803   - np1)
804   - basic_machine=np1-gould
805   - ;;
806   - nsr-tandem)
807   - basic_machine=nsr-tandem
808   - ;;
809   - op50n-* | op60c-*)
810   - basic_machine=hppa1.1-oki
811   - os=-proelf
812   - ;;
813   - openrisc | openrisc-*)
814   - basic_machine=or32-unknown
815   - ;;
816   - os400)
817   - basic_machine=powerpc-ibm
818   - os=-os400
819   - ;;
820   - OSE68000 | ose68000)
821   - basic_machine=m68000-ericsson
822   - os=-ose
823   - ;;
824   - os68k)
825   - basic_machine=m68k-none
826   - os=-os68k
827   - ;;
828   - pa-hitachi)
829   - basic_machine=hppa1.1-hitachi
830   - os=-hiuxwe2
831   - ;;
832   - paragon)
833   - basic_machine=i860-intel
834   - os=-osf
835   - ;;
836   - parisc)
837   - basic_machine=hppa-unknown
838   - os=-linux
839   - ;;
840   - parisc-*)
841   - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
842   - os=-linux
843   - ;;
844   - pbd)
845   - basic_machine=sparc-tti
846   - ;;
847   - pbb)
848   - basic_machine=m68k-tti
849   - ;;
850   - pc532 | pc532-*)
851   - basic_machine=ns32k-pc532
852   - ;;
853   - pc98)
854   - basic_machine=i386-pc
855   - ;;
856   - pc98-*)
857   - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
858   - ;;
859   - pentium | p5 | k5 | k6 | nexgen | viac3)
860   - basic_machine=i586-pc
861   - ;;
862   - pentiumpro | p6 | 6x86 | athlon | athlon_*)
863   - basic_machine=i686-pc
864   - ;;
865   - pentiumii | pentium2 | pentiumiii | pentium3)
866   - basic_machine=i686-pc
867   - ;;
868   - pentium4)
869   - basic_machine=i786-pc
870   - ;;
871   - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
872   - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
873   - ;;
874   - pentiumpro-* | p6-* | 6x86-* | athlon-*)
875   - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
876   - ;;
877   - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
878   - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
879   - ;;
880   - pentium4-*)
881   - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
882   - ;;
883   - pn)
884   - basic_machine=pn-gould
885   - ;;
886   - power) basic_machine=power-ibm
887   - ;;
888   - ppc) basic_machine=powerpc-unknown
889   - ;;
890   - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
891   - ;;
892   - ppcle | powerpclittle | ppc-le | powerpc-little)
893   - basic_machine=powerpcle-unknown
894   - ;;
895   - ppcle-* | powerpclittle-*)
896   - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
897   - ;;
898   - ppc64) basic_machine=powerpc64-unknown
899   - ;;
900   - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
901   - ;;
902   - ppc64le | powerpc64little | ppc64-le | powerpc64-little)
903   - basic_machine=powerpc64le-unknown
904   - ;;
905   - ppc64le-* | powerpc64little-*)
906   - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
907   - ;;
908   - ps2)
909   - basic_machine=i386-ibm
910   - ;;
911   - pw32)
912   - basic_machine=i586-unknown
913   - os=-pw32
914   - ;;
915   - rdos)
916   - basic_machine=i386-pc
917   - os=-rdos
918   - ;;
919   - rom68k)
920   - basic_machine=m68k-rom68k
921   - os=-coff
922   - ;;
923   - rm[46]00)
924   - basic_machine=mips-siemens
925   - ;;
926   - rtpc | rtpc-*)
927   - basic_machine=romp-ibm
928   - ;;
929   - s390 | s390-*)
930   - basic_machine=s390-ibm
931   - ;;
932   - s390x | s390x-*)
933   - basic_machine=s390x-ibm
934   - ;;
935   - sa29200)
936   - basic_machine=a29k-amd
937   - os=-udi
938   - ;;
939   - sb1)
940   - basic_machine=mipsisa64sb1-unknown
941   - ;;
942   - sb1el)
943   - basic_machine=mipsisa64sb1el-unknown
944   - ;;
945   - sde)
946   - basic_machine=mipsisa32-sde
947   - os=-elf
948   - ;;
949   - sei)
950   - basic_machine=mips-sei
951   - os=-seiux
952   - ;;
953   - sequent)
954   - basic_machine=i386-sequent
955   - ;;
956   - sh)
957   - basic_machine=sh-hitachi
958   - os=-hms
959   - ;;
960   - sh5el)
961   - basic_machine=sh5le-unknown
962   - ;;
963   - sh64)
964   - basic_machine=sh64-unknown
965   - ;;
966   - sparclite-wrs | simso-wrs)
967   - basic_machine=sparclite-wrs
968   - os=-vxworks
969   - ;;
970   - sps7)
971   - basic_machine=m68k-bull
972   - os=-sysv2
973   - ;;
974   - spur)
975   - basic_machine=spur-unknown
976   - ;;
977   - st2000)
978   - basic_machine=m68k-tandem
979   - ;;
980   - stratus)
981   - basic_machine=i860-stratus
982   - os=-sysv4
983   - ;;
984   - sun2)
985   - basic_machine=m68000-sun
986   - ;;
987   - sun2os3)
988   - basic_machine=m68000-sun
989   - os=-sunos3
990   - ;;
991   - sun2os4)
992   - basic_machine=m68000-sun
993   - os=-sunos4
994   - ;;
995   - sun3os3)
996   - basic_machine=m68k-sun
997   - os=-sunos3
998   - ;;
999   - sun3os4)
1000   - basic_machine=m68k-sun
1001   - os=-sunos4
1002   - ;;
1003   - sun4os3)
1004   - basic_machine=sparc-sun
1005   - os=-sunos3
1006   - ;;
1007   - sun4os4)
1008   - basic_machine=sparc-sun
1009   - os=-sunos4
1010   - ;;
1011   - sun4sol2)
1012   - basic_machine=sparc-sun
1013   - os=-solaris2
1014   - ;;
1015   - sun3 | sun3-*)
1016   - basic_machine=m68k-sun
1017   - ;;
1018   - sun4)
1019   - basic_machine=sparc-sun
1020   - ;;
1021   - sun386 | sun386i | roadrunner)
1022   - basic_machine=i386-sun
1023   - ;;
1024   - sv1)
1025   - basic_machine=sv1-cray
1026   - os=-unicos
1027   - ;;
1028   - symmetry)
1029   - basic_machine=i386-sequent
1030   - os=-dynix
1031   - ;;
1032   - t3e)
1033   - basic_machine=alphaev5-cray
1034   - os=-unicos
1035   - ;;
1036   - t90)
1037   - basic_machine=t90-cray
1038   - os=-unicos
1039   - ;;
1040   - tic54x | c54x*)
1041   - basic_machine=tic54x-unknown
1042   - os=-coff
1043   - ;;
1044   - tic55x | c55x*)
1045   - basic_machine=tic55x-unknown
1046   - os=-coff
1047   - ;;
1048   - tic6x | c6x*)
1049   - basic_machine=tic6x-unknown
1050   - os=-coff
1051   - ;;
1052   - tile*)
1053   - basic_machine=tile-unknown
1054   - os=-linux-gnu
1055   - ;;
1056   - tx39)
1057   - basic_machine=mipstx39-unknown
1058   - ;;
1059   - tx39el)
1060   - basic_machine=mipstx39el-unknown
1061   - ;;
1062   - toad1)
1063   - basic_machine=pdp10-xkl
1064   - os=-tops20
1065   - ;;
1066   - tower | tower-32)
1067   - basic_machine=m68k-ncr
1068   - ;;
1069   - tpf)
1070   - basic_machine=s390x-ibm
1071   - os=-tpf
1072   - ;;
1073   - udi29k)
1074   - basic_machine=a29k-amd
1075   - os=-udi
1076   - ;;
1077   - ultra3)
1078   - basic_machine=a29k-nyu
1079   - os=-sym1
1080   - ;;
1081   - v810 | necv810)
1082   - basic_machine=v810-nec
1083   - os=-none
1084   - ;;
1085   - vaxv)
1086   - basic_machine=vax-dec
1087   - os=-sysv
1088   - ;;
1089   - vms)
1090   - basic_machine=vax-dec
1091   - os=-vms
1092   - ;;
1093   - vpp*|vx|vx-*)
1094   - basic_machine=f301-fujitsu
1095   - ;;
1096   - vxworks960)
1097   - basic_machine=i960-wrs
1098   - os=-vxworks
1099   - ;;
1100   - vxworks68)
1101   - basic_machine=m68k-wrs
1102   - os=-vxworks
1103   - ;;
1104   - vxworks29k)
1105   - basic_machine=a29k-wrs
1106   - os=-vxworks
1107   - ;;
1108   - w65*)
1109   - basic_machine=w65-wdc
1110   - os=-none
1111   - ;;
1112   - w89k-*)
1113   - basic_machine=hppa1.1-winbond
1114   - os=-proelf
1115   - ;;
1116   - xbox)
1117   - basic_machine=i686-pc
1118   - os=-mingw32
1119   - ;;
1120   - xps | xps100)
1121   - basic_machine=xps100-honeywell
1122   - ;;
1123   - ymp)
1124   - basic_machine=ymp-cray
1125   - os=-unicos
1126   - ;;
1127   - z8k-*-coff)
1128   - basic_machine=z8k-unknown
1129   - os=-sim
1130   - ;;
1131   - none)
1132   - basic_machine=none-none
1133   - os=-none
1134   - ;;
1135   -
1136   -# Here we handle the default manufacturer of certain CPU types. It is in
1137   -# some cases the only manufacturer, in others, it is the most popular.
1138   - w89k)
1139   - basic_machine=hppa1.1-winbond
1140   - ;;
1141   - op50n)
1142   - basic_machine=hppa1.1-oki
1143   - ;;
1144   - op60c)
1145   - basic_machine=hppa1.1-oki
1146   - ;;
1147   - romp)
1148   - basic_machine=romp-ibm
1149   - ;;
1150   - mmix)
1151   - basic_machine=mmix-knuth
1152   - ;;
1153   - rs6000)
1154   - basic_machine=rs6000-ibm
1155   - ;;
1156   - vax)
1157   - basic_machine=vax-dec
1158   - ;;
1159   - pdp10)
1160   - # there are many clones, so DEC is not a safe bet
1161   - basic_machine=pdp10-unknown
1162   - ;;
1163   - pdp11)
1164   - basic_machine=pdp11-dec
1165   - ;;
1166   - we32k)
1167   - basic_machine=we32k-att
1168   - ;;
1169   - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
1170   - basic_machine=sh-unknown
1171   - ;;
1172   - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1173   - basic_machine=sparc-sun
1174   - ;;
1175   - cydra)
1176   - basic_machine=cydra-cydrome
1177   - ;;
1178   - orion)
1179   - basic_machine=orion-highlevel
1180   - ;;
1181   - orion105)
1182   - basic_machine=clipper-highlevel
1183   - ;;
1184   - mac | mpw | mac-mpw)
1185   - basic_machine=m68k-apple
1186   - ;;
1187   - pmac | pmac-mpw)
1188   - basic_machine=powerpc-apple
1189   - ;;
1190   - *-unknown)
1191   - # Make sure to match an already-canonicalized machine name.
1192   - ;;
1193   - *)
1194   - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1195   - exit 1
1196   - ;;
1197   -esac
1198   -
1199   -# Here we canonicalize certain aliases for manufacturers.
1200   -case $basic_machine in
1201   - *-digital*)
1202   - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1203   - ;;
1204   - *-commodore*)
1205   - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1206   - ;;
1207   - *)
1208   - ;;
1209   -esac
1210   -
1211   -# Decode manufacturer-specific aliases for certain operating systems.
1212   -
1213   -if [ x"$os" != x"" ]
1214   -then
1215   -case $os in
1216   - # First match some system type aliases
1217   - # that might get confused with valid system types.
1218   - # -solaris* is a basic system type, with this one exception.
1219   - -solaris1 | -solaris1.*)
1220   - os=`echo $os | sed -e 's|solaris1|sunos4|'`
1221   - ;;
1222   - -solaris)
1223   - os=-solaris2
1224   - ;;
1225   - -svr4*)
1226   - os=-sysv4
1227   - ;;
1228   - -unixware*)
1229   - os=-sysv4.2uw
1230   - ;;
1231   - -gnu/linux*)
1232   - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1233   - ;;
1234   - # First accept the basic system types.
1235   - # The portable systems comes first.
1236   - # Each alternative MUST END IN A *, to match a version number.
1237   - # -sysv* is not here because it comes later, after sysvr4.
1238   - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1239   - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1240   - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1241   - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1242   - | -aos* \
1243   - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1244   - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1245   - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1246   - | -openbsd* | -solidbsd* \
1247   - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1248   - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1249   - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1250   - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1251   - | -chorusos* | -chorusrdb* \
1252   - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1253   - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1254   - | -uxpv* | -beos* | -mpeix* | -udk* \
1255   - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1256   - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1257   - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1258   - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1259   - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1260   - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1261   - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
1262   - # Remember, each alternative MUST END IN *, to match a version number.
1263   - ;;
1264   - -qnx*)
1265   - case $basic_machine in
1266   - x86-* | i*86-*)
1267   - ;;
1268   - *)
1269   - os=-nto$os
1270   - ;;
1271   - esac
1272   - ;;
1273   - -nto-qnx*)
1274   - ;;
1275   - -nto*)
1276   - os=`echo $os | sed -e 's|nto|nto-qnx|'`
1277   - ;;
1278   - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1279   - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1280   - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1281   - ;;
1282   - -mac*)
1283   - os=`echo $os | sed -e 's|mac|macos|'`
1284   - ;;
1285   - -linux-dietlibc)
1286   - os=-linux-dietlibc
1287   - ;;
1288   - -linux*)
1289   - os=`echo $os | sed -e 's|linux|linux-gnu|'`
1290   - ;;
1291   - -sunos5*)
1292   - os=`echo $os | sed -e 's|sunos5|solaris2|'`
1293   - ;;
1294   - -sunos6*)
1295   - os=`echo $os | sed -e 's|sunos6|solaris3|'`
1296   - ;;
1297   - -opened*)
1298   - os=-openedition
1299   - ;;
1300   - -os400*)
1301   - os=-os400
1302   - ;;
1303   - -wince*)
1304   - os=-wince
1305   - ;;
1306   - -osfrose*)
1307   - os=-osfrose
1308   - ;;
1309   - -osf*)
1310   - os=-osf
1311   - ;;
1312   - -utek*)
1313   - os=-bsd
1314   - ;;
1315   - -dynix*)
1316   - os=-bsd
1317   - ;;
1318   - -acis*)
1319   - os=-aos
1320   - ;;
1321   - -atheos*)
1322   - os=-atheos
1323   - ;;
1324   - -syllable*)
1325   - os=-syllable
1326   - ;;
1327   - -386bsd)
1328   - os=-bsd
1329   - ;;
1330   - -ctix* | -uts*)
1331   - os=-sysv
1332   - ;;
1333   - -nova*)
1334   - os=-rtmk-nova
1335   - ;;
1336   - -ns2 )
1337   - os=-nextstep2
1338   - ;;
1339   - -nsk*)
1340   - os=-nsk
1341   - ;;
1342   - # Preserve the version number of sinix5.
1343   - -sinix5.*)
1344   - os=`echo $os | sed -e 's|sinix|sysv|'`
1345   - ;;
1346   - -sinix*)
1347   - os=-sysv4
1348   - ;;
1349   - -tpf*)
1350   - os=-tpf
1351   - ;;
1352   - -triton*)
1353   - os=-sysv3
1354   - ;;
1355   - -oss*)
1356   - os=-sysv3
1357   - ;;
1358   - -svr4)
1359   - os=-sysv4
1360   - ;;
1361   - -svr3)
1362   - os=-sysv3
1363   - ;;
1364   - -sysvr4)
1365   - os=-sysv4
1366   - ;;
1367   - # This must come after -sysvr4.
1368   - -sysv*)
1369   - ;;
1370   - -ose*)
1371   - os=-ose
1372   - ;;
1373   - -es1800*)
1374   - os=-ose
1375   - ;;
1376   - -xenix)
1377   - os=-xenix
1378   - ;;
1379   - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1380   - os=-mint
1381   - ;;
1382   - -aros*)
1383   - os=-aros
1384   - ;;
1385   - -kaos*)
1386   - os=-kaos
1387   - ;;
1388   - -zvmoe)
1389   - os=-zvmoe
1390   - ;;
1391   - -none)
1392   - ;;
1393   - *)
1394   - # Get rid of the `-' at the beginning of $os.
1395   - os=`echo $os | sed 's/[^-]*-//'`
1396   - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1397   - exit 1
1398   - ;;
1399   -esac
1400   -else
1401   -
1402   -# Here we handle the default operating systems that come with various machines.
1403   -# The value should be what the vendor currently ships out the door with their
1404   -# machine or put another way, the most popular os provided with the machine.
1405   -
1406   -# Note that if you're going to try to match "-MANUFACTURER" here (say,
1407   -# "-sun"), then you have to tell the case statement up towards the top
1408   -# that MANUFACTURER isn't an operating system. Otherwise, code above
1409   -# will signal an error saying that MANUFACTURER isn't an operating
1410   -# system, and we'll never get to this point.
1411   -
1412   -case $basic_machine in
1413   - score-*)
1414   - os=-elf
1415   - ;;
1416   - spu-*)
1417   - os=-elf
1418   - ;;
1419   - *-acorn)
1420   - os=-riscix1.2
1421   - ;;
1422   - arm*-rebel)
1423   - os=-linux
1424   - ;;
1425   - arm*-semi)
1426   - os=-aout
1427   - ;;
1428   - c4x-* | tic4x-*)
1429   - os=-coff
1430   - ;;
1431   - # This must come before the *-dec entry.
1432   - pdp10-*)
1433   - os=-tops20
1434   - ;;
1435   - pdp11-*)
1436   - os=-none
1437   - ;;
1438   - *-dec | vax-*)
1439   - os=-ultrix4.2
1440   - ;;
1441   - m68*-apollo)
1442   - os=-domain
1443   - ;;
1444   - i386-sun)
1445   - os=-sunos4.0.2
1446   - ;;
1447   - m68000-sun)
1448   - os=-sunos3
1449   - # This also exists in the configure program, but was not the
1450   - # default.
1451   - # os=-sunos4
1452   - ;;
1453   - m68*-cisco)
1454   - os=-aout
1455   - ;;
1456   - mep-*)
1457   - os=-elf
1458   - ;;
1459   - mips*-cisco)
1460   - os=-elf
1461   - ;;
1462   - mips*-*)
1463   - os=-elf
1464   - ;;
1465   - or32-*)
1466   - os=-coff
1467   - ;;
1468   - *-tti) # must be before sparc entry or we get the wrong os.
1469   - os=-sysv3
1470   - ;;
1471   - sparc-* | *-sun)
1472   - os=-sunos4.1.1
1473   - ;;
1474   - *-be)
1475   - os=-beos
1476   - ;;
1477   - *-haiku)
1478   - os=-haiku
1479   - ;;
1480   - *-ibm)
1481   - os=-aix
1482   - ;;
1483   - *-knuth)
1484   - os=-mmixware
1485   - ;;
1486   - *-wec)
1487   - os=-proelf
1488   - ;;
1489   - *-winbond)
1490   - os=-proelf
1491   - ;;
1492   - *-oki)
1493   - os=-proelf
1494   - ;;
1495   - *-hp)
1496   - os=-hpux
1497   - ;;
1498   - *-hitachi)
1499   - os=-hiux
1500   - ;;
1501   - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1502   - os=-sysv
1503   - ;;
1504   - *-cbm)
1505   - os=-amigaos
1506   - ;;
1507   - *-dg)
1508   - os=-dgux
1509   - ;;
1510   - *-dolphin)
1511   - os=-sysv3
1512   - ;;
1513   - m68k-ccur)
1514   - os=-rtu
1515   - ;;
1516   - m88k-omron*)
1517   - os=-luna
1518   - ;;
1519   - *-next )
1520   - os=-nextstep
1521   - ;;
1522   - *-sequent)
1523   - os=-ptx
1524   - ;;
1525   - *-crds)
1526   - os=-unos
1527   - ;;
1528   - *-ns)
1529   - os=-genix
1530   - ;;
1531   - i370-*)
1532   - os=-mvs
1533   - ;;
1534   - *-next)
1535   - os=-nextstep3
1536   - ;;
1537   - *-gould)
1538   - os=-sysv
1539   - ;;
1540   - *-highlevel)
1541   - os=-bsd
1542   - ;;
1543   - *-encore)
1544   - os=-bsd
1545   - ;;
1546   - *-sgi)
1547   - os=-irix
1548   - ;;
1549   - *-siemens)
1550   - os=-sysv4
1551   - ;;
1552   - *-masscomp)
1553   - os=-rtu
1554   - ;;
1555   - f30[01]-fujitsu | f700-fujitsu)
1556   - os=-uxpv
1557   - ;;
1558   - *-rom68k)
1559   - os=-coff
1560   - ;;
1561   - *-*bug)
1562   - os=-coff
1563   - ;;
1564   - *-apple)
1565   - os=-macos
1566   - ;;
1567   - *-atari*)
1568   - os=-mint
1569   - ;;
1570   - *)
1571   - os=-none
1572   - ;;
1573   -esac
1574   -fi
1575   -
1576   -# Here we handle the case where we know the os, and the CPU type, but not the
1577   -# manufacturer. We pick the logical manufacturer.
1578   -vendor=unknown
1579   -case $basic_machine in
1580   - *-unknown)
1581   - case $os in
1582   - -riscix*)
1583   - vendor=acorn
1584   - ;;
1585   - -sunos*)
1586   - vendor=sun
1587   - ;;
1588   - -aix*)
1589   - vendor=ibm
1590   - ;;
1591   - -beos*)
1592   - vendor=be
1593   - ;;
1594   - -hpux*)
1595   - vendor=hp
1596   - ;;
1597   - -mpeix*)
1598   - vendor=hp
1599   - ;;
1600   - -hiux*)
1601   - vendor=hitachi
1602   - ;;
1603   - -unos*)
1604   - vendor=crds
1605   - ;;
1606   - -dgux*)
1607   - vendor=dg
1608   - ;;
1609   - -luna*)
1610   - vendor=omron
1611   - ;;
1612   - -genix*)
1613   - vendor=ns
1614   - ;;
1615   - -mvs* | -opened*)
1616   - vendor=ibm
1617   - ;;
1618   - -os400*)
1619   - vendor=ibm
1620   - ;;
1621   - -ptx*)
1622   - vendor=sequent
1623   - ;;
1624   - -tpf*)
1625   - vendor=ibm
1626   - ;;
1627   - -vxsim* | -vxworks* | -windiss*)
1628   - vendor=wrs
1629   - ;;
1630   - -aux*)
1631   - vendor=apple
1632   - ;;
1633   - -hms*)
1634   - vendor=hitachi
1635   - ;;
1636   - -mpw* | -macos*)
1637   - vendor=apple
1638   - ;;
1639   - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1640   - vendor=atari
1641   - ;;
1642   - -vos*)
1643   - vendor=stratus
1644   - ;;
1645   - esac
1646   - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1647   - ;;
1648   -esac
1649   -
1650   -echo $basic_machine$os
1651   -exit
1652   -
1653   -# Local variables:
1654   -# eval: (add-hook 'write-file-hooks 'time-stamp)
1655   -# time-stamp-start: "timestamp='"
1656   -# time-stamp-format: "%:y-%02m-%02d"
1657   -# time-stamp-end: "'"
1658   -# End:
scripts/install-sh
... ... @@ -1,251 +0,0 @@
1   -#!/bin/sh
2   -#
3   -# install - install a program, script, or datafile
4   -# This comes from X11R5 (mit/util/scripts/install.sh).
5   -#
6   -# Copyright 1991 by the Massachusetts Institute of Technology
7   -#
8   -# Permission to use, copy, modify, distribute, and sell this software and its
9   -# documentation for any purpose is hereby granted without fee, provided that
10   -# the above copyright notice appear in all copies and that both that
11   -# copyright notice and this permission notice appear in supporting
12   -# documentation, and that the name of M.I.T. not be used in advertising or
13   -# publicity pertaining to distribution of the software without specific,
14   -# written prior permission. M.I.T. makes no representations about the
15   -# suitability of this software for any purpose. It is provided "as is"
16   -# without express or implied warranty.
17   -#
18   -# Calling this script install-sh is preferred over install.sh, to prevent
19   -# `make' implicit rules from creating a file called install from it
20   -# when there is no Makefile.
21   -#
22   -# This script is compatible with the BSD install script, but was written
23   -# from scratch. It can only install one file at a time, a restriction
24   -# shared with many OS's install programs.
25   -
26   -
27   -# set DOITPROG to echo to test this script
28   -
29   -# Don't use :- since 4.3BSD and earlier shells don't like it.
30   -doit="${DOITPROG-}"
31   -
32   -
33   -# put in absolute paths if you don't have them in your path; or use env. vars.
34   -
35   -mvprog="${MVPROG-mv}"
36   -cpprog="${CPPROG-cp}"
37   -chmodprog="${CHMODPROG-chmod}"
38   -chownprog="${CHOWNPROG-chown}"
39   -chgrpprog="${CHGRPPROG-chgrp}"
40   -stripprog="${STRIPPROG-strip}"
41   -rmprog="${RMPROG-rm}"
42   -mkdirprog="${MKDIRPROG-mkdir}"
43   -
44   -transformbasename=""
45   -transform_arg=""
46   -instcmd="$mvprog"
47   -chmodcmd="$chmodprog 0755"
48   -chowncmd=""
49   -chgrpcmd=""
50   -stripcmd=""
51   -rmcmd="$rmprog -f"
52   -mvcmd="$mvprog"
53   -src=""
54   -dst=""
55   -dir_arg=""
56   -
57   -while [ x"$1" != x ]; do
58   - case $1 in
59   - -c) instcmd="$cpprog"
60   - shift
61   - continue;;
62   -
63   - -d) dir_arg=true
64   - shift
65   - continue;;
66   -
67   - -m) chmodcmd="$chmodprog $2"
68   - shift
69   - shift
70   - continue;;
71   -
72   - -o) chowncmd="$chownprog $2"
73   - shift
74   - shift
75   - continue;;
76   -
77   - -g) chgrpcmd="$chgrpprog $2"
78   - shift
79   - shift
80   - continue;;
81   -
82   - -s) stripcmd="$stripprog"
83   - shift
84   - continue;;
85   -
86   - -t=*) transformarg=`echo $1 | sed 's/-t=//'`
87   - shift
88   - continue;;
89   -
90   - -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
91   - shift
92   - continue;;
93   -
94   - *) if [ x"$src" = x ]
95   - then
96   - src=$1
97   - else
98   - # this colon is to work around a 386BSD /bin/sh bug
99   - :
100   - dst=$1
101   - fi
102   - shift
103   - continue;;
104   - esac
105   -done
106   -
107   -if [ x"$src" = x ]
108   -then
109   - echo "install: no input file specified"
110   - exit 1
111   -else
112   - :
113   -fi
114   -
115   -if [ x"$dir_arg" != x ]; then
116   - dst=$src
117   - src=""
118   -
119   - if [ -d $dst ]; then
120   - instcmd=:
121   - chmodcmd=""
122   - else
123   - instcmd=$mkdirprog
124   - fi
125   -else
126   -
127   -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
128   -# might cause directories to be created, which would be especially bad
129   -# if $src (and thus $dsttmp) contains '*'.
130   -
131   - if [ -f $src -o -d $src ]
132   - then
133   - :
134   - else
135   - echo "install: $src does not exist"
136   - exit 1
137   - fi
138   -
139   - if [ x"$dst" = x ]
140   - then
141   - echo "install: no destination specified"
142   - exit 1
143   - else
144   - :
145   - fi
146   -
147   -# If destination is a directory, append the input filename; if your system
148   -# does not like double slashes in filenames, you may need to add some logic
149   -
150   - if [ -d $dst ]
151   - then
152   - dst="$dst"/`basename $src`
153   - else
154   - :
155   - fi
156   -fi
157   -
158   -## this sed command emulates the dirname command
159   -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
160   -
161   -# Make sure that the destination directory exists.
162   -# this part is taken from Noah Friedman's mkinstalldirs script
163   -
164   -# Skip lots of stat calls in the usual case.
165   -if [ ! -d "$dstdir" ]; then
166   -defaultIFS='
167   - '
168   -IFS="${IFS-${defaultIFS}}"
169   -
170   -oIFS="${IFS}"
171   -# Some sh's can't handle IFS=/ for some reason.
172   -IFS='%'
173   -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
174   -IFS="${oIFS}"
175   -
176   -pathcomp=''
177   -
178   -while [ $# -ne 0 ] ; do
179   - pathcomp="${pathcomp}${1}"
180   - shift
181   -
182   - if [ ! -d "${pathcomp}" ] ;
183   - then
184   - $mkdirprog "${pathcomp}"
185   - else
186   - :
187   - fi
188   -
189   - pathcomp="${pathcomp}/"
190   -done
191   -fi
192   -
193   -if [ x"$dir_arg" != x ]
194   -then
195   - $doit $instcmd $dst &&
196   -
197   - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
198   - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
199   - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
200   - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
201   -else
202   -
203   -# If we're going to rename the final executable, determine the name now.
204   -
205   - if [ x"$transformarg" = x ]
206   - then
207   - dstfile=`basename $dst`
208   - else
209   - dstfile=`basename $dst $transformbasename |
210   - sed $transformarg`$transformbasename
211   - fi
212   -
213   -# don't allow the sed command to completely eliminate the filename
214   -
215   - if [ x"$dstfile" = x ]
216   - then
217   - dstfile=`basename $dst`
218   - else
219   - :
220   - fi
221   -
222   -# Make a temp file name in the proper directory.
223   -
224   - dsttmp=$dstdir/#inst.$$#
225   -
226   -# Move or copy the file name to the temp name
227   -
228   - $doit $instcmd $src $dsttmp &&
229   -
230   - trap "rm -f ${dsttmp}" 0 &&
231   -
232   -# and set any options; do chmod last to preserve setuid bits
233   -
234   -# If any of these fail, we abort the whole thing. If we want to
235   -# ignore errors from any of these, just make sure not to ignore
236   -# errors from the above "$doit $instcmd $src $dsttmp" command.
237   -
238   - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
239   - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
240   - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
241   - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
242   -
243   -# Now rename the file to the real destination.
244   -
245   - $doit $rmcmd -f $dstdir/$dstfile &&
246   - $doit $mvcmd $dsttmp $dstdir/$dstfile
247   -
248   -fi &&
249   -
250   -
251   -exit 0
src/actions.cc
... ... @@ -1,128 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como actions.cc e possui - linhas de código.
22   - *
23   - * Contatos
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -/*---[ Implement ]----------------------------------------------------------------------------------*/
38   -
39   - PyObject * terminal_pfkey(PyObject *self, PyObject *args) {
40   -
41   - int rc, key;
42   -
43   - if (!PyArg_ParseTuple(args, "i", &key)) {
44   - PyErr_SetString(terminalError, strerror(EINVAL));
45   - return NULL;
46   - }
47   -
48   - try {
49   -
50   - rc = ((pw3270_TerminalObject *) self)->session->pfkey(key);
51   -
52   - } catch(std::exception &e) {
53   -
54   - PyErr_SetString(terminalError, e.what());
55   - return NULL;
56   - }
57   -
58   - return PyLong_FromLong(rc);
59   -
60   - }
61   -
62   - PyObject * terminal_pakey(PyObject *self, PyObject *args) {
63   -
64   - int rc, key;
65   -
66   - if (!PyArg_ParseTuple(args, "i", &key)) {
67   - PyErr_SetString(terminalError, strerror(EINVAL));
68   - return NULL;
69   - }
70   -
71   - try {
72   -
73   - rc = ((pw3270_TerminalObject *) self)->session->pakey(key);
74   -
75   - } catch(std::exception &e) {
76   -
77   - PyErr_SetString(terminalError, e.what());
78   - return NULL;
79   - }
80   -
81   - return PyLong_FromLong(rc);
82   -
83   - }
84   -
85   - PyObject * terminal_enter(PyObject *self, PyObject *args) {
86   -
87   - int rc;
88   -
89   - try {
90   -
91   - rc = ((pw3270_TerminalObject *) self)->session->enter();
92   -
93   - } catch(std::exception &e) {
94   -
95   - PyErr_SetString(terminalError, e.what());
96   - return NULL;
97   - }
98   -
99   - return PyLong_FromLong(rc);
100   -
101   -
102   - }
103   -
104   - PyObject * terminal_action(PyObject *self, PyObject *args) {
105   -
106   - int rc;
107   - const char *name;
108   -
109   - if (!PyArg_ParseTuple(args, "s", &name)) {
110   - PyErr_SetString(terminalError, strerror(EINVAL));
111   - return NULL;
112   - }
113   -
114   - try {
115   -
116   - rc = ((pw3270_TerminalObject *) self)->session->action(name);
117   -
118   - } catch(std::exception &e) {
119   -
120   - PyErr_SetString(terminalError, e.what());
121   - return NULL;
122   - }
123   -
124   - return PyLong_FromLong(rc);
125   -
126   -
127   - }
128   -
src/config.h.in
... ... @@ -1,51 +0,0 @@
1   -/**
2   - * @file config.h
3   - *
4   - * @brief Configuração para o aplicativo.
5   - *
6   - * Gerado automaticamente pelo processo ./configure esse arquivo descreve
7   - * as configurações de ambiente detectadas automaticamente.
8   - *
9   - * @author perry.werneck@gmail.com
10   - *
11   - */
12   -
13   -#ifndef CONFIG_H_INCLUDED
14   -
15   - #define CONFIG_H_INCLUDED 1
16   -
17   - /**
18   - * @brief Nome do pacote.
19   - */
20   - #undef PACKAGE_NAME
21   -
22   - /**
23   - * @brief Versão atual.
24   - */
25   - #undef PACKAGE_VERSION
26   -
27   - /**
28   - * @brief Revisão svn quando o pacote foi configurado.
29   - *
30   - */
31   - #undef PACKAGE_REVISION
32   -
33   - /**
34   - * @brief Descrição do aplicativo.
35   - */
36   - #undef PACKAGE_DESCRIPTION
37   -
38   - /**
39   - * @brief Indica se o compilador atual possui suporte a "visibility"
40   - *
41   - * Quando disponível indica que o compilador atual permite tornar
42   - * visíveis numa biblioteca apenas as funções declaradas para isso
43   - * evitando que todos os símbolos fiquem visíveis.
44   - *
45   - * Isso permite um melhor controle sobre quais funções podem ser usados
46   - * pelo programa principal.
47   - *
48   - */
49   - #undef HAVE_GNUC_VISIBILITY
50   -
51   -#endif // CONFIG_H_INCLUDED
src/core/actions.cc 0 → 100644
... ... @@ -0,0 +1,128 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como actions.cc e possui - linhas de código.
  22 + *
  23 + * Contatos
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Referências:
  29 + *
  30 + * <https://docs.python.org/2/extending/newtypes.html>
  31 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  32 + *
  33 + */
  34 +
  35 + #include "private.h"
  36 +
  37 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  38 +
  39 + PyObject * terminal_pfkey(PyObject *self, PyObject *args) {
  40 +
  41 + int rc, key;
  42 +
  43 + if (!PyArg_ParseTuple(args, "i", &key)) {
  44 + PyErr_SetString(terminalError, strerror(EINVAL));
  45 + return NULL;
  46 + }
  47 +
  48 + try {
  49 +
  50 + rc = ((pw3270_TerminalObject *) self)->session->pfkey(key);
  51 +
  52 + } catch(std::exception &e) {
  53 +
  54 + PyErr_SetString(terminalError, e.what());
  55 + return NULL;
  56 + }
  57 +
  58 + return PyLong_FromLong(rc);
  59 +
  60 + }
  61 +
  62 + PyObject * terminal_pakey(PyObject *self, PyObject *args) {
  63 +
  64 + int rc, key;
  65 +
  66 + if (!PyArg_ParseTuple(args, "i", &key)) {
  67 + PyErr_SetString(terminalError, strerror(EINVAL));
  68 + return NULL;
  69 + }
  70 +
  71 + try {
  72 +
  73 + rc = ((pw3270_TerminalObject *) self)->session->pakey(key);
  74 +
  75 + } catch(std::exception &e) {
  76 +
  77 + PyErr_SetString(terminalError, e.what());
  78 + return NULL;
  79 + }
  80 +
  81 + return PyLong_FromLong(rc);
  82 +
  83 + }
  84 +
  85 + PyObject * terminal_enter(PyObject *self, PyObject *args) {
  86 +
  87 + int rc;
  88 +
  89 + try {
  90 +
  91 + rc = ((pw3270_TerminalObject *) self)->session->enter();
  92 +
  93 + } catch(std::exception &e) {
  94 +
  95 + PyErr_SetString(terminalError, e.what());
  96 + return NULL;
  97 + }
  98 +
  99 + return PyLong_FromLong(rc);
  100 +
  101 +
  102 + }
  103 +
  104 + PyObject * terminal_action(PyObject *self, PyObject *args) {
  105 +
  106 + int rc;
  107 + const char *name;
  108 +
  109 + if (!PyArg_ParseTuple(args, "s", &name)) {
  110 + PyErr_SetString(terminalError, strerror(EINVAL));
  111 + return NULL;
  112 + }
  113 +
  114 + try {
  115 +
  116 + rc = ((pw3270_TerminalObject *) self)->session->action(name);
  117 +
  118 + } catch(std::exception &e) {
  119 +
  120 + PyErr_SetString(terminalError, e.what());
  121 + return NULL;
  122 + }
  123 +
  124 + return PyLong_FromLong(rc);
  125 +
  126 +
  127 + }
  128 +
... ...
src/core/get.cc 0 → 100644
... ... @@ -0,0 +1,154 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como get.cc e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Referências:
  29 + *
  30 + * <https://docs.python.org/2/extending/newtypes.html>
  31 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  32 + *
  33 + */
  34 +
  35 + #include "private.h"
  36 +
  37 +
  38 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  39 +
  40 +PyObject * terminal_get_version(PyObject *self, PyObject *args) {
  41 +
  42 + return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_version().c_str() );
  43 +
  44 +}
  45 +
  46 +PyObject * terminal_get_revision(PyObject *self, PyObject *args) {
  47 +
  48 + return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_revision().c_str() );
  49 +
  50 +}
  51 +
  52 +PyObject * terminal_is_connected(PyObject *self, PyObject *args) {
  53 +
  54 + return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_connected() );
  55 +
  56 +}
  57 +
  58 +PyObject * terminal_is_ready(PyObject *self, PyObject *args) {
  59 +
  60 + return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_ready() );
  61 +
  62 +}
  63 +
  64 +PyObject * terminal_is_protected_at(PyObject *self, PyObject *args) {
  65 +
  66 + int rc, row, col;
  67 +
  68 + if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
  69 + PyErr_SetString(terminalError, strerror(EINVAL));
  70 + return NULL;
  71 + }
  72 +
  73 + try {
  74 +
  75 + rc = ((pw3270_TerminalObject *) self)->session->get_is_protected_at(row,col);
  76 +
  77 + } catch(std::exception &e) {
  78 +
  79 + PyErr_SetString(terminalError, e.what());
  80 + return NULL;
  81 + }
  82 +
  83 + return PyBool_FromLong( rc );
  84 +
  85 +}
  86 +
  87 +
  88 +PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args) {
  89 +
  90 + int row, col, rc;
  91 + const char *text;
  92 +
  93 + if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
  94 + PyErr_SetString(terminalError, strerror(EINVAL));
  95 + return NULL;
  96 + }
  97 +
  98 + try {
  99 +
  100 + rc = ((pw3270_TerminalObject *) self)->session->cmp_string_at(row,col,text);
  101 +
  102 + } catch(std::exception &e) {
  103 +
  104 + PyErr_SetString(terminalError, e.what());
  105 + return NULL;
  106 + }
  107 +
  108 + return PyLong_FromLong(rc);
  109 +
  110 +}
  111 +
  112 +PyObject * terminal_get_string_at(PyObject *self, PyObject *args) {
  113 +
  114 + int row, col, sz;
  115 + string rc;
  116 +
  117 + if (!PyArg_ParseTuple(args, "iii", &row, &col, &sz)) {
  118 + PyErr_SetString(terminalError, strerror(EINVAL));
  119 + return NULL;
  120 + }
  121 +
  122 + try {
  123 +
  124 + rc = ((pw3270_TerminalObject *) self)->session->get_string_at(row,col,sz);
  125 +
  126 + } catch(std::exception &e) {
  127 +
  128 + PyErr_SetString(terminalError, e.what());
  129 + return NULL;
  130 + }
  131 +
  132 + return PyString_FromString(rc.c_str());
  133 +
  134 +}
  135 +
  136 +PyObject * terminal_get_contents(PyObject *self) {
  137 +
  138 + string rc;
  139 +
  140 + try {
  141 +
  142 + rc = ((pw3270_TerminalObject *) self)->session->get_string();
  143 +
  144 + } catch(std::exception &e) {
  145 +
  146 + PyErr_SetString(terminalError, e.what());
  147 + return NULL;
  148 + }
  149 +
  150 + return PyString_FromString(rc.c_str());
  151 +
  152 +
  153 +
  154 +}
... ...
src/core/init.cc 0 → 100644
... ... @@ -0,0 +1,87 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como py3270.cc e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Implementa métodos básicos inicio/final do objeto python
  29 + *
  30 + * Referências:
  31 + *
  32 + * <https://docs.python.org/2/extending/newtypes.html>
  33 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  34 + *
  35 + */
  36 +
  37 + #include "private.h"
  38 +
  39 +
  40 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  41 +
  42 +PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
  43 +
  44 + PW3270_NAMESPACE::session * session;
  45 + const char *id = "";
  46 +
  47 + if (!PyArg_ParseTuple(args, "s", &id)) {
  48 + id = "";
  49 + }
  50 +
  51 + trace("%s(%s)",__FUNCTION__,id);
  52 +
  53 + try {
  54 +
  55 + session = PW3270_NAMESPACE::session::create(id);
  56 +
  57 + } catch(std::exception &e) {
  58 +
  59 + trace("%s failed: %s",__FUNCTION__,e.what());
  60 + PyErr_SetString(terminalError, e.what());
  61 + return NULL;
  62 +
  63 + }
  64 +
  65 + pw3270_TerminalObject *self = (pw3270_TerminalObject *) type->tp_alloc(type, 0);
  66 +
  67 + self->session = session;
  68 +
  69 + return (PyObject *)self;
  70 +}
  71 +
  72 +
  73 +int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds) {
  74 +
  75 + return 0;
  76 +
  77 +}
  78 +
  79 +void terminal_dealloc(pw3270_TerminalObject * self) {
  80 +
  81 + trace("%s",__FUNCTION__);
  82 +
  83 + delete self->session;
  84 +
  85 + self->ob_type->tp_free((PyObject*)self);
  86 +
  87 +}
... ...
src/core/misc.cc 0 → 100644
... ... @@ -0,0 +1,134 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como misc.cc e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Implementa métodos básicos inicio/final do objeto python
  29 + *
  30 + * Referências:
  31 + *
  32 + * <https://docs.python.org/2/extending/newtypes.html>
  33 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  34 + *
  35 + */
  36 +
  37 + #include "private.h"
  38 +
  39 +
  40 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  41 +
  42 + PyObject * terminal_connect(PyObject *self, PyObject *args) {
  43 +
  44 + int rc = -1;
  45 + int wait = 60;
  46 + const char * host = "";
  47 +
  48 + if (!PyArg_ParseTuple(args, "s|i", &host, &wait)) {
  49 + PyErr_SetString(terminalError, "connect requires a host URL");
  50 + return NULL;
  51 + }
  52 +
  53 + try {
  54 +
  55 + rc = ((pw3270_TerminalObject *) self)->session->connect(host,wait);
  56 +
  57 + } catch(std::exception &e) {
  58 +
  59 + PyErr_SetString(terminalError, e.what());
  60 + return NULL;
  61 + }
  62 +
  63 + return PyLong_FromLong(rc);
  64 +
  65 + }
  66 +
  67 + PyObject * terminal_disconnect(PyObject *self, PyObject *args) {
  68 +
  69 + int rc = -1;
  70 +
  71 + try {
  72 +
  73 + rc = ((pw3270_TerminalObject *) self)->session->disconnect();
  74 +
  75 + } catch(std::exception &e) {
  76 +
  77 + PyErr_SetString(terminalError, e.what());
  78 + return NULL;
  79 + }
  80 +
  81 + return PyLong_FromLong(rc);
  82 +
  83 + }
  84 +
  85 + PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args) {
  86 +
  87 + int rc;
  88 + int timeout = 60;
  89 +
  90 + if (!PyArg_ParseTuple(args, "|i", &timeout)) {
  91 + PyErr_SetString(terminalError, strerror(EINVAL));
  92 + return NULL;
  93 + }
  94 +
  95 + try {
  96 +
  97 + rc = ((pw3270_TerminalObject *) self)->session->wait_for_ready(timeout);
  98 +
  99 + } catch(std::exception &e) {
  100 +
  101 + PyErr_SetString(terminalError, e.what());
  102 + return NULL;
  103 + }
  104 +
  105 + return PyLong_FromLong(rc);
  106 +
  107 + }
  108 +
  109 +
  110 + PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args) {
  111 +
  112 + int row, col, rc;
  113 + int timeout = 10;
  114 + const char *text;
  115 +
  116 + if (!PyArg_ParseTuple(args, "iis|i", &row, &col, &text, &timeout)) {
  117 + PyErr_SetString(terminalError, strerror(EINVAL));
  118 + return NULL;
  119 + }
  120 +
  121 + try {
  122 +
  123 + rc = ((pw3270_TerminalObject *) self)->session->wait_for_string_at(row,col,text,timeout);
  124 +
  125 + } catch(std::exception &e) {
  126 +
  127 + PyErr_SetString(terminalError, e.what());
  128 + return NULL;
  129 + }
  130 +
  131 + return PyLong_FromLong(rc);
  132 +
  133 + }
  134 +
... ...
src/core/py3270.cc 0 → 100644
... ... @@ -0,0 +1,167 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como py3270.cc e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Implementa métodos básicos para a extensão python.
  29 + *
  30 + * Referências:
  31 + *
  32 + * <https://docs.python.org/2/extending/newtypes.html>
  33 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  34 + *
  35 + */
  36 +
  37 + #include "private.h"
  38 +
  39 +/*---[ Globals ]------------------------------------------------------------------------------------*/
  40 +
  41 + PyObject * terminalError = NULL;
  42 +
  43 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  44 +
  45 +static PyObject * get_revision(PyObject *self, PyObject *args) {
  46 +
  47 +#ifdef PACKAGE_REVISION
  48 + return PyLong_FromLong(atoi(PACKAGE_REVISION));
  49 +#else
  50 + return PyLong_FromLong(BUILD_DATE);
  51 +#endif // PACKAGE_REVISION
  52 +
  53 +}
  54 +
  55 +static PyMethodDef terminal_methods[] = {
  56 +
  57 + { "Version", terminal_get_version, METH_NOARGS, "Get the lib3270 version string." },
  58 + { "Revision", terminal_get_revision, METH_NOARGS, "Get the lib3270 revision number." },
  59 +
  60 + { "IsConnected", terminal_is_connected, METH_NOARGS, "True if the terminal is connected to the host." },
  61 + { "IsReady", terminal_is_ready, METH_NOARGS, "True if the terminal has finished network activity." },
  62 + { "IsProtected", terminal_is_protected_at, METH_VARARGS, "True if the position is read-only." },
  63 +
  64 + { "SetCursorPosition", terminal_set_cursor_at, METH_VARARGS, "Set cursor position." },
  65 +
  66 + { "WaitForStringAt", terminal_wait_for_string_at, METH_VARARGS, "Wait for string at position" },
  67 + { "WaitForReady", terminal_wait_for_ready, METH_VARARGS, "Wait for network communication to finish" },
  68 +
  69 + { "Connect", terminal_connect, METH_VARARGS, "Connect to the host." },
  70 + { "Disconnect", terminal_disconnect, METH_NOARGS, "Disconnect from host." },
  71 +
  72 + { "CmpStringAt", terminal_cmp_string_at, METH_VARARGS, "Compare string with terminal buffer at the position." },
  73 + { "GetStringAt", terminal_get_string_at, METH_VARARGS, "Get string from terminal buffer." },
  74 + { "SetStringAt", terminal_set_string_at, METH_VARARGS, "Set string in terminal buffer." },
  75 +
  76 + { "PFKey", terminal_pfkey, METH_VARARGS, "Send PF key." },
  77 + { "PAKey", terminal_pakey, METH_VARARGS, "Send PA key." },
  78 + { "Enter", terminal_enter, METH_NOARGS, "Send Enter Key." },
  79 + { "Action", terminal_action, METH_VARARGS, "Send Action by name." },
  80 +
  81 + {NULL} // Sentinel
  82 +
  83 +};
  84 +
  85 +/*
  86 +static PyMemberDef terminal_members[] = {
  87 +
  88 + { NULL } // Sentinel
  89 +
  90 +};
  91 +*/
  92 +
  93 +static PyTypeObject pw3270_TerminalType = {
  94 + PyObject_HEAD_INIT(NULL)
  95 + 0, /*ob_size*/
  96 + "py3270.terminal", /*tp_name*/
  97 + sizeof(pw3270_TerminalObject), /*tp_basicsize*/
  98 + 0, /*tp_itemsize*/
  99 + (destructor) terminal_dealloc, /*tp_dealloc*/
  100 + 0, /*tp_print*/
  101 + 0, /*tp_getattr*/
  102 + 0, /*tp_setattr*/
  103 + 0, /*tp_compare*/
  104 + 0, /*tp_repr*/
  105 + 0, /*tp_as_number*/
  106 + 0, /*tp_as_sequence*/
  107 + 0, /*tp_as_mapping*/
  108 + 0, /*tp_hash */
  109 + 0, /*tp_call*/
  110 + terminal_get_contents, /*tp_str*/
  111 + 0, /*tp_getattro*/
  112 + 0, /*tp_setattro*/
  113 + 0, /*tp_as_buffer*/
  114 + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
  115 + "3270 terminal object", /* tp_doc */
  116 + 0, /* tp_traverse */
  117 + 0, /* tp_clear */
  118 + 0, /* tp_richcompare */
  119 + 0, /* tp_weaklistoffset */
  120 + 0, /* tp_iter */
  121 + 0, /* tp_iternext */
  122 + terminal_methods, /* tp_methods */
  123 + 0, // terminal_members, /* tp_members */
  124 + 0, /* tp_getset */
  125 + 0, /* tp_base */
  126 + 0, /* tp_dict */
  127 + 0, /* tp_descr_get */
  128 + 0, /* tp_descr_set */
  129 + 0, /* tp_dictoffset */
  130 + (initproc) terminal_init, /* tp_init */
  131 + 0, /* tp_alloc */
  132 + terminal_new, /* tp_new */
  133 +
  134 +};
  135 +
  136 +static PyMethodDef MyMethods[] = {
  137 +
  138 + { "Revision", get_revision, METH_VARARGS, "Get module revision." },
  139 +
  140 + {NULL, NULL, 0, NULL} /* Sentinel */
  141 +
  142 +};
  143 +
  144 +PyMODINIT_FUNC initpy3270(void) {
  145 +
  146 + // Cria o módulo
  147 +
  148 + PyObject *m = Py_InitModule("py3270", MyMethods);
  149 +
  150 + if (m == NULL) {
  151 + return;
  152 + }
  153 +
  154 + // Adiciona objeto para tratamento de erros.
  155 + terminalError = PyErr_NewException((char *) "py3270.error", NULL, NULL);
  156 +
  157 + (void) Py_INCREF(terminalError);
  158 + PyModule_AddObject(m, "error", terminalError);
  159 +
  160 + // Adiciona terminal
  161 + if(PyType_Ready(&pw3270_TerminalType) < 0)
  162 + return
  163 +
  164 + (void) Py_INCREF(&pw3270_TerminalType);
  165 + PyModule_AddObject(m, "Terminal", (PyObject *)&pw3270_TerminalType);
  166 +
  167 +}
... ...
src/core/set.cc 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como set.cc e possui - linhas de código.
  22 + *
  23 + * Contatos
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + * Referências:
  29 + *
  30 + * <https://docs.python.org/2/extending/newtypes.html>
  31 + * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
  32 + *
  33 + */
  34 +
  35 + #include "private.h"
  36 +
  37 +
  38 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  39 +
  40 + PyObject * terminal_set_string_at(PyObject *self, PyObject *args) {
  41 +
  42 + int row, col, rc;
  43 + const char *text;
  44 +
  45 + if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
  46 + PyErr_SetString(terminalError, strerror(EINVAL));
  47 + return NULL;
  48 + }
  49 +
  50 + try {
  51 +
  52 + rc = ((pw3270_TerminalObject *) self)->session->set_string_at(row,col,text);
  53 +
  54 + } catch(std::exception &e) {
  55 +
  56 + PyErr_SetString(terminalError, e.what());
  57 + return NULL;
  58 + }
  59 +
  60 + return PyLong_FromLong(rc);
  61 +
  62 + }
  63 +
  64 + PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args) {
  65 +
  66 + int row, col, rc;
  67 +
  68 + if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
  69 + PyErr_SetString(terminalError, strerror(EINVAL));
  70 + return NULL;
  71 + }
  72 +
  73 + try {
  74 +
  75 + rc = ((pw3270_TerminalObject *) self)->session->set_cursor_position(row,col);
  76 +
  77 + } catch(std::exception &e) {
  78 +
  79 + PyErr_SetString(terminalError, e.what());
  80 + return NULL;
  81 + }
  82 +
  83 + return PyLong_FromLong(rc);
  84 +
  85 + }
  86 +
... ...
src/get.cc
... ... @@ -1,154 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como get.cc e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -
38   -/*---[ Implement ]----------------------------------------------------------------------------------*/
39   -
40   -PyObject * terminal_get_version(PyObject *self, PyObject *args) {
41   -
42   - return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_version().c_str() );
43   -
44   -}
45   -
46   -PyObject * terminal_get_revision(PyObject *self, PyObject *args) {
47   -
48   - return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_revision().c_str() );
49   -
50   -}
51   -
52   -PyObject * terminal_is_connected(PyObject *self, PyObject *args) {
53   -
54   - return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_connected() );
55   -
56   -}
57   -
58   -PyObject * terminal_is_ready(PyObject *self, PyObject *args) {
59   -
60   - return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_ready() );
61   -
62   -}
63   -
64   -PyObject * terminal_is_protected_at(PyObject *self, PyObject *args) {
65   -
66   - int rc, row, col;
67   -
68   - if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
69   - PyErr_SetString(terminalError, strerror(EINVAL));
70   - return NULL;
71   - }
72   -
73   - try {
74   -
75   - rc = ((pw3270_TerminalObject *) self)->session->get_is_protected_at(row,col);
76   -
77   - } catch(std::exception &e) {
78   -
79   - PyErr_SetString(terminalError, e.what());
80   - return NULL;
81   - }
82   -
83   - return PyBool_FromLong( rc );
84   -
85   -}
86   -
87   -
88   -PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args) {
89   -
90   - int row, col, rc;
91   - const char *text;
92   -
93   - if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
94   - PyErr_SetString(terminalError, strerror(EINVAL));
95   - return NULL;
96   - }
97   -
98   - try {
99   -
100   - rc = ((pw3270_TerminalObject *) self)->session->cmp_string_at(row,col,text);
101   -
102   - } catch(std::exception &e) {
103   -
104   - PyErr_SetString(terminalError, e.what());
105   - return NULL;
106   - }
107   -
108   - return PyLong_FromLong(rc);
109   -
110   -}
111   -
112   -PyObject * terminal_get_string_at(PyObject *self, PyObject *args) {
113   -
114   - int row, col, sz;
115   - string rc;
116   -
117   - if (!PyArg_ParseTuple(args, "iii", &row, &col, &sz)) {
118   - PyErr_SetString(terminalError, strerror(EINVAL));
119   - return NULL;
120   - }
121   -
122   - try {
123   -
124   - rc = ((pw3270_TerminalObject *) self)->session->get_string_at(row,col,sz);
125   -
126   - } catch(std::exception &e) {
127   -
128   - PyErr_SetString(terminalError, e.what());
129   - return NULL;
130   - }
131   -
132   - return PyString_FromString(rc.c_str());
133   -
134   -}
135   -
136   -PyObject * terminal_get_contents(PyObject *self) {
137   -
138   - string rc;
139   -
140   - try {
141   -
142   - rc = ((pw3270_TerminalObject *) self)->session->get_string();
143   -
144   - } catch(std::exception &e) {
145   -
146   - PyErr_SetString(terminalError, e.what());
147   - return NULL;
148   - }
149   -
150   - return PyString_FromString(rc.c_str());
151   -
152   -
153   -
154   -}
src/include/config.h.in 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +/**
  2 + * @file config.h
  3 + *
  4 + * @brief Configuração para o aplicativo.
  5 + *
  6 + * Gerado automaticamente pelo processo ./configure esse arquivo descreve
  7 + * as configurações de ambiente detectadas automaticamente.
  8 + *
  9 + * @author perry.werneck@gmail.com
  10 + *
  11 + */
  12 +
  13 +#ifndef CONFIG_H_INCLUDED
  14 +
  15 + #define CONFIG_H_INCLUDED 1
  16 +
  17 + /**
  18 + * @brief Nome do pacote.
  19 + */
  20 + #undef PACKAGE_NAME
  21 +
  22 + /**
  23 + * @brief Versão atual.
  24 + */
  25 + #undef PACKAGE_VERSION
  26 +
  27 + /**
  28 + * @brief Revisão svn quando o pacote foi configurado.
  29 + *
  30 + */
  31 + #undef PACKAGE_REVISION
  32 +
  33 + /**
  34 + * @brief Descrição do aplicativo.
  35 + */
  36 + #undef PACKAGE_DESCRIPTION
  37 +
  38 + /**
  39 + * @brief Indica se o compilador atual possui suporte a "visibility"
  40 + *
  41 + * Quando disponível indica que o compilador atual permite tornar
  42 + * visíveis numa biblioteca apenas as funções declaradas para isso
  43 + * evitando que todos os símbolos fiquem visíveis.
  44 + *
  45 + * Isso permite um melhor controle sobre quais funções podem ser usados
  46 + * pelo programa principal.
  47 + *
  48 + */
  49 + #undef HAVE_GNUC_VISIBILITY
  50 +
  51 +#endif // CONFIG_H_INCLUDED
... ...
src/include/py3270.h 0 → 100644
... ... @@ -0,0 +1,115 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como private.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifndef PRIVATE_H_INCLUDED
  31 +
  32 + #define PRIVATE_H_INCLUDED
  33 +
  34 + // http://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python
  35 + #include <cmath>
  36 +
  37 + // https://lists.gt.net/python/dev/340073
  38 + #pragma GCC diagnostic push
  39 + #pragma GCC system_header
  40 + #include <Python.h>
  41 + #pragma GCC diagnostic pop
  42 +
  43 + #include <pw3270/pw3270cpp.h>
  44 + #include "config.h"
  45 +
  46 + #if defined(_WIN32)
  47 +
  48 + #include <windows.h>
  49 +
  50 + #define DLL_PRIVATE extern
  51 + #define DLL_PUBLIC extern __declspec (dllexport)
  52 +
  53 + #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
  54 +
  55 + #define DLL_PRIVATE __hidden extern
  56 + #define DLL_PUBLIC extern
  57 +
  58 + #elif defined (HAVE_GNUC_VISIBILITY)
  59 +
  60 + #define DLL_PRIVATE __attribute__((visibility("hidden"))) extern
  61 + #define DLL_PUBLIC __attribute__((visibility("default"))) extern
  62 +
  63 + #else
  64 +
  65 + #error Unable to set visibility attribute
  66 +
  67 + #endif
  68 +
  69 +
  70 + using namespace std;
  71 +
  72 + typedef struct {
  73 +
  74 + PyObject_HEAD
  75 +
  76 + PW3270_NAMESPACE::session * session;
  77 +
  78 + } pw3270_TerminalObject;
  79 +
  80 + extern PyObject * terminalError;
  81 +
  82 + extern "C" {
  83 +
  84 + DLL_PRIVATE PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
  85 + DLL_PRIVATE int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds);
  86 + DLL_PRIVATE void terminal_dealloc(pw3270_TerminalObject * self);
  87 +
  88 + DLL_PRIVATE PyObject * terminal_get_version(PyObject *self, PyObject *args);
  89 + DLL_PRIVATE PyObject * terminal_get_revision(PyObject *self, PyObject *args);
  90 +
  91 + DLL_PRIVATE PyObject * terminal_is_connected(PyObject *self, PyObject *args);
  92 + DLL_PRIVATE PyObject * terminal_is_ready(PyObject *self, PyObject *args);
  93 +
  94 + DLL_PRIVATE PyObject * terminal_connect(PyObject *self, PyObject *args);
  95 + DLL_PRIVATE PyObject * terminal_disconnect(PyObject *self, PyObject *args);
  96 +
  97 + DLL_PRIVATE PyObject * terminal_get_string_at(PyObject *self, PyObject *args);
  98 + DLL_PRIVATE PyObject * terminal_get_contents(PyObject *self);
  99 + DLL_PRIVATE PyObject * terminal_set_string_at(PyObject *self, PyObject *args);
  100 + DLL_PRIVATE PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args);
  101 +
  102 + DLL_PRIVATE PyObject * terminal_pfkey(PyObject *self, PyObject *args);
  103 + DLL_PRIVATE PyObject * terminal_pakey(PyObject *self, PyObject *args);
  104 + DLL_PRIVATE PyObject * terminal_enter(PyObject *self, PyObject *args);
  105 + DLL_PRIVATE PyObject * terminal_action(PyObject *self, PyObject *args);
  106 +
  107 + DLL_PRIVATE PyObject * terminal_is_protected_at(PyObject *self, PyObject *args);
  108 + DLL_PRIVATE PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args);
  109 +
  110 + DLL_PRIVATE PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args);
  111 + DLL_PRIVATE PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args);
  112 +
  113 + }
  114 +
  115 +#endif // PRIVATE_H_INCLUDED
... ...
src/init.cc
... ... @@ -1,87 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como py3270.cc e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Implementa métodos básicos inicio/final do objeto python
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -
40   -/*---[ Implement ]----------------------------------------------------------------------------------*/
41   -
42   -PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
43   -
44   - PW3270_NAMESPACE::session * session;
45   - const char *id = "";
46   -
47   - if (!PyArg_ParseTuple(args, "s", &id)) {
48   - id = "";
49   - }
50   -
51   - trace("%s(%s)",__FUNCTION__,id);
52   -
53   - try {
54   -
55   - session = PW3270_NAMESPACE::session::create(id);
56   -
57   - } catch(std::exception &e) {
58   -
59   - trace("%s failed: %s",__FUNCTION__,e.what());
60   - PyErr_SetString(terminalError, e.what());
61   - return NULL;
62   -
63   - }
64   -
65   - pw3270_TerminalObject *self = (pw3270_TerminalObject *) type->tp_alloc(type, 0);
66   -
67   - self->session = session;
68   -
69   - return (PyObject *)self;
70   -}
71   -
72   -
73   -int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds) {
74   -
75   - return 0;
76   -
77   -}
78   -
79   -void terminal_dealloc(pw3270_TerminalObject * self) {
80   -
81   - trace("%s",__FUNCTION__);
82   -
83   - delete self->session;
84   -
85   - self->ob_type->tp_free((PyObject*)self);
86   -
87   -}
src/misc.cc
... ... @@ -1,134 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como misc.cc e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Implementa métodos básicos inicio/final do objeto python
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -
40   -/*---[ Implement ]----------------------------------------------------------------------------------*/
41   -
42   - PyObject * terminal_connect(PyObject *self, PyObject *args) {
43   -
44   - int rc = -1;
45   - int wait = 60;
46   - const char * host = "";
47   -
48   - if (!PyArg_ParseTuple(args, "s|i", &host, &wait)) {
49   - PyErr_SetString(terminalError, "connect requires a host URL");
50   - return NULL;
51   - }
52   -
53   - try {
54   -
55   - rc = ((pw3270_TerminalObject *) self)->session->connect(host,wait);
56   -
57   - } catch(std::exception &e) {
58   -
59   - PyErr_SetString(terminalError, e.what());
60   - return NULL;
61   - }
62   -
63   - return PyLong_FromLong(rc);
64   -
65   - }
66   -
67   - PyObject * terminal_disconnect(PyObject *self, PyObject *args) {
68   -
69   - int rc = -1;
70   -
71   - try {
72   -
73   - rc = ((pw3270_TerminalObject *) self)->session->disconnect();
74   -
75   - } catch(std::exception &e) {
76   -
77   - PyErr_SetString(terminalError, e.what());
78   - return NULL;
79   - }
80   -
81   - return PyLong_FromLong(rc);
82   -
83   - }
84   -
85   - PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args) {
86   -
87   - int rc;
88   - int timeout = 60;
89   -
90   - if (!PyArg_ParseTuple(args, "|i", &timeout)) {
91   - PyErr_SetString(terminalError, strerror(EINVAL));
92   - return NULL;
93   - }
94   -
95   - try {
96   -
97   - rc = ((pw3270_TerminalObject *) self)->session->wait_for_ready(timeout);
98   -
99   - } catch(std::exception &e) {
100   -
101   - PyErr_SetString(terminalError, e.what());
102   - return NULL;
103   - }
104   -
105   - return PyLong_FromLong(rc);
106   -
107   - }
108   -
109   -
110   - PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args) {
111   -
112   - int row, col, rc;
113   - int timeout = 10;
114   - const char *text;
115   -
116   - if (!PyArg_ParseTuple(args, "iis|i", &row, &col, &text, &timeout)) {
117   - PyErr_SetString(terminalError, strerror(EINVAL));
118   - return NULL;
119   - }
120   -
121   - try {
122   -
123   - rc = ((pw3270_TerminalObject *) self)->session->wait_for_string_at(row,col,text,timeout);
124   -
125   - } catch(std::exception &e) {
126   -
127   - PyErr_SetString(terminalError, e.what());
128   - return NULL;
129   - }
130   -
131   - return PyLong_FromLong(rc);
132   -
133   - }
134   -
src/private.h
... ... @@ -1,115 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como private.h e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - */
29   -
30   -#ifndef PRIVATE_H_INCLUDED
31   -
32   - #define PRIVATE_H_INCLUDED
33   -
34   - // http://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python
35   - #include <cmath>
36   -
37   - // https://lists.gt.net/python/dev/340073
38   - #pragma GCC diagnostic push
39   - #pragma GCC system_header
40   - #include <Python.h>
41   - #pragma GCC diagnostic pop
42   -
43   - #include <pw3270/pw3270cpp.h>
44   - #include "config.h"
45   -
46   - #if defined(_WIN32)
47   -
48   - #include <windows.h>
49   -
50   - #define DLL_PRIVATE extern
51   - #define DLL_PUBLIC extern __declspec (dllexport)
52   -
53   - #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
54   -
55   - #define DLL_PRIVATE __hidden extern
56   - #define DLL_PUBLIC extern
57   -
58   - #elif defined (HAVE_GNUC_VISIBILITY)
59   -
60   - #define DLL_PRIVATE __attribute__((visibility("hidden"))) extern
61   - #define DLL_PUBLIC __attribute__((visibility("default"))) extern
62   -
63   - #else
64   -
65   - #error Unable to set visibility attribute
66   -
67   - #endif
68   -
69   -
70   - using namespace std;
71   -
72   - typedef struct {
73   -
74   - PyObject_HEAD
75   -
76   - PW3270_NAMESPACE::session * session;
77   -
78   - } pw3270_TerminalObject;
79   -
80   - extern PyObject * terminalError;
81   -
82   - extern "C" {
83   -
84   - DLL_PRIVATE PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
85   - DLL_PRIVATE int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds);
86   - DLL_PRIVATE void terminal_dealloc(pw3270_TerminalObject * self);
87   -
88   - DLL_PRIVATE PyObject * terminal_get_version(PyObject *self, PyObject *args);
89   - DLL_PRIVATE PyObject * terminal_get_revision(PyObject *self, PyObject *args);
90   -
91   - DLL_PRIVATE PyObject * terminal_is_connected(PyObject *self, PyObject *args);
92   - DLL_PRIVATE PyObject * terminal_is_ready(PyObject *self, PyObject *args);
93   -
94   - DLL_PRIVATE PyObject * terminal_connect(PyObject *self, PyObject *args);
95   - DLL_PRIVATE PyObject * terminal_disconnect(PyObject *self, PyObject *args);
96   -
97   - DLL_PRIVATE PyObject * terminal_get_string_at(PyObject *self, PyObject *args);
98   - DLL_PRIVATE PyObject * terminal_get_contents(PyObject *self);
99   - DLL_PRIVATE PyObject * terminal_set_string_at(PyObject *self, PyObject *args);
100   - DLL_PRIVATE PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args);
101   -
102   - DLL_PRIVATE PyObject * terminal_pfkey(PyObject *self, PyObject *args);
103   - DLL_PRIVATE PyObject * terminal_pakey(PyObject *self, PyObject *args);
104   - DLL_PRIVATE PyObject * terminal_enter(PyObject *self, PyObject *args);
105   - DLL_PRIVATE PyObject * terminal_action(PyObject *self, PyObject *args);
106   -
107   - DLL_PRIVATE PyObject * terminal_is_protected_at(PyObject *self, PyObject *args);
108   - DLL_PRIVATE PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args);
109   -
110   - DLL_PRIVATE PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args);
111   - DLL_PRIVATE PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args);
112   -
113   - }
114   -
115   -#endif // PRIVATE_H_INCLUDED
src/py3270.cc
... ... @@ -1,167 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como py3270.cc e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Implementa métodos básicos para a extensão python.
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -/*---[ Globals ]------------------------------------------------------------------------------------*/
40   -
41   - PyObject * terminalError = NULL;
42   -
43   -/*---[ Implement ]----------------------------------------------------------------------------------*/
44   -
45   -static PyObject * get_revision(PyObject *self, PyObject *args) {
46   -
47   -#ifdef PACKAGE_REVISION
48   - return PyLong_FromLong(atoi(PACKAGE_REVISION));
49   -#else
50   - return PyLong_FromLong(BUILD_DATE);
51   -#endif // PACKAGE_REVISION
52   -
53   -}
54   -
55   -static PyMethodDef terminal_methods[] = {
56   -
57   - { "Version", terminal_get_version, METH_NOARGS, "Get the lib3270 version string." },
58   - { "Revision", terminal_get_revision, METH_NOARGS, "Get the lib3270 revision number." },
59   -
60   - { "IsConnected", terminal_is_connected, METH_NOARGS, "True if the terminal is connected to the host." },
61   - { "IsReady", terminal_is_ready, METH_NOARGS, "True if the terminal has finished network activity." },
62   - { "IsProtected", terminal_is_protected_at, METH_VARARGS, "True if the position is read-only." },
63   -
64   - { "SetCursorPosition", terminal_set_cursor_at, METH_VARARGS, "Set cursor position." },
65   -
66   - { "WaitForStringAt", terminal_wait_for_string_at, METH_VARARGS, "Wait for string at position" },
67   - { "WaitForReady", terminal_wait_for_ready, METH_VARARGS, "Wait for network communication to finish" },
68   -
69   - { "Connect", terminal_connect, METH_VARARGS, "Connect to the host." },
70   - { "Disconnect", terminal_disconnect, METH_NOARGS, "Disconnect from host." },
71   -
72   - { "CmpStringAt", terminal_cmp_string_at, METH_VARARGS, "Compare string with terminal buffer at the position." },
73   - { "GetStringAt", terminal_get_string_at, METH_VARARGS, "Get string from terminal buffer." },
74   - { "SetStringAt", terminal_set_string_at, METH_VARARGS, "Set string in terminal buffer." },
75   -
76   - { "PFKey", terminal_pfkey, METH_VARARGS, "Send PF key." },
77   - { "PAKey", terminal_pakey, METH_VARARGS, "Send PA key." },
78   - { "Enter", terminal_enter, METH_NOARGS, "Send Enter Key." },
79   - { "Action", terminal_action, METH_VARARGS, "Send Action by name." },
80   -
81   - {NULL} // Sentinel
82   -
83   -};
84   -
85   -/*
86   -static PyMemberDef terminal_members[] = {
87   -
88   - { NULL } // Sentinel
89   -
90   -};
91   -*/
92   -
93   -static PyTypeObject pw3270_TerminalType = {
94   - PyObject_HEAD_INIT(NULL)
95   - 0, /*ob_size*/
96   - "py3270.terminal", /*tp_name*/
97   - sizeof(pw3270_TerminalObject), /*tp_basicsize*/
98   - 0, /*tp_itemsize*/
99   - (destructor) terminal_dealloc, /*tp_dealloc*/
100   - 0, /*tp_print*/
101   - 0, /*tp_getattr*/
102   - 0, /*tp_setattr*/
103   - 0, /*tp_compare*/
104   - 0, /*tp_repr*/
105   - 0, /*tp_as_number*/
106   - 0, /*tp_as_sequence*/
107   - 0, /*tp_as_mapping*/
108   - 0, /*tp_hash */
109   - 0, /*tp_call*/
110   - terminal_get_contents, /*tp_str*/
111   - 0, /*tp_getattro*/
112   - 0, /*tp_setattro*/
113   - 0, /*tp_as_buffer*/
114   - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
115   - "3270 terminal object", /* tp_doc */
116   - 0, /* tp_traverse */
117   - 0, /* tp_clear */
118   - 0, /* tp_richcompare */
119   - 0, /* tp_weaklistoffset */
120   - 0, /* tp_iter */
121   - 0, /* tp_iternext */
122   - terminal_methods, /* tp_methods */
123   - 0, // terminal_members, /* tp_members */
124   - 0, /* tp_getset */
125   - 0, /* tp_base */
126   - 0, /* tp_dict */
127   - 0, /* tp_descr_get */
128   - 0, /* tp_descr_set */
129   - 0, /* tp_dictoffset */
130   - (initproc) terminal_init, /* tp_init */
131   - 0, /* tp_alloc */
132   - terminal_new, /* tp_new */
133   -
134   -};
135   -
136   -static PyMethodDef MyMethods[] = {
137   -
138   - { "Revision", get_revision, METH_VARARGS, "Get module revision." },
139   -
140   - {NULL, NULL, 0, NULL} /* Sentinel */
141   -
142   -};
143   -
144   -PyMODINIT_FUNC initpy3270(void) {
145   -
146   - // Cria o módulo
147   -
148   - PyObject *m = Py_InitModule("py3270", MyMethods);
149   -
150   - if (m == NULL) {
151   - return;
152   - }
153   -
154   - // Adiciona objeto para tratamento de erros.
155   - terminalError = PyErr_NewException((char *) "py3270.error", NULL, NULL);
156   -
157   - (void) Py_INCREF(terminalError);
158   - PyModule_AddObject(m, "error", terminalError);
159   -
160   - // Adiciona terminal
161   - if(PyType_Ready(&pw3270_TerminalType) < 0)
162   - return
163   -
164   - (void) Py_INCREF(&pw3270_TerminalType);
165   - PyModule_AddObject(m, "Terminal", (PyObject *)&pw3270_TerminalType);
166   -
167   -}
src/set.cc
... ... @@ -1,86 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como set.cc e possui - linhas de código.
22   - *
23   - * Contatos
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -
38   -/*---[ Implement ]----------------------------------------------------------------------------------*/
39   -
40   - PyObject * terminal_set_string_at(PyObject *self, PyObject *args) {
41   -
42   - int row, col, rc;
43   - const char *text;
44   -
45   - if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
46   - PyErr_SetString(terminalError, strerror(EINVAL));
47   - return NULL;
48   - }
49   -
50   - try {
51   -
52   - rc = ((pw3270_TerminalObject *) self)->session->set_string_at(row,col,text);
53   -
54   - } catch(std::exception &e) {
55   -
56   - PyErr_SetString(terminalError, e.what());
57   - return NULL;
58   - }
59   -
60   - return PyLong_FromLong(rc);
61   -
62   - }
63   -
64   - PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args) {
65   -
66   - int row, col, rc;
67   -
68   - if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
69   - PyErr_SetString(terminalError, strerror(EINVAL));
70   - return NULL;
71   - }
72   -
73   - try {
74   -
75   - rc = ((pw3270_TerminalObject *) self)->session->set_cursor_position(row,col);
76   -
77   - } catch(std::exception &e) {
78   -
79   - PyErr_SetString(terminalError, e.what());
80   - return NULL;
81   - }
82   -
83   - return PyLong_FromLong(rc);
84   -
85   - }
86   -