Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missed adding these files, so it didn't work
- Loading branch information
philfoundry
committed
Sep 26, 2008
1 parent
76f9ed6
commit 98971fb
Showing
10 changed files
with
10,556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/bin/sh | ||
# Look for program[s] somewhere in $PATH. | ||
# | ||
# Options: | ||
# -s | ||
# Do not print out full pathname. (silent) | ||
# -pPATHNAME | ||
# Look in PATHNAME instead of $PATH | ||
# | ||
# Usage: | ||
# PrintPath [-s] [-pPATHNAME] program [program ...] | ||
# | ||
# Initially written by Jim Jagielski for the Apache configuration mechanism | ||
# (with kudos to Kernighan/Pike) | ||
# | ||
# This script falls under the Apache License. | ||
# See http://www.apache.org/licenses/LICENSE | ||
|
||
## | ||
# Some "constants" | ||
## | ||
pathname=$PATH | ||
echo="yes" | ||
|
||
## | ||
# Find out what OS we are running for later on | ||
## | ||
os=`(uname) 2>/dev/null` | ||
|
||
## | ||
# Parse command line | ||
## | ||
for args in $* | ||
do | ||
case $args in | ||
-s ) echo="no" ;; | ||
-p* ) pathname="`echo $args | sed 's/^..//'`" ;; | ||
* ) programs="$programs $args" ;; | ||
esac | ||
done | ||
|
||
## | ||
# Now we make the adjustments required for OS/2 and everyone | ||
# else :) | ||
# | ||
# First of all, all OS/2 programs have the '.exe' extension. | ||
# Next, we adjust PATH (or what was given to us as PATH) to | ||
# be whitespace separated directories. | ||
# Finally, we try to determine the best flag to use for | ||
# test/[] to look for an executable file. OS/2 just has '-r' | ||
# but with other OSs, we do some funny stuff to check to see | ||
# if test/[] knows about -x, which is the preferred flag. | ||
## | ||
|
||
if [ "x$os" = "xOS/2" ] | ||
then | ||
ext=".exe" | ||
pathname=`echo -E $pathname | | ||
sed 's/^;/.;/ | ||
s/;;/;.;/g | ||
s/;$/;./ | ||
s/;/ /g | ||
s/\\\\/\\//g' ` | ||
test_exec_flag="-r" | ||
else | ||
ext="" # No default extensions | ||
pathname=`echo $pathname | | ||
sed 's/^:/.:/ | ||
s/::/:.:/g | ||
s/:$/:./ | ||
s/:/ /g' ` | ||
# Here is how we test to see if test/[] can handle -x | ||
testfile="pp.t.$$" | ||
|
||
cat > $testfile <<ENDTEST | ||
#!/bin/sh | ||
if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then | ||
exit 0 | ||
fi | ||
exit 1 | ||
ENDTEST | ||
|
||
if `/bin/sh $testfile 2>/dev/null`; then | ||
test_exec_flag="-x" | ||
else | ||
test_exec_flag="-r" | ||
fi | ||
rm -f $testfile | ||
fi | ||
|
||
for program in $programs | ||
do | ||
for path in $pathname | ||
do | ||
if [ $test_exec_flag $path/${program}${ext} ] && \ | ||
[ ! -d $path/${program}${ext} ]; then | ||
if [ "x$echo" = "xyes" ]; then | ||
echo $path/${program}${ext} | ||
fi | ||
exit 0 | ||
fi | ||
|
||
# Next try without extension (if one was used above) | ||
if [ "x$ext" != "x" ]; then | ||
if [ $test_exec_flag $path/${program} ] && \ | ||
[ ! -d $path/${program} ]; then | ||
if [ "x$echo" = "xyes" ]; then | ||
echo $path/${program} | ||
fi | ||
exit 0 | ||
fi | ||
fi | ||
done | ||
done | ||
exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
dnl @synopsis AC_C_BIGENDIAN_CROSS | ||
dnl | ||
dnl Check endianess even when crosscompiling | ||
dnl (partially based on the original AC_C_BIGENDIAN). | ||
dnl | ||
dnl The implementation will create a binary, and instead of running | ||
dnl the binary it will be grep'ed for some symbols that will look | ||
dnl different for different endianess of the binary. | ||
dnl | ||
dnl @version $Id$ | ||
dnl @author Guido Draheim <guidod@gmx.de> | ||
dnl | ||
AC_DEFUN([AC_C_BIGENDIAN_CROSS], | ||
[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, | ||
[ac_cv_c_bigendian=unknown | ||
# See if sys/param.h defines the BYTE_ORDER macro. | ||
AC_TRY_COMPILE([#include <sys/types.h> | ||
#include <sys/param.h>], [ | ||
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | ||
bogus endian macros | ||
#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. | ||
AC_TRY_COMPILE([#include <sys/types.h> | ||
#include <sys/param.h>], [ | ||
#if BYTE_ORDER != BIG_ENDIAN | ||
not big endian | ||
#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) | ||
if test $ac_cv_c_bigendian = unknown; then | ||
AC_TRY_RUN([main () { | ||
/* Are we little or big endian? From Harbison&Steele. */ | ||
union | ||
{ | ||
long l; | ||
char c[sizeof (long)]; | ||
} u; | ||
u.l = 1; | ||
exit (u.c[sizeof (long) - 1] == 1); | ||
}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, | ||
[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) | ||
fi]) | ||
if test $ac_cv_c_bigendian = unknown; then | ||
AC_MSG_CHECKING(to probe for byte ordering) | ||
[ | ||
cat >conftest.c <<EOF | ||
short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; | ||
short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; | ||
void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } | ||
short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; | ||
short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; | ||
void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } | ||
int main() { _ascii (); _ebcdic (); return 0; } | ||
EOF | ||
] if test -f conftest.c ; then | ||
if ${CC-cc} -c conftest.c -o conftest.o && test -f conftest.o ; then | ||
if test `grep -l BIGenDianSyS conftest.o` ; then | ||
echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG | ||
ac_cv_c_bigendian=yes | ||
fi | ||
if test `grep -l LiTTleEnDian conftest.o` ; then | ||
echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG | ||
if test $ac_cv_c_bigendian = yes ; then | ||
ac_cv_c_bigendian=unknown; | ||
else | ||
ac_cv_c_bigendian=no | ||
fi | ||
fi | ||
echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG | ||
fi | ||
fi | ||
AC_MSG_RESULT($ac_cv_c_bigendian) | ||
fi | ||
if test $ac_cv_c_bigendian = yes; then | ||
AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) | ||
BYTEORDER=4321 | ||
else | ||
BYTEORDER=1234 | ||
fi | ||
AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) | ||
if test $ac_cv_c_bigendian = unknown; then | ||
AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) | ||
fi | ||
]) |
Oops, something went wrong.