summaryrefslogtreecommitdiff
path: root/mcon/U/d_shmat.U
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-11-27 11:55:39 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-11-27 11:55:39 +0000
commit13158f86e3904284dce3dad36b64f07414459551 (patch)
tree12cc7b8d1b808c8c3505bb44cf067bd9ab98b1e6 /mcon/U/d_shmat.U
parent194d1db97053d853d5f81c362c461d71c05ea80e (diff)
Applied mega patch from Christian Biere to greatly improve feature detection
and make a huge step towards better support for cross-compiling. git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@34 2592e710-e01b-42a5-8df0-11608a6cc53d
Diffstat (limited to 'mcon/U/d_shmat.U')
-rw-r--r--mcon/U/d_shmat.U95
1 files changed, 68 insertions, 27 deletions
diff --git a/mcon/U/d_shmat.U b/mcon/U/d_shmat.U
index 4646fc5..4089cc0 100644
--- a/mcon/U/d_shmat.U
+++ b/mcon/U/d_shmat.U
@@ -21,8 +21,7 @@
?RCS: Revision 3.0 1993/08/18 12:07:18 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?MAKE:d_shmat shmattype d_shmatprototype: Inlibc cat +cc +ccflags \
- rm cppstdin cppflags cppminus Findhdr Setvar contains
+?MAKE:d_shmat shmattype d_shmatprototype: Trylink Setvar cat
?MAKE: -pick add $@ %<
?S:d_shmat:
?S: This variable conditionally defines the HAS_SHMAT symbol, which
@@ -57,37 +56,79 @@
?H:#$d_shmatprototype HAS_SHMAT_PROTOTYPE /**/
?H:.
?LINT:set d_shmat d_shmatprototype
-?T:xxx
: see if shmat exists
-set shmat d_shmat
-eval $inlibc
-: see what shmat returns
+$cat >try.c <<EOC
+#include <sys/shm.h>
+int main(void)
+{
+ static int id, flags;
+ static void *addr;
+ (void) shmat(id, addr, flags);
+ return 0;
+}
+EOC
+set d_shmat
+eval $trylink
+
case "$d_shmat" in
"$define")
- $cat >shmat.c <<'END'
+ $cat >try.c <<EOC
#include <sys/shm.h>
-void *shmat();
-END
- if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
- shmattype='void *'
- else
- shmattype='char *'
- fi
- echo "and it returns ($shmattype)." >&4
- : see if a prototype for shmat is available
- xxx=`./findhdr sys/shm.h`
- $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
- if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
- val="$define"
- else
- val="$undef"
- fi
- $rm -f shmat.[co]
- ;;
-*)
- val="$undef"
+extern void shmat(void);
+int main(void) { return 0; }
+EOC
+ set val
+ eval $trylink
+ case "$val" in
+ "$define") val="$undef";;
+ *) val="$define";;
+ esac
;;
+*) val="$undef";;
esac
+
set d_shmatprototype
eval $setvar
+case "$d_shmat" in
+"$define")
+ $cat >try.c <<EOC
+#include <sys/shm.h>
+extern void *shmat(int, const void *, int);
+int main(void) { return 0; }
+EOC
+ set val
+ eval $trylink
+ ;;
+esac
+
+case "$d_shmat" in
+"$define")
+ $cat >try.c <<EOC
+#include <sys/shm.h>
+extern void *shmat(int, void *, int);
+int main(void) { return 0; }
+EOC
+ set val
+ eval $trylink
+ case "$val" in
+ "$define") shmattype='void *';;
+ esac
+ ;;
+esac
+
+case "$d_shmat" in
+"$define")
+ $cat >try.c <<EOC
+#include <sys/shm.h>
+extern char *shmat(int, char *, int);
+int main(void) { return 0; }
+EOC
+ set val
+ eval $trylink
+ case "$val" in
+ "$define") shmattype='char *';;
+ esac
+ ;;
+esac
+