Lines 24-31
Link Here
|
24 |
EOF |
24 |
EOF |
25 |
fi |
25 |
fi |
26 |
|
26 |
|
|
|
27 |
if [ ! -z "$vpath" ] ; then |
27 |
cat << EOF >> Makefile |
28 |
cat << EOF >> Makefile |
28 |
|
29 |
|
|
|
30 |
VPATH = $vpath |
31 |
EOF |
32 |
fi |
33 |
|
34 |
cat << EOF >> Makefile |
35 |
|
29 |
PREFIX = $prefix |
36 |
PREFIX = $prefix |
30 |
BINDIR = $bindir |
37 |
BINDIR = $bindir |
31 |
MANDIR = $mandir |
38 |
MANDIR = $mandir |
Lines 119-124
Link Here
|
119 |
fi |
126 |
fi |
120 |
} |
127 |
} |
121 |
|
128 |
|
|
|
129 |
c11noreturncheck() { |
130 |
cat << EOF > conftest.c |
131 |
#include <stdlib.h> |
132 |
_Noreturn void usage(void){exit(1);}int main(void){usage();return 0;} |
133 |
EOF |
134 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
135 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
136 |
if [ $? -eq 0 ] ; then |
137 |
rm -f conftest conftest.o conftest.c |
138 |
return 0 |
139 |
else |
140 |
rm -f conftest conftest.o conftest.c |
141 |
return 1 |
142 |
fi |
143 |
} |
144 |
|
122 |
c99check() { |
145 |
c99check() { |
123 |
cat << EOF > conftest.c |
146 |
cat << EOF > conftest.c |
124 |
#include <stdio.h> |
147 |
#include <stdio.h> |
Lines 274-280
Link Here
|
274 |
deadcheck() { |
297 |
deadcheck() { |
275 |
cat << EOF > conftest.c |
298 |
cat << EOF > conftest.c |
276 |
#include <stdlib.h> |
299 |
#include <stdlib.h> |
277 |
__dead usage(void){exit(1);}int main(void){usage();return 0;} |
300 |
__dead void usage(void){exit(1);}int main(void){usage();return 0;} |
278 |
EOF |
301 |
EOF |
279 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
302 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
280 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
303 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
Lines 290-296
Link Here
|
290 |
dead2check() { |
313 |
dead2check() { |
291 |
cat << EOF > conftest.c |
314 |
cat << EOF > conftest.c |
292 |
#include <stdlib.h> |
315 |
#include <stdlib.h> |
293 |
__dead2 usage(void){exit(1);}int main(void){usage();return 0;} |
316 |
__dead2 void usage(void){exit(1);}int main(void){usage();return 0;} |
294 |
EOF |
317 |
EOF |
295 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
318 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
296 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
319 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
Lines 431-437
Link Here
|
431 |
noreturncheck() { |
454 |
noreturncheck() { |
432 |
cat << EOF > conftest.c |
455 |
cat << EOF > conftest.c |
433 |
#include <stdlib.h> |
456 |
#include <stdlib.h> |
434 |
__attribute__((__noreturn__)) usage(void){exit(1);}int main(void){usage();return 0;} |
457 |
__attribute__((__noreturn__)) void usage(void){exit(1);}int main(void){usage();return 0;} |
435 |
EOF |
458 |
EOF |
436 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
459 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
437 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
460 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
Lines 487-493
Link Here
|
487 |
cat << EOF > conftest.c |
510 |
cat << EOF > conftest.c |
488 |
#include <sys/types.h> |
511 |
#include <sys/types.h> |
489 |
#include <unistd.h> |
512 |
#include <unistd.h> |
490 |
int main(void){setresgid(NULL, NULL, NULL);return 0;} |
513 |
int main(void){setresgid(0, 0, 0);return 0;} |
491 |
EOF |
514 |
EOF |
492 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
515 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
493 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
516 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
Lines 504-510
Link Here
|
504 |
cat << EOF > conftest.c |
527 |
cat << EOF > conftest.c |
505 |
#include <sys/types.h> |
528 |
#include <sys/types.h> |
506 |
#include <unistd.h> |
529 |
#include <unistd.h> |
507 |
int main(void){setresuid(NULL, NULL, NULL);return 0;} |
530 |
int main(void){setresuid(0, 0, 0);return 0;} |
508 |
EOF |
531 |
EOF |
509 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
532 |
$cc $cflags -o conftest.o -c conftest.c > /dev/null 2>&1 |
510 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
533 |
$cc $ldflags -o conftest conftest.o > /dev/null 2>&1 |
Lines 781-786
Link Here
|
781 |
instsh=0 |
804 |
instsh=0 |
782 |
static=0 |
805 |
static=0 |
783 |
lto=0 |
806 |
lto=0 |
|
|
807 |
small=0 |
784 |
strip=1 |
808 |
strip=1 |
785 |
|
809 |
|
786 |
# Options |
810 |
# Options |
Lines 804-809
Link Here
|
804 |
mandir=${opt#*=} |
828 |
mandir=${opt#*=} |
805 |
mandirset=1 |
829 |
mandirset=1 |
806 |
;; |
830 |
;; |
|
|
831 |
--cc=*) |
832 |
CC=${opt#*=} |
833 |
;; |
834 |
--cflags=*) |
835 |
CFLAGS=${opt#*=} |
836 |
;; |
807 |
--disable-curses|--enable-curses) |
837 |
--disable-curses|--enable-curses) |
808 |
if [ "x$opt" = "x--disable-curses" ] ; then |
838 |
if [ "x$opt" = "x--disable-curses" ] ; then |
809 |
curses=0 |
839 |
curses=0 |
Lines 825-830
Link Here
|
825 |
instsh=0 |
855 |
instsh=0 |
826 |
fi |
856 |
fi |
827 |
;; |
857 |
;; |
|
|
858 |
--disable-small|--enable-small) |
859 |
if [ "x$opt" = "x--enable-small" ] ; then |
860 |
small=1 |
861 |
curses=0 |
862 |
else |
863 |
small=0 |
864 |
fi |
865 |
;; |
828 |
--disable-static|--enable-static) |
866 |
--disable-static|--enable-static) |
829 |
if [ "x$opt" = "x--enable-static" ] ; then |
867 |
if [ "x$opt" = "x--enable-static" ] ; then |
830 |
static=1 |
868 |
static=1 |
Lines 860-865
Link Here
|
860 |
echo "Install executable to BINDIR [$bindir]" |
898 |
echo "Install executable to BINDIR [$bindir]" |
861 |
printf " --mandir=MANDIR " |
899 |
printf " --mandir=MANDIR " |
862 |
echo "Install manual pages to MANDIR [$mandir]" |
900 |
echo "Install manual pages to MANDIR [$mandir]" |
|
|
901 |
printf " --cc=CC " |
902 |
echo "Use specified C compiler [default=cc]" |
903 |
printf " --cflags=CFLAGS " |
904 |
echo "Use specified CFLAGS [default=\"-g -O2\"]" |
863 |
printf " --enable-curses " |
905 |
printf " --enable-curses " |
864 |
echo "Use curses library for screen clear [default=yes]" |
906 |
echo "Use curses library for screen clear [default=yes]" |
865 |
printf " --enable-ksh " |
907 |
printf " --enable-ksh " |
Lines 868-873
Link Here
|
868 |
echo "Enable link-time optimization [default=no]" |
910 |
echo "Enable link-time optimization [default=no]" |
869 |
printf " --enable-sh " |
911 |
printf " --enable-sh " |
870 |
echo "Install additional sh executable [default=no]" |
912 |
echo "Install additional sh executable [default=no]" |
|
|
913 |
printf " --enable-small " |
914 |
echo "Disable curses and extended history [default=no]" |
871 |
printf " --enable-static " |
915 |
printf " --enable-static " |
872 |
echo "Statically link executables [default=no]" |
916 |
echo "Statically link executables [default=no]" |
873 |
printf " --no-thanks " |
917 |
printf " --no-thanks " |
Lines 963-968
Link Here
|
963 |
echo "$cc" |
1007 |
echo "$cc" |
964 |
fi |
1008 |
fi |
965 |
|
1009 |
|
|
|
1010 |
if [ "x$cc" = "xvc" ] ; then |
1011 |
echo "using vbcc, setting CFLAGS to -g -O=990" |
1012 |
cflags="-g -O=990 -DEMACS -DVI" |
1013 |
fi |
1014 |
|
966 |
if [ "x$cflags" = "x-DEMACS -DVI" ] ; then |
1015 |
if [ "x$cflags" = "x-DEMACS -DVI" ] ; then |
967 |
printf "checking if the compiler accepts -g -O2... " |
1016 |
printf "checking if the compiler accepts -g -O2... " |
968 |
defaultcflagscheck |
1017 |
defaultcflagscheck |
Lines 1027-1035
Link Here
|
1027 |
cflags="$cflags -D_ANSI_LIBRARY" |
1076 |
cflags="$cflags -D_ANSI_LIBRARY" |
1028 |
ldflags="$ldflags -Wl,-nopie" |
1077 |
ldflags="$ldflags -Wl,-nopie" |
1029 |
;; |
1078 |
;; |
|
|
1079 |
"xchibicc") |
1080 |
cflags="$cflags -D_ANSI_LIBRARY" |
1081 |
;; |
1030 |
"xnwcc") |
1082 |
"xnwcc") |
1031 |
ldflags="$ldflags -Wl,-nopie" |
1083 |
ldflags="$ldflags -Wl,-nopie" |
1032 |
;; |
1084 |
;; |
|
|
1085 |
"xvc") |
1086 |
cflags="$cflags -D_ANSI_LIBRARY" |
1087 |
;; |
1033 |
esac |
1088 |
esac |
1034 |
;; |
1089 |
;; |
1035 |
"xAIX"|"xOS400") |
1090 |
"xAIX"|"xOS400") |
Lines 1052-1057
Link Here
|
1052 |
fi |
1107 |
fi |
1053 |
fi |
1108 |
fi |
1054 |
|
1109 |
|
|
|
1110 |
if [ $small -ne 0 ] ; then |
1111 |
cflags="$cflags -DSMALL" |
1112 |
fi |
1113 |
|
1055 |
cat << EOF > pconfig.h |
1114 |
cat << EOF > pconfig.h |
1056 |
/* This file automatically generated by configure. */ |
1115 |
/* This file automatically generated by configure. */ |
1057 |
|
1116 |
|
Lines 1076-1084
Link Here
|
1076 |
echo "#define __dead __attribute__((__noreturn__))" >> pconfig.h |
1135 |
echo "#define __dead __attribute__((__noreturn__))" >> pconfig.h |
1077 |
echo "yes" |
1136 |
echo "yes" |
1078 |
else |
1137 |
else |
1079 |
echo "#define __dead" >> pconfig.h |
|
|
1080 |
echo "#define __attribute__(x)" >> pconfig.h |
1081 |
echo "no" |
1138 |
echo "no" |
|
|
1139 |
printf "checking for _Noreturn... " |
1140 |
c11noreturncheck |
1141 |
if [ $? -eq 0 ] ; then |
1142 |
echo "#ifdef __dead" >> pconfig.h |
1143 |
echo "#undef __dead" >> pconfig.h |
1144 |
echo "#endif" >> pconfig.h |
1145 |
echo "#define __dead _Noreturn" >> pconfig.h |
1146 |
echo "#define __attribute__(x)" >> pconfig.h |
1147 |
echo "yes" |
1148 |
else |
1149 |
echo "#define __dead" >> pconfig.h |
1150 |
echo "#define __attribute__(x)" >> pconfig.h |
1151 |
echo "no" |
1152 |
fi |
1082 |
fi |
1153 |
fi |
1083 |
fi |
1154 |
fi |
1084 |
fi |
1155 |
fi |
Lines 1334-1339
Link Here
|
1334 |
echo "yes" |
1405 |
echo "yes" |
1335 |
else |
1406 |
else |
1336 |
echo "no" |
1407 |
echo "no" |
|
|
1408 |
fi |
1409 |
|
1410 |
printf "checking for out-of-tree build... " |
1411 |
if [ "x$(dirname $0)" = "x." ] ; then |
1412 |
echo "no" |
1413 |
elif [ "x$(dirname $0)" = "x$(pwd)" ] ; then |
1414 |
echo "no" |
1415 |
else |
1416 |
echo "yes" |
1417 |
vpath="$(dirname $0)" |
1418 |
cflags="$cflags -I$(pwd)" |
1337 |
fi |
1419 |
fi |
1338 |
|
1420 |
|
1339 |
printf "creating Makefile... " |
1421 |
printf "creating Makefile... " |