X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2Ficmp-warning.pl;fp=OSX%2Ficmp-warning.pl;h=ac76fdc31fb7cabb0949f76f17e7fb388cdb9ea1;hb=c70f94f648d51bb4828193124f325fa52b0e57f3;hp=0000000000000000000000000000000000000000;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/OSX/icmp-warning.pl b/OSX/icmp-warning.pl new file mode 100755 index 00000000..ac76fdc3 --- /dev/null +++ b/OSX/icmp-warning.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w +# Copyright © 2012 Jamie Zawinski +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation. No representations are made about the suitability of this +# software for any purpose. It is provided "as is" without express or +# implied warranty. +# +# Created: 20-Jun-2012. + +require 5; +use diagnostics; +use strict; + +my $progname = $0; $progname =~ s@.*/@@g; +my $version = q{ $Revision: 1.1 $ }; $version =~ s/^[^\d]+([\d.]+).*/$1/; + +my $verbose = 0; + +sub sanity_check() { + + my $fail = ''; + my $d1 = $ENV{SDK_DIR} || ''; + my $d2 = '/usr/include/netinet/'; + foreach my $f ('ip.h', 'in_systm.h', 'ip_icmp.h', 'ip_var.h', 'udp.h') { + $fail .= "\tsudo ln -s $d2$f $d1$d2\n" + unless (-f "$d1$d2$f"); + } + + exit (0) unless $fail; + + print STDERR "ERROR:\t" . join(' ', # "\n\t", + 'The "Sonar" module won\'t build properly unless you repair your', + 'SDK first. With some versions of Xcode, the ICMP header files', + 'are present in the iPhone Simulator SDK but are missing from', + 'the "real device" SDK. You can fix it by doing this:') . + "\n\n$fail\n"; + exit (1); +} + +if ($#ARGV >= 0) { + print STDERR "usage: $progname\n"; + exit 1; +} + +sanity_check();