2
I Use This!
Activity Not Available

News

Analyzed 12 months ago. based on code collected 12 months ago.
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-21 01:41:05 -0400 (Sat, 21 Jul 2012) New Revision: 960 Added: trunk/BSDBuild/cc_attributes.pm Modified: trunk/BSDBuild/Makefile trunk/BSDBuild/cc.pm trunk/BSDBuild/cxx.pm Log: move attribute tests to separate ... [More] module "cc_attributes" Modified: trunk/BSDBuild/Makefile =================================================================== --- trunk/BSDBuild/Makefile2012-07-19 02:03:52 UTC (rev 959) trunk/BSDBuild/Makefile2012-07-21 05:41:05 UTC (rev 960) < at >< at > -3,6 3,7 < at >< at > SHARE=Core.pm \ Builtins.pm \ cc.pm \ cc_attributes.pm \ objc.pm \ cxx.pm \ gcc.pm \ Modified: trunk/BSDBuild/cc.pm =================================================================== --- trunk/BSDBuild/cc.pm2012-07-19 02:03:52 UTC (rev 959) trunk/BSDBuild/cc.pm2012-07-21 05:41:05 UTC (rev 960) < at >< at > -133,123 133,7 < at >< at > return (f == 1.0 || d == 1.0); } EOF - -MkPrintN('checking aligned attribute...'); -TryCompileFlagsC('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -int main(int argc, char *argv[]) -{ -struct s1 { int x,y,z; } __attribute__ ((aligned(16))); -return (0); -} -EOF -MkPrintN('checking bounded attribute...'); -MkCompileC('HAVE_BOUNDED_ATTRIBUTE', '', '', << 'EOF'); -void foo(char *, int) __attribute__ ((__bounded__(__string__,1,2))); -void foo(char *a, int c) { } -int main(int argc, char *argv[]) -{ -char buf[32]; -foo(buf, sizeof(buf)); -return (0); -} -EOF - -MkPrintN('checking const attribute...'); -TryCompileFlagsC('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); -int foo(int) __attribute__ ((const)); -int foo(int x) { return (x*x); } -int main(int argc, char *argv[]) -{ -int x = foo(1); -return (x); -} -EOF - -MkPrintN('checking deprecated attribute...'); -TryCompileFlagsC('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); -void foo(void) __attribute__ ((deprecated)); -void foo(void) { } - -int main(int argc, char *argv[]) -{ -/*foo(); */ -return (0); -} -EOF - -MkPrintN('checking format attribute...'); -MkCompileC('HAVE_FORMAT_ATTRIBUTE', '', '', << 'EOF'); -#include <stdarg.h> -void foo1(char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void foo2(char *, ...) - __attribute__((__format__ (__printf__, 1, 2))) - __attribute__((__nonnull__ (1))); -void foo1(char *a, ...) {} -void foo2(char *a, ...) {} -int main(int argc, char *argv[]) -{ -foo1("foo %s", "bar"); -foo2("foo %d", 1); -return (0); -} -EOF - -MkPrintN('checking nonnull attribute...'); -TryCompileFlagsC('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -void foo(char *) __attribute__((__nonnull__ (1))); -void foo(char *a) { } -int main(int argc, char *argv[]) -{ -foo("foo"); -return (0); -} -EOF - -MkPrintN('checking noreturn attribute...'); -TryCompileFlagsC('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); -#include <unistd.h> -#include <stdlib.h> -void foo(void) __attribute__ ((noreturn)); -void foo(void) { _exit(0); } -int main(int argc, char *argv[]) -{ -foo(); -} -EOF - -MkPrintN('checking packed attribute...'); -TryCompileFlagsC('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -int main(int argc, char *argv[]) -{ -struct s1 { char c; int x,y,z; } __attribute__ ((packed)); -return (0); -} -EOF - -MkPrintN('checking pure attribute...'); -TryCompileFlagsC('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); -int foo(int) __attribute__ ((pure)); -int foo(int x) { return (x*x); } -int main(int argc, char *argv[]) -{ -int x = foo(1); -return (x); -} -EOF - -MkPrintN('checking warn_unused_result attribute...'); -TryCompileFlagsC('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); -int foo(void) __attribute__ ((warn_unused_result)); -int foo(void) { return (1); } -int main(int argc, char *argv[]) -{ -int rv = foo(); -return (rv); -} -EOF - # Check for long double type. MkPrintN('checking for long double...'); TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); Added: trunk/BSDBuild/cc_attributes.pm =================================================================== --- trunk/BSDBuild/cc_attributes.pm (rev 0) trunk/BSDBuild/cc_attributes.pm2012-07-21 05:41:05 UTC (rev 960) < at >< at > -0,0 1,171 < at >< at > # vim:ts=4 # # Copyright (c) 2002-2012 Hypertriton, Inc. <http://hypertriton.com/> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution.. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.. sub Test { TryCompileFlagsC('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(int argc, char *argv[]) { struct s1 { int x,y,z; } __attribute__ ((aligned(16))); return (0); } EOF MkPrintN('checking for __bounded__ attribute...'); MkCompileC('HAVE_BOUNDED_ATTRIBUTE', '', '', << 'EOF'); void foostring(char *, int) __attribute__ ((__bounded__(__string__,1,2))); void foostring(char *a, int c) { } void foobuffer(void *, int) __attribute__ ((__bounded__(__buffer__,1,2))); void foobuffer(void *a, int c) { } int main(void) { char buf[32]; foostring(buf, sizeof(buf)); foobuffer(buf, sizeof(buf)); return (0); } EOF MkPrintN('checking for const attribute...'); TryCompileFlagsC('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((const)); int foo(int x) { return (x*x); } int main(int argc, char *argv[]) { int x = foo(1); return (x); } EOF MkPrintN('checking for deprecated attribute...'); TryCompileFlagsC('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); void foo(void) __attribute__ ((deprecated)); void foo(void) { } int main(int argc, char *argv[]) { /*foo(); */ return (0); } EOF MkPrintN('checking for __format__ attribute...'); MkCompileC('HAVE_FORMAT_ATTRIBUTE', '', '', << 'EOF'); #include <stdarg.h> void foo1(char *, ...) __attribute__((__format__ (printf, 1, 2))); void foo2(char *, ...) __attribute__((__format__ (__printf__, 1, 2))) __attribute__((__nonnull__ (1))); void foo1(char *a, ...) {} void foo2(char *a, ...) {} int main(int argc, char *argv[]) { foo1("foo %s", "bar"); foo2("foo %d", 1); return (0); } EOF MkPrintN('checking for __nonnull__ attribute...'); TryCompileFlagsC('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); void foo(char *) __attribute__((__nonnull__ (1))); void foo(char *a) { } int main(int argc, char *argv[]) { foo("foo"); return (0); } EOF MkPrintN('checking for noreturn attribute...'); TryCompileFlagsC('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); #include <unistd.h> #include <stdlib.h> void foo(void) __attribute__ ((noreturn)); void foo(void) { _exit(0); } int main(int argc, char *argv[]) { foo(); } EOF MkPrintN('checking for packed attribute...'); TryCompileFlagsC('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(int argc, char *argv[]) { struct s1 { char c; int x,y,z; } __attribute__ ((packed)); return (0); } EOF MkPrintN('checking for pure attribute...'); TryCompileFlagsC('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((pure)); int foo(int x) { return (x*x); } int main(int argc, char *argv[]) { int x = foo(1); return (x); } EOF MkPrintN('checking for warn_unused_result attribute...'); TryCompileFlagsC('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); int foo(void) __attribute__ ((warn_unused_result)); int foo(void) { return (1); } int main(int argc, char *argv[]) { int rv = foo(); return (rv); } EOF } sub Emul { my ($os, $osrel, $machine) = < at >_; MkSaveUndef('HAVE_ALIGNED_ATTRIBUTE'); MkSaveUndef('HAVE_BOUNDED_ATTRIBUTE'); MkSaveUndef('HAVE_CONST_ATTRIBUTE'); MkSaveUndef('HAVE_DEPRECATED_ATTRIBUTE'); MkSaveUndef('HAVE_FORMAT_ATTRIBUTE'); MkSaveUndef('HAVE_NONNULL_ATTRIBUTE'); MkSaveUndef('HAVE_NORETURN_ATTRIBUTE'); MkSaveUndef('HAVE_PACKED_ATTRIBUTE'); MkSaveUndef('HAVE_PURE_ATTRIBUTE'); MkSaveUndef('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE'); return (1); } BEGIN { $TESTS{'cc_attributes'} = \&Test; $EMUL{'cc_attributes'} = \&Emul; $DESCR{'cc_attributes'} = 'aligned attribute'; } ;1 Modified: trunk/BSDBuild/cxx.pm =================================================================== --- trunk/BSDBuild/cxx.pm2012-07-19 02:03:52 UTC (rev 959) trunk/BSDBuild/cxx.pm2012-07-21 05:41:05 UTC (rev 960) < at >< at > -119,122 119,6 < at >< at > MkDefine('TEST_CXXFLAGS', '-Wall -Werror'); MkEndif; -MkPrintN('checking aligned attribute in c ...'); -TryCompileFlagsCXX('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -int main(void) -{ -struct s1 { int x,y,z; } __attribute__ ((aligned(16))); -return (0); -} -EOF - -MkPrintN('checking bounded attribute in c ...'); -MkCompileCXX('HAVE_BOUNDED_ATTRIBUTE', '', '-lstdc ', << 'EOF'); -void foo(char *, int) __attribute__ ((__bounded__(__string__,1,2))); -void foo(char *a, int c) { } -int main(void) -{ -char buf[32]; -foo(buf, sizeof(buf)); -return (0); -} -EOF - -MkPrintN('checking const attribute in c ...'); -TryCompileFlagsCXX('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); -int foo(int) __attribute__ ((const)); -int foo(int x) { return (x*x); } -int main(void) -{ -int x = foo(1); -return (x); -} -EOF - -MkPrintN('checking deprecated attribute in c ...'); -TryCompileFlagsCXX('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); -void foo(void) __attribute__ ((deprecated)); -void foo(void) { } - -int main(void) -{ -/*foo(); */ -return (0); -} -EOF - -MkPrintN('checking format attribute in c ...'); -MkCompileCXX('HAVE_FORMAT_ATTRIBUTE', '', '-lstdc ', << 'EOF'); -#include <stdarg.h> -void foo1(char *, ...) - __attribute__((__format__ (printf, 1, 2))); -void foo2(char *, ...) - __attribute__((__format__ (__printf__, 1, 2))) - __attribute__((__nonnull__ (1))); -void foo1(char *a, ...) {} -void foo2(char *a, ...) {} -int main(void) -{ -foo1("foo %s", "bar"); -foo2("foo %d", 1); -return (0); -} -EOF - -MkPrintN('checking nonnull attribute in c ...'); -TryCompileFlagsCXX('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -void foo(char *) __attribute__((__nonnull__ (1))); -void foo(char *a) { } -int main(void) -{ -foo("foo"); -return (0); -} -EOF - -MkPrintN('checking noreturn attribute in c ...'); -TryCompileFlagsCXX('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); -#include <unistd.h> -#include <stdlib.h> -void foo(void) __attribute__ ((noreturn)); -void foo(void) { _exit(0); } -int main(void) -{ -foo(); -} -EOF - -MkPrintN('checking packed attribute in c ...'); -TryCompileFlagsCXX('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); -int main(void) -{ -struct s1 { char c; int x,y,z; } __attribute__ ((packed)); -return (0); -} -EOF - -MkPrintN('checking pure attribute in c ...'); -TryCompileFlagsCXX('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); -int foo(int) __attribute__ ((pure)); -int foo(int x) { return (x*x); } -int main(void) -{ -int x = foo(1); -return (x); -} -EOF - -MkPrintN('checking warn_unused_result attribute in c ...'); -TryCompileFlagsCXX('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); -int foo(void) __attribute__ ((warn_unused_result)); -int foo(void) { return (1); } -int main(void) -{ -int rv = foo(); -return (rv); -} -EOF - # Check for long double type. MkPrintN('checking for long double...'); TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); < at >< at > -310,20 194,8 < at >< at > MkDefine('HAVE_IEEE754', 'yes'); MkSaveDefine('HAVE_IEEE754'); -MkSaveUndef('HAVE_ALIGNED_ATTRIBUTE'); -MkSaveUndef('HAVE_BOUNDED_ATTRIBUTE'); -MkSaveUndef('HAVE_CONST_ATTRIBUTE'); -MkSaveUndef('HAVE_DEPRECATED_ATTRIBUTE'); -MkSaveUndef('HAVE_FORMAT_ATTRIBUTE'); -MkSaveUndef('HAVE_NONNULL_ATTRIBUTE'); -MkSaveUndef('HAVE_NORETURN_ATTRIBUTE'); -MkSaveUndef('HAVE_PACKED_ATTRIBUTE'); -MkSaveUndef('HAVE_PURE_ATTRIBUTE'); -MkSaveUndef('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE'); - MkSaveUndef('HAVE_LONG_DOUBLE'); MkSaveUndef('HAVE_LONG_LONG'); - MkSaveUndef('HAVE_CYGWIN'); return (1); } [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-18 22:03:52 -0400 (Wed, 18 Jul 2012) New Revision: 959 Added: trunk/BSDBuild/gethostbyname.pm trunk/BSDBuild/getpwnam_r.pm trunk/BSDBuild/sockopts.pm Modified: trunk/BSDBuild/Makefile ... [More] trunk/BSDBuild/getpwuid.pm Log: add tests for getpwnam_r(), setsockopt()/getsockopt() and gethostbyname() Modified: trunk/BSDBuild/Makefile =================================================================== --- trunk/BSDBuild/Makefile2012-07-13 11:13:08 UTC (rev 958) +++ trunk/BSDBuild/Makefile2012-07-19 02:03:52 UTC (rev 959) < at >< at > -36,6 +36,7 < at >< at > arc4random.pm \ pctr.pm \ getpwuid.pm \ +getpwnam_r.pm \ getuid.pm \ md5.pm \ sha1.pm \ < at >< at > -56,6 +57,7 < at >< at > perl.pm \ libidn.pm \ getaddrinfo.pm \ +gethostbyname.pm \ glu.pm \ ode.pm \ sse.pm \ < at >< at > -104,7 +106,8 < at >< at > xinerama.pm \ portaudio.pm \ mysql.pm \ -cocoa.pm +cocoa.pm \ +sockopts.pm all: Added: trunk/BSDBuild/gethostbyname.pm =================================================================== --- trunk/BSDBuild/gethostbyname.pm (rev 0) +++ trunk/BSDBuild/gethostbyname.pm2012-07-19 02:03:52 UTC (rev 959) < at >< at > -0,0 +1,65 < at >< at > +# vim:ts=4 +# +# Copyright (c) 2012 Hypertriton, Inc. <http://www.hypertriton.com/> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution.. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.. + +sub Test +{ +TryCompile 'HAVE_GETHOSTBYNAME', << 'EOF'; +#include <string.h> +#include <netdb.h> + +int +main(int argc, char *argv[]) +{ +struct hostent *hp; +const char *host = "localhost"; + +hp = gethostbyname(host); +return (hp == NULL); +} +EOF +} + +sub Emul +{ +my ($os, $osrel, $machine) = < at >_; + +if ($os eq 'linux' || $os eq 'darwin' || $os =~ /^(open|net|free)bsd/) { +MkDefine('HAVE_GETHOSTBYNAME', 'yes'); +MkSaveDefine('HAVE_GETHOSTBYNAME'); +} else { +MkSaveUndef('HAVE_GETHOSTBYNAME'); +} +return (1); +} + +BEGIN +{ +$TESTS{'gethostbyname'} = \&Test; +$DEPS{'gethostbyname'} = 'cc'; +$EMUL{'gethostbyname'} = \&Emul; +$DESCR{'gethostbyname'} = 'the gethostbyname() function'; +} + +;1 Added: trunk/BSDBuild/getpwnam_r.pm =================================================================== --- trunk/BSDBuild/getpwnam_r.pm (rev 0) +++ trunk/BSDBuild/getpwnam_r.pm2012-07-19 02:03:52 UTC (rev 959) < at >< at > -0,0 +1,78 < at >< at > +# vim:ts=4 +# +# Copyright (c) 2012 Hypertriton Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution.. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.. + +sub Test +{ +TryCompile 'HAVE_GETPWNAM_R', << 'EOF'; +#include <sys/types.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> + +int +main(int argc, char *argv[]) +{ +struct passwd pw, *res; +char *buf; +size_t bufSize; +int rv; + +bufSize = sysconf(_SC_GETPW_R_SIZE_MAX); +if (bufSize == -1) { bufSize = 16384; } +if ((buf = malloc(bufSize)) == NULL) { return (1); } + +rv = getpwnam_r("foo", &pw, buf, bufSize, &res); +if (res == NULL) { +return (rv == 0); +} +return (pw.pw_class != NULL && pw.pw_gecos != NULL && pw.pw_dir != NULL); +} +EOF +} + +sub Emul +{ +my ($os, $osrel, $machine) = < at >_; + +if ($os eq 'linux' || $os eq 'darwin' || $os =~ /^(open|net|free)bsd$/) { +MkDefine('HAVE_GETPWNAM_R', 'yes'); +MkSaveDefine('HAVE_GETPWNAM_R'); +} else { +MkSaveUndef('HAVE_GETPWNAM_R'); +PWNAM_R} +return (1); +} + +BEGIN +{ +$DESCR{'getpwnam_r'} = 'the getpwnam_r() interface'; +$DEPS{'getpwnam_r'} = 'cc'; +$TESTS{'getpwnam_r'} = \&Test; +$EMUL{'getpwnam_r'} = \&Emul; +} + +;1 Modified: trunk/BSDBuild/getpwuid.pm =================================================================== --- trunk/BSDBuild/getpwuid.pm2012-07-13 11:13:08 UTC (rev 958) +++ trunk/BSDBuild/getpwuid.pm2012-07-19 02:03:52 UTC (rev 959) < at >< at > -39,7 +39,7 < at >< at > uid_t uid = 0; pwd = getpwuid(uid); -return (pwd != NULL); +return (pwd != NULL && pwd->pw_gecos != NULL && pwd->pw_class != NULL); } EOF } Added: trunk/BSDBuild/sockopts.pm =================================================================== --- trunk/BSDBuild/sockopts.pm (rev 0) +++ trunk/BSDBuild/sockopts.pm2012-07-19 02:03:52 UTC (rev 959) < at >< at > -0,0 +1,133 < at >< at > +# vim:ts=4 +# +# Copyright (c) 2012 Hypertriton, Inc. <http://www.hypertriton.com/> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution.. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.. + +sub CheckBoolOption +{ +my $opt = shift; + +MkPrintN("checking for $opt..."); +TryCompile "HAVE_$opt", << "EOF"; +#include <sys/types.h> +#include <sys/socket.h> +#include <fcntl.h> +int +main(int argc, char *argv[]) +{ +int fd = 0, val = 1, rv; +socklen_t valLen = sizeof(val); +rv = setsockopt(fd, SOL_SOCKET, $opt, &val, valLen); +return (rv != 0); +} +EOF +} + +sub Test +{ +TryCompile 'HAVE_SETSOCKOPT', << 'EOF'; +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <fcntl.h> +int +main(int argc, char *argv[]) +{ +int fd = 0, rv; +struct timeval tv; +socklen_t tvLen = sizeof(tv); +tv.tv_sec = 1; tv.tv_usec = 0; +rv = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, tvLen); +return (rv != 0); +} +EOF +MkIfTrue('${HAVE_SETSOCKOPT}'); +CheckBoolOption('SO_OOBINLINE'); +CheckBoolOption('SO_REUSEPORT'); +CheckBoolOption('SO_TIMESTAMP'); +CheckBoolOption('SO_NOSIGPIPE'); + +MkPrintN('checking for SO_LINGER...'); +TryCompile 'HAVE_SO_LINGER', << 'EOF'; +#include <sys/types.h> +#include <sys/socket.h> +#include <fcntl.h> +int +main(int argc, char *argv[]) +{ +int fd = 0, rv; +struct linger ling; +socklen_t lingLen = sizeof(ling); +ling.l_onoff = 1; ling.l_linger = 1; +rv = setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, lingLen); +return (rv != 0); +} +EOF +MkPrintN('checking for SO_ACCEPTFILTER...'); +TryCompile 'HAVE_SO_ACCEPTFILTER', << 'EOF'; +#include <sys/types.h> +#include <sys/socket.h> +#include <fcntl.h> +int +main(int argc, char *argv[]) +{ +int fd = 0, rv; +struct accept_filter_arg afa; +socklen_t afaLen = sizeof(afa); +afa.af_name[0] = '\0'; +afa.af_arg[0] = '\0'; +rv = setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, afaLen); +return (rv != 0); +} +EOF +MkEndif; +} + +sub Emul +{ +my ($os, $osrel, $machine) = < at >_; + +if ($os eq 'linux' || $os eq 'darwin' || $os =~ /^(open|net|free)bsd/) { +MkDefine('HAVE_SETSOCKOPT', 'yes'); +MkSaveDefine('HAVE_SETSOCKOPT'); +} else { +MkSaveUndef('HAVE_SETSOCKOPT'); +} +MkSaveUndef('HAVE_SO_OOBINLINE'); +MkSaveUndef('HAVE_SO_REUSEPORT'); +MkSaveUndef('HAVE_SO_TIMESTAMP'); +MkSaveUndef('HAVE_SO_NOSIGPIPE'); +MkSaveUndef('HAVE_SO_LINGER'); +MkSaveUndef('HAVE_SO_ACCEPTFILTER'); +return (1); +} + +BEGIN +{ +$TESTS{'sockopts'} = \&Test; +$DEPS{'sockopts'} = 'cc'; +$EMUL{'sockopts'} = \&Emul; +$DESCR{'sockopts'} = 'the setsockopt() interface'; +} + +;1 [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-13 06:46:06 -0400 (Fri, 13 Jul 2012) New Revision: 957 Modified: trunk/BSDBuild/cc.pm trunk/BSDBuild/cxx.pm trunk/BSDBuild/objc.pm Log: abort further tests if compiler test failed Modified: ... [More] trunk/BSDBuild/cc.pm =================================================================== --- trunk/BSDBuild/cc.pm2012-07-11 13:11:10 UTC (rev 956) +++ trunk/BSDBuild/cc.pm2012-07-13 10:46:06 UTC (rev 957) < at >< at > -1,6 +1,6 < at >< at > # vim:ts=4 # -# Copyright (c) 2002-2010 Hypertriton, Inc. <http://hypertriton.com/> +# Copyright (c) 2002-2012 Hypertriton, Inc. <http://hypertriton.com/> # All rights reserved. # # Redistribution and use in source and binary forms, with or without < at >< at > -69,8 +69,8 < at >< at > EOT $CC -o conftest conftest.c 2>>config.log if [ $? != 0 ]; then - echo "no, the test failed to compile" - echo "no, the test failed to compile" >> config.log + echo "no" + echo "no (test failed to compile)" >> config.log HAVE_CC="no" else echo "yes" < at >< at > -78,48 +78,52 < at >< at > HAVE_CC="yes" fi -if [ "${EXECSUFFIX}" = "" ]; then -EXECSUFFIX="" -for OUTFILE in conftest.exe conftest conftest.*; do -if [ -f $OUTFILE ]; then -case $OUTFILE in -*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) -;; -*.* ) -EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` -break ;; -* ) -break ;; -esac; - fi -done -if [ "$EXECSUFFIX" != "" ]; then -echo "Detected executable suffix: $EXECSUFFIX" >> config.log -fi +if [ "${HAVE_CC}" = "yes" ]; then +if [ "${EXECSUFFIX}" = "" ]; then +EXECSUFFIX="" +for OUTFILE in conftest.exe conftest conftest.*; do +if [ -f $OUTFILE ]; then +case $OUTFILE in +*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) +;; +*.* ) +EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` +break ;; +* ) +break ;; +esac; + fi +done +if [ "$EXECSUFFIX" != "" ]; then +echo "Detected executable suffix: $EXECSUFFIX" >> config.log +fi EOF MkSaveMK('EXECSUFFIX'); MkSaveDefine('EXECSUFFIX'); print << 'EOF'; +fi fi rm -f conftest.c conftest$EXECSUFFIX TEST_CFLAGS="" fi EOF + +MkIfTrue('${HAVE_CC}'); -MkPrintN('checking for compiler warning options...'); -MkCompileC('HAVE_CC_WARNINGS', '-Wall -Werror', '', << 'EOF'); +MkPrintN('checking for compiler warning options...'); +MkCompileC('HAVE_CC_WARNINGS', '-Wall -Werror', '', << 'EOF'); int main(int argc, char *argv[]) { return (0); } EOF -MkIfTrue('${HAVE_CC_WARNINGS}'); -MkDefine('TEST_CFLAGS', '-Wall -Werror'); -MkEndif; +MkIfTrue('${HAVE_CC_WARNINGS}'); +MkDefine('TEST_CFLAGS', '-Wall -Werror'); +MkEndif; -# Check for floating point support. -# TODO representation -MkPrintN('checking for IEEE754 floating point...'); -MkCompileC('HAVE_IEEE754', '', '', << 'EOF'); +# Check for floating point support. +# TODO representation +MkPrintN('checking for IEEE754 floating point...'); +MkCompileC('HAVE_IEEE754', '', '', << 'EOF'); int main(int argc, char *argv[]) { < at >< at > -130,8 +134,8 < at >< at > } EOF -MkPrintN('checking aligned attribute...'); -TryCompileFlagsC('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking aligned attribute...'); +TryCompileFlagsC('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(int argc, char *argv[]) { struct s1 { int x,y,z; } __attribute__ ((aligned(16))); < at >< at > -139,8 +143,8 < at >< at > } EOF -MkPrintN('checking bounded attribute...'); -MkCompileC('HAVE_BOUNDED_ATTRIBUTE', '', '', << 'EOF'); +MkPrintN('checking bounded attribute...'); +MkCompileC('HAVE_BOUNDED_ATTRIBUTE', '', '', << 'EOF'); void foo(char *, int) __attribute__ ((__bounded__(__string__,1,2))); void foo(char *a, int c) { } int main(int argc, char *argv[]) < at >< at > -151,8 +155,8 < at >< at > } EOF -MkPrintN('checking const attribute...'); -TryCompileFlagsC('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking const attribute...'); +TryCompileFlagsC('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((const)); int foo(int x) { return (x*x); } int main(int argc, char *argv[]) < at >< at > -162,8 +166,8 < at >< at > } EOF -MkPrintN('checking deprecated attribute...'); -TryCompileFlagsC('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking deprecated attribute...'); +TryCompileFlagsC('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); void foo(void) __attribute__ ((deprecated)); void foo(void) { } < at >< at > -174,8 +178,8 < at >< at > } EOF -MkPrintN('checking format attribute...'); -MkCompileC('HAVE_FORMAT_ATTRIBUTE', '', '', << 'EOF'); +MkPrintN('checking format attribute...'); +MkCompileC('HAVE_FORMAT_ATTRIBUTE', '', '', << 'EOF'); #include <stdarg.h> void foo1(char *, ...) __attribute__((__format__ (printf, 1, 2))); < at >< at > -192,8 +196,8 < at >< at > } EOF -MkPrintN('checking nonnull attribute...'); -TryCompileFlagsC('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking nonnull attribute...'); +TryCompileFlagsC('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); void foo(char *) __attribute__((__nonnull__ (1))); void foo(char *a) { } int main(int argc, char *argv[]) < at >< at > -203,8 +207,8 < at >< at > } EOF -MkPrintN('checking noreturn attribute...'); -TryCompileFlagsC('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking noreturn attribute...'); +TryCompileFlagsC('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); #include <unistd.h> #include <stdlib.h> void foo(void) __attribute__ ((noreturn)); < at >< at > -215,8 +219,8 < at >< at > } EOF -MkPrintN('checking packed attribute...'); -TryCompileFlagsC('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking packed attribute...'); +TryCompileFlagsC('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(int argc, char *argv[]) { struct s1 { char c; int x,y,z; } __attribute__ ((packed)); < at >< at > -224,8 +228,8 < at >< at > } EOF -MkPrintN('checking pure attribute...'); -TryCompileFlagsC('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking pure attribute...'); +TryCompileFlagsC('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((pure)); int foo(int x) { return (x*x); } int main(int argc, char *argv[]) < at >< at > -235,8 +239,8 < at >< at > } EOF -MkPrintN('checking warn_unused_result attribute...'); -TryCompileFlagsC('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking warn_unused_result attribute...'); +TryCompileFlagsC('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); int foo(void) __attribute__ ((warn_unused_result)); int foo(void) { return (1); } int main(int argc, char *argv[]) < at >< at > -246,9 +250,9 < at >< at > } EOF -# Check for long double type. -MkPrintN('checking for long double...'); -TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); +# Check for long double type. +MkPrintN('checking for long double...'); +TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); int main(int argc, char *argv[]) { < at >< at > -258,9 +262,9 < at >< at > } EOF -# Check for long long type. -MkPrintN('checking for long long...'); -TryCompile('HAVE_LONG_LONG', << 'EOF'); +# Check for long long type. +MkPrintN('checking for long long...'); +TryCompile('HAVE_LONG_LONG', << 'EOF'); int main(int argc, char *argv[]) { < at >< at > -271,8 +275,8 < at >< at > } EOF -MkPrintN('checking for cygwin environment...'); -TryCompileFlagsC('HAVE_CYGWIN', '-mcygwin', << 'EOF'); +MkPrintN('checking for cygwin environment...'); +TryCompileFlagsC('HAVE_CYGWIN', '-mcygwin', << 'EOF'); #include <sys/types.h> #include <sys/stat.h> #include <windows.h> < at >< at > -287,25 +291,27 < at >< at > } EOF -MkPrintN('checking for libtool --tag=CC retardation...'); -my $code = << 'EOF'; +MkPrintN('checking for libtool --tag=CC retardation...'); +my $code = << 'EOF'; EOF -print 'cat << EOT > conftest.c', "\n", - 'int main(int argc, char *argv[]) { return (0); }', "\nEOT\n"; -print << "EOF"; +print 'cat << EOT > conftest.c', "\n", + 'int main(int argc, char *argv[]) { return (0); }', "\nEOT\n"; +print << "EOF"; \$LIBTOOL --quiet --mode=compile --tag=CC \$CC \$CFLAGS \$TEST_CFLAGS -o \$testdir/conftest.o conftest.c 2>>config.log EOF -MkIf('"$?" = "0"'); -MkPrint('yes'); -MkDefine('LIBTOOLOPTS_CC', '--tag=CC'); -MkElse; -MkPrint('no'); -MkEndif; -MkSaveMK('LIBTOOLOPTS_CC'); -print 'rm -f conftest.c $testdir/conftest$EXECSUFFIX', "\n"; +MkIf('"$?" = "0"'); +MkPrint('yes'); +MkDefine('LIBTOOLOPTS_CC', '--tag=CC'); +MkElse; +MkPrint('no'); +MkEndif; +MkSaveMK('LIBTOOLOPTS_CC'); +print 'rm -f conftest.c $testdir/conftest$EXECSUFFIX', "\n"; -# Preserve ${CC} and ${CFLAGS} -MkSaveMK('CC', 'CFLAGS'); +# Preserve ${CC} and ${CFLAGS} +MkSaveMK('CC', 'CFLAGS'); + +MkEndif; # HAVE_CC } sub Emul Modified: trunk/BSDBuild/cxx.pm =================================================================== --- trunk/BSDBuild/cxx.pm2012-07-11 13:11:10 UTC (rev 956) +++ trunk/BSDBuild/cxx.pm2012-07-13 10:46:06 UTC (rev 957) < at >< at > -1,6 +1,6 < at >< at > # vim:ts=4 # -# Copyright (c) 2002-2010 Hypertriton, Inc. <http://hypertriton.com/> +# Copyright (c) 2002-2012 Hypertriton, Inc. <http://hypertriton.com/> # All rights reserved. # # Redistribution and use in source and binary forms, with or without < at >< at > -69,8 +69,8 < at >< at > EOT $CXX -o conftest conftest.cc -lstdc++ 2>>config.log if [ $? != 0 ]; then - echo "no, the test failed to compile" - echo "no, the test failed to compile" >> config.log + echo "no" + echo "no (test failed to compile)" >> config.log HAVE_CXX="no" else echo "yes" < at >< at > -78,45 +78,49 < at >< at > HAVE_CXX="yes" fi -if [ "${EXECSUFFIX}" = "" ]; then -EXECSUFFIX="" -for OUTFILE in conftest.exe conftest conftest.*; do -if [ -f $OUTFILE ]; then -case $OUTFILE in -*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) -;; -*.* ) -EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` -break ;; -* ) -break ;; -esac; - fi -done -if [ "$EXECSUFFIX" != "" ]; then -echo "Detected executable suffix: $EXECSUFFIX" >> config.log -fi +if [ "${HAVE_CXX}" = "yes" ]; then +if [ "${EXECSUFFIX}" = "" ]; then +EXECSUFFIX="" +for OUTFILE in conftest.exe conftest conftest.*; do +if [ -f $OUTFILE ]; then +case $OUTFILE in +*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) +;; +*.* ) +EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` +break ;; +* ) +break ;; +esac; + fi +done +if [ "$EXECSUFFIX" != "" ]; then +echo "Detected executable suffix: $EXECSUFFIX" >> config.log +fi EOF MkSaveMK('EXECSUFFIX'); MkSaveDefine('EXECSUFFIX'); print << 'EOF'; +fi fi rm -f conftest.cc conftest$EXECSUFFIX TEST_CXXFLAGS="" fi EOF -MkPrintN('checking for c++ compiler warning options...'); -MkCompileCXX('HAVE_CXX_WARNINGS', '-Wall -Werror', '-lstdc++', << 'EOF'); +MkIfTrue('${HAVE_CXX}'); + +MkPrintN('checking for c++ compiler warning options...'); +MkCompileCXX('HAVE_CXX_WARNINGS', '-Wall -Werror', '-lstdc++', << 'EOF'); int main(void) { return (0); } EOF -MkIfTrue('${HAVE_CXX_WARNINGS}'); -MkDefine('TEST_CXXFLAGS', '-Wall -Werror'); -MkEndif; +MkIfTrue('${HAVE_CXX_WARNINGS}'); +MkDefine('TEST_CXXFLAGS', '-Wall -Werror'); +MkEndif; -MkPrintN('checking aligned attribute in c++...'); -TryCompileFlagsCXX('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking aligned attribute in c++...'); +TryCompileFlagsCXX('HAVE_ALIGNED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(void) { struct s1 { int x,y,z; } __attribute__ ((aligned(16))); < at >< at > -124,8 +128,8 < at >< at > } EOF -MkPrintN('checking bounded attribute in c++...'); -MkCompileCXX('HAVE_BOUNDED_ATTRIBUTE', '', '-lstdc++', << 'EOF'); +MkPrintN('checking bounded attribute in c++...'); +MkCompileCXX('HAVE_BOUNDED_ATTRIBUTE', '', '-lstdc++', << 'EOF'); void foo(char *, int) __attribute__ ((__bounded__(__string__,1,2))); void foo(char *a, int c) { } int main(void) < at >< at > -136,8 +140,8 < at >< at > } EOF -MkPrintN('checking const attribute in c++...'); -TryCompileFlagsCXX('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking const attribute in c++...'); +TryCompileFlagsCXX('HAVE_CONST_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((const)); int foo(int x) { return (x*x); } int main(void) < at >< at > -147,8 +151,8 < at >< at > } EOF -MkPrintN('checking deprecated attribute in c++...'); -TryCompileFlagsCXX('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking deprecated attribute in c++...'); +TryCompileFlagsCXX('HAVE_DEPRECATED_ATTRIBUTE', '', << 'EOF'); void foo(void) __attribute__ ((deprecated)); void foo(void) { } < at >< at > -159,8 +163,8 < at >< at > } EOF -MkPrintN('checking format attribute in c++...'); -MkCompileCXX('HAVE_FORMAT_ATTRIBUTE', '', '-lstdc++', << 'EOF'); +MkPrintN('checking format attribute in c++...'); +MkCompileCXX('HAVE_FORMAT_ATTRIBUTE', '', '-lstdc++', << 'EOF'); #include <stdarg.h> void foo1(char *, ...) __attribute__((__format__ (printf, 1, 2))); < at >< at > -177,8 +181,8 < at >< at > } EOF -MkPrintN('checking nonnull attribute in c++...'); -TryCompileFlagsCXX('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking nonnull attribute in c++...'); +TryCompileFlagsCXX('HAVE_NONNULL_ATTRIBUTE', '-Wall -Werror', << 'EOF'); void foo(char *) __attribute__((__nonnull__ (1))); void foo(char *a) { } int main(void) < at >< at > -188,8 +192,8 < at >< at > } EOF -MkPrintN('checking noreturn attribute in c++...'); -TryCompileFlagsCXX('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking noreturn attribute in c++...'); +TryCompileFlagsCXX('HAVE_NORETURN_ATTRIBUTE', '', << 'EOF'); #include <unistd.h> #include <stdlib.h> void foo(void) __attribute__ ((noreturn)); < at >< at > -200,8 +204,8 < at >< at > } EOF -MkPrintN('checking packed attribute in c++...'); -TryCompileFlagsCXX('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); +MkPrintN('checking packed attribute in c++...'); +TryCompileFlagsCXX('HAVE_PACKED_ATTRIBUTE', '-Wall -Werror', << 'EOF'); int main(void) { struct s1 { char c; int x,y,z; } __attribute__ ((packed)); < at >< at > -209,8 +213,8 < at >< at > } EOF -MkPrintN('checking pure attribute in c++...'); -TryCompileFlagsCXX('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking pure attribute in c++...'); +TryCompileFlagsCXX('HAVE_PURE_ATTRIBUTE', '', << 'EOF'); int foo(int) __attribute__ ((pure)); int foo(int x) { return (x*x); } int main(void) < at >< at > -220,8 +224,8 < at >< at > } EOF -MkPrintN('checking warn_unused_result attribute in c++...'); -TryCompileFlagsCXX('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); +MkPrintN('checking warn_unused_result attribute in c++...'); +TryCompileFlagsCXX('HAVE_WARN_UNUSED_RESULT_ATTRIBUTE', '', << 'EOF'); int foo(void) __attribute__ ((warn_unused_result)); int foo(void) { return (1); } int main(void) < at >< at > -231,9 +235,9 < at >< at > } EOF -# Check for long double type. -MkPrintN('checking for long double...'); -TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); +# Check for long double type. +MkPrintN('checking for long double...'); +TryCompile('HAVE_LONG_DOUBLE', << 'EOF'); int main(void) { < at >< at > -244,9 +248,9 < at >< at > } EOF -# Check for long long type. -MkPrintN('checking for long long...'); -TryCompile('HAVE_LONG_LONG', << 'EOF'); +# Check for long long type. +MkPrintN('checking for long long...'); +TryCompile('HAVE_LONG_LONG', << 'EOF'); int main(void) { < at >< at > -258,8 +262,8 < at >< at > } EOF -MkPrintN('checking for cygwin environment...'); -TryCompileFlagsCXX('HAVE_CYGWIN', '-mcygwin', << 'EOF'); +MkPrintN('checking for cygwin environment...'); +TryCompileFlagsCXX('HAVE_CYGWIN', '-mcygwin', << 'EOF'); #include <sys/types.h> #include <sys/stat.h> #include <windows.h> < at >< at > -274,11 +278,9 < at >< at > } EOF -MkPrintN('checking for libtool --tag=CXX retardation...'); -my $code = << 'EOF'; -EOF -print 'cat << EOT > conftest.cc', "\n"; -print << 'EOF'; +MkPrintN('checking for libtool --tag=CXX retardation...'); +print 'cat << EOT > conftest.cc', "\n"; +print << 'EOF'; #include <iostream> int main(void) { std::cout << "Hello world!" << std::endl; return 0; } EOT < at >< at > -286,17 +288,19 < at >< at > print << "EOF"; \$LIBTOOL --quiet --mode=compile --tag=CXX \$CXX \$CXXFLAGS \$TEST_CXXFLAGS -o \$testdir/conftest.o conftest.cc 2>>config.log EOF -MkIf('"$?" = "0"'); -MkPrint('yes'); -MkDefine('LIBTOOLOPTS_CXX', '--tag=CXX'); -MkElse; -MkPrint('no'); -MkEndif; -MkSaveMK('LIBTOOLOPTS_CXX'); -print 'rm -f conftest.cc $testdir/conftest$EXECSUFFIX', "\n"; +MkIf('"$?" = "0"'); +MkPrint('yes'); +MkDefine('LIBTOOLOPTS_CXX', '--tag=CXX'); +MkElse; +MkPrint('no'); +MkEndif; +MkSaveMK('LIBTOOLOPTS_CXX'); +print 'rm -f conftest.cc $testdir/conftest$EXECSUFFIX', "\n"; -# Preserve ${CXX} and ${CXXFLAGS} -MkSaveMK('CXX', 'CXXFLAGS'); +# Preserve ${CXX} and ${CXXFLAGS} +MkSaveMK('CXX', 'CXXFLAGS'); + +MkEndif; # HAVE_CXX } sub Emul Modified: trunk/BSDBuild/objc.pm =================================================================== --- trunk/BSDBuild/objc.pm2012-07-11 13:11:10 UTC (rev 956) +++ trunk/BSDBuild/objc.pm2012-07-13 10:46:06 UTC (rev 957) < at >< at > -76,72 +76,77 < at >< at > EOT $OBJC -x objective-c -o conftest conftest.m 2>>config.log if [ $? != 0 ]; then - echo "no, the test failed to compile" - echo "no, the test failed to compile" >> config.log + echo "no" + echo "no (test failed to compile)" >> config.log HAVE_OBJC="no" else echo "yes" echo "yes" >> config.log HAVE_OBJC="yes" fi - -if [ "${EXECSUFFIX}" = "" ]; then -EXECSUFFIX="" -for OUTFILE in conftest.exe conftest conftest.*; do -if [ -f $OUTFILE ]; then -case $OUTFILE in -*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) -;; -*.* ) -EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` -break ;; -* ) -break ;; -esac; - fi -done -if [ "$EXECSUFFIX" != "" ]; then -echo "Detected executable suffix: $EXECSUFFIX" >> config.log -fi + +if [ "${HAVE_OBJC}" = "yes" ]; then +if [ "${EXECSUFFIX}" = "" ]; then +EXECSUFFIX="" +for OUTFILE in conftest.exe conftest conftest.*; do +if [ -f $OUTFILE ]; then +case $OUTFILE in +*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM ) +;; +*.* ) +EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'` +break ;; +* ) +break ;; +esac; + fi +done +if [ "$EXECSUFFIX" != "" ]; then +echo "Detected executable suffix: $EXECSUFFIX" >> config.log +fi EOF MkSaveMK('EXECSUFFIX'); MkSaveDefine('EXECSUFFIX'); print << 'EOF'; +fi fi rm -f conftest.m conftest$EXECSUFFIX TEST_OBJCFLAGS="" fi EOF - -MkPrintN('checking for compiler warning options...'); -MkCompileOBJC('HAVE_OBJC_WARNINGS', '-Wall -Werror', '', << 'EOF'); + +MkIfTrue('${HAVE_OBJC}'); +MkPrintN('checking for compiler warning options...'); +MkCompileOBJC('HAVE_OBJC_WARNINGS', '-Wall -Werror', '', << 'EOF'); int main(int argc, char *argv[]) { return (0); } EOF -MkIfTrue('${HAVE_OBJC_WARNINGS}'); -MkDefine('TEST_OBJCFLAGS', '-Wall -Werror'); -MkEndif; +MkIfTrue('${HAVE_OBJC_WARNINGS}'); +MkDefine('TEST_OBJCFLAGS', '-Wall -Werror'); +MkEndif; -MkPrintN('checking for libtool --tag=OBJC retardation...'); -my $code = << 'EOF'; +MkPrintN('checking for libtool --tag=OBJC retardation...'); +my $code = << 'EOF'; EOF -print 'cat << EOT > conftest.m', "\n", - 'int main(int argc, char *argv[]) { return (0); }', "\nEOT\n"; -print << "EOF"; +print 'cat << EOT > conftest.m', "\n", + 'int main(int argc, char *argv[]) { return (0); }', "\nEOT\n"; +print << "EOF"; \$LIBTOOL --quiet --mode=compile --tag=OBJC \$OBJC \$CFLAGS \$OBJCFLAGS \$TEST_OBJCFLAGS -o \$testdir/conftest.o conftest.m 2>>config.log EOF -MkIf('"$?" = "0"'); -MkPrint('yes'); -MkDefine('LIBTOOLOPTS_OBJC', '--tag=OBJC'); -MkElse; -MkPrint('no'); -MkEndif; -MkSaveMK('LIBTOOLOPTS_OBJC'); -print 'rm -f conftest.m $testdir/conftest$EXECSUFFIX', "\n"; +MkIf('"$?" = "0"'); +MkPrint('yes'); +MkDefine('LIBTOOLOPTS_OBJC', '--tag=OBJC'); +MkElse; +MkPrint('no'); +MkEndif; +MkSaveMK('LIBTOOLOPTS_OBJC'); +print 'rm -f conftest.m $testdir/conftest$EXECSUFFIX', "\n"; -# Preserve ${OBJC} and ${OBJCFLAGS} -MkSaveMK('OBJC', 'OBJCFLAGS'); +# Preserve ${OBJC} and ${OBJCFLAGS} +MkSaveMK('OBJC', 'OBJCFLAGS'); + +MkEndif; # HAVE_OBJC } sub Emul [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-11 09:11:10 -0400 (Wed, 11 Jul 2012) New Revision: 956 Modified: trunk/BSDBuild/cocoa.pm Log: remove Carbon Modified: trunk/BSDBuild/cocoa.pm =================================================================== --- ... [More] trunk/BSDBuild/cocoa.pm2012-07-11 13:10:50 UTC (rev 955) +++ trunk/BSDBuild/cocoa.pm2012-07-11 13:11:10 UTC (rev 956) < at >< at > -34,7 +34,6 < at >< at > MkDefine('COCOA_LIBS', '-lobjc '. '-Wl,-framework,Cocoa ' . '-Wl,-framework,OpenGL ' . - '-Wl,-framework,Carbon ' . '-Wl,-framework,IOKit'); MkCompileOBJC('HAVE_COCOA', '${COCOA_CFLAGS}', '${COCOA_LIBS}', << 'EOF'); < at >< at > -75,7 +74,6 < at >< at > MkDefine('COCOA_LIBS', '-lobjc '. '-Wl,-framework,Cocoa ' . '-Wl,-framework,OpenGL ' . - '-Wl,-framework,Carbon ' . '-Wl,-framework,IOKit'); MkSave('HAVE_COCOA', 'COCOA_CFLAGS', 'COCOA_LIBS'); } else { [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-11 09:10:50 -0400 (Wed, 11 Jul 2012) New Revision: 955 Modified: trunk/mkconcurrent.pl Log: honor ${OBJC} in libtool link Modified: trunk/mkconcurrent.pl ... [More] =================================================================== --- trunk/mkconcurrent.pl2012-07-04 06:25:33 UTC (rev 954) +++ trunk/mkconcurrent.pl2012-07-11 13:10:50 UTC (rev 955) < at >< at > -228,7 +228,7 < at >< at > push < at >deps, "$shobj: $SRC/$ndir/$src"; push < at >deps, << 'EOF'; -${LIBTOOL} --mode=compile ${CC} ${LIBTOOLFLAGS} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c $< +${LIBTOOL} --mode=compile ${OBJC} ${LIBTOOLFLAGS} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c $< EOF } else { [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-04 02:25:33 -0400 (Wed, 04 Jul 2012) New Revision: 954 Modified: trunk/build.lib.mk trunk/build.prog.mk trunk/mkconcurrent.pl trunk/mkconfigure.pl Log: allow conditional substitutions in ${SRCS} under ... [More] separate builds (have mkconcurrent parse variables and execute it only after Makefile.config has been generated). Modified: trunk/build.lib.mk =================================================================== --- trunk/build.lib.mk2012-07-04 06:21:59 UTC (rev 953) trunk/build.lib.mk2012-07-04 06:25:33 UTC (rev 954) < at >< at > -42,7 42,7 < at >< at > CFLAGS?= CPPFLAGS?= CXXFLAGS?= -OBJCFLAGS?=${CFLAGS} OBJCFLAGS?= ASMFLAGS?=-g -w-orphan-labels LFLAGS?= LIBL?=-ll < at >< at > -106,12 106,12 < at >< at > # Compile Objective-C code into an object file .m.o: -${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< ${OBJC} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.lo: ${LIBTOOL} ${LIBTOOL} ${LIBTOOLOPTS} ${LIBTOOLOPTS_OBJC} --mode=compile \ - ${OBJC} ${LIBTOOLFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< ${OBJC} ${LIBTOOLFLAGS} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.po: -${OBJC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< ${OBJC} -pg -DPROF ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< # Compile C code into an object file .cc.o: Modified: trunk/build.prog.mk =================================================================== --- trunk/build.prog.mk2012-07-04 06:21:59 UTC (rev 953) trunk/build.prog.mk2012-07-04 06:25:33 UTC (rev 954) < at >< at > -41,7 41,7 < at >< at > CFLAGS?=-O2 -g CPPFLAGS?= CXXFLAGS?= -OBJCFLAGS?=${CFLAGS} OBJCFLAGS?= ASMFLAGS?=-g -w-orphan-labels LFLAGS?= LIBL?=-ll < at >< at > -93,9 93,9 < at >< at > # Compile Objective-C code into an object file .m.o: -${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< ${OBJC} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.po: -${OBJC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< ${OBJC} -pg -DPROF ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< # Compile assembly code into an object file .asm.o: Modified: trunk/mkconcurrent.pl =================================================================== --- trunk/mkconcurrent.pl2012-07-04 06:21:59 UTC (rev 953) trunk/mkconcurrent.pl2012-07-04 06:25:33 UTC (rev 954) < at >< at > -51,24 51,24 < at >< at > '^gen-declspecs\.pl$', '^install-manpages\.sh$', ); my %V = (); sub Debug { print STDERR < at >_, "\n"; } -sub ConvertMakefile # Return a Makefile's contents, with lines expanded and variables substituted. sub ProcessedMakefile ($$) { -my ($dir, $ndir, $ent) = < at >_; my $path = shift; my $dir = shift; -open(SRCMAKEFILE, "$dir/$ent") || - die "src: $dir/$ent: $!"; -open(DSTMAKEFILE, ">$BUILD/$ndir/$ent") || - die "dest: $BUILD/$ndir/$ent: $!"; - if (!open(MF, $path)) { return (); } my < at >lines = (); -my $line = ''; -foreach $_ (<SRCMAKEFILE>) { foreach $_ (<MF>) { chop; if (/^(. )\\$/) {# Expansion < at >< at > -82,7 82,55 < at >< at > } } } foreach $_ (< at >lines) { if (/^\s*#/) { next; } if (/^\t/) { next; } s/\$\{(\w )\}/$V{$1}/g; if (/^\s*(\w )\s*=\s*"(. )"$/ || /^\s*(\w )\s*=\s*(. )$/) { $V{$1} = $2; } elsif (/^\s*(\w )\s*\ =\s*"(. )"$/ || /^\s*(\w )\s*\ =\s*(. )$/) { if (exists($V{$1}) && $V{$1} ne '') { $V{$1} .= ' '.$2; } else { $V{$1} = $2; } } if (/^\s*include\s (. )$/) { my $incl = $1; if ($incl =~ /Makefile\.config$/) { # Special case: configure-generated file ProcessedMakefile($BUILD.'/'.$dir.'/'.$incl, $BUILD); } else { ProcessedMakefile($dir.'/'.$incl, $dir); } } } close(MF); #if (open(FOUT, ">>processed.txt")) { #print FOUT "======================= $path (in $dir) ====================================\n"; #print FOUT join("\n", < at >lines), "\n"; #close(FOUT); #} return (< at >lines); } sub ConvertMakefile { my ($dir, $ndir, $ent) = < at >_; my < at >lines; open(DSTMAKEFILE, ">$BUILD/$ndir/$ent") || die "dest: $BUILD/$ndir/$ent: $!"; %V = (); < at >lines = ProcessedMakefile($dir.'/'.$ent, $dir); unless (< at >lines) { return; } print DSTMAKEFILE << "EOF"; # # This file was automatically generated by mkconcurrent.pl (BSDbuild) < at >< at > -180,14 228,14 < at >< at > push < at >deps, "$shobj: $SRC/$ndir/$src"; push < at >deps, << 'EOF'; -${LIBTOOL} --mode=compile ${CC} ${LIBTOOLFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c $< ${LIBTOOL} --mode=compile ${CC} ${LIBTOOLFLAGS} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c $< EOF } else { push < at >deps, "$obj: $SRC/$ndir/$src"; push < at >deps, << 'EOF', -${CC} ${OBJCFLAGS} ${CPPFLAGS} -c $< ${CC} ${CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -c $< EOF } < at >< at > -290,7 338,6 < at >< at > } close(DSTMAKEFILE); -close(SRCMAKEFILE); # Prevent make from complaining. open(DSTDEPEND, ">$BUILD/$ndir/.depend") or Modified: trunk/mkconfigure.pl =================================================================== --- trunk/mkconfigure.pl2012-07-04 06:21:59 UTC (rev 953) trunk/mkconfigure.pl2012-07-04 06:25:33 UTC (rev 954) < at >< at > -1061,12 1061,7 < at >< at > echo "*" exit 1 fi -echo "* Separate build (source in ${srcdir})" SRC=${srcdir} -${PERL} ${SRC}/mk/mkconcurrent.pl ${SRC} -if [ $? != 0 ]; then -exit 1; -fi else SRC=`pwd` fi < at >< at > -1350,3 1345,17 < at >< at > } } print << 'EOF'; if [ "${srcdir}" != "" ]; then $ECHO_N "* Source is in ${srcdir}. Generating Makefiles..." ${PERL} ${SRC}/mk/mkconcurrent.pl ${SRC} if [ $? != 0 ]; then exit 1; fi echo "done" fi echo "*" echo "* Configuration successful. Use \"make depend all\" to compile," echo "* and \"make install\" to install this software under $PREFIX." echo "*" EOF [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-04 02:21:59 -0400 (Wed, 04 Jul 2012) New Revision: 953 Modified: trunk/BSDBuild/cocoa.pm Log: add -framework OpenGL Modified: trunk/BSDBuild/cocoa.pm ... [More] =================================================================== --- trunk/BSDBuild/cocoa.pm2012-07-04 06:21:40 UTC (rev 952) +++ trunk/BSDBuild/cocoa.pm2012-07-04 06:21:59 UTC (rev 953) < at >< at > -33,6 +33,7 < at >< at > '-fpascal-strings'); MkDefine('COCOA_LIBS', '-lobjc '. '-Wl,-framework,Cocoa ' . + '-Wl,-framework,OpenGL ' . '-Wl,-framework,Carbon ' . '-Wl,-framework,IOKit'); < at >< at > -73,6 +74,7 < at >< at > '-fpascal-strings'); MkDefine('COCOA_LIBS', '-lobjc '. '-Wl,-framework,Cocoa ' . + '-Wl,-framework,OpenGL ' . '-Wl,-framework,Carbon ' . '-Wl,-framework,IOKit'); MkSave('HAVE_COCOA', 'COCOA_CFLAGS', 'COCOA_LIBS'); [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-04 02:21:40 -0400 (Wed, 04 Jul 2012) New Revision: 952 Modified: trunk/BSDBuild/Builtins.pm Log: silence "libtool --version" error output Modified: trunk/BSDBuild/Builtins.pm ... [More] =================================================================== --- trunk/BSDBuild/Builtins.pm2012-07-03 07:13:50 UTC (rev 951) +++ trunk/BSDBuild/Builtins.pm2012-07-04 06:21:40 UTC (rev 952) < at >< at > -161,7 +161,7 < at >< at > LIBTOOL_BUNDLED="yes" LIBTOOL=\${TOP}/mk/libtool/libtool else -if [ "`libtool --version |grep GNU`" = "" ]; then +if [ "`libtool --version 2>/dev/null |grep GNU`" = "" ]; then LIBTOOL_BUNDLED="yes" LIBTOOL=\${TOP}/mk/libtool/libtool else [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-03 00:26:32 -0400 (Tue, 03 Jul 2012) New Revision: 948 Modified: trunk/build.lib.mk trunk/build.prog.mk Log: recognize ${OBJC} separately from ${CC} Modified: trunk/build.lib.mk ... [More] =================================================================== --- trunk/build.lib.mk2012-07-03 04:20:43 UTC (rev 947) +++ trunk/build.lib.mk2012-07-03 04:26:32 UTC (rev 948) < at >< at > -1,5 +1,5 < at >< at > # -# Copyright (c) 2001-2011 Hypertriton, Inc. <http://hypertriton.com/> +# Copyright (c) 2001-2012 Hypertriton, Inc. <http://hypertriton.com/> # All rights reserved. # # Redistribution and use in source and binary forms, with or without < at >< at > -30,6 +30,8 < at >< at > WINRES?= CC?=cc +OBJC?=cc +CXX?=c++ ASM?=nasm LEX?=lex YACC?=yacc < at >< at > -65,6 +67,7 < at >< at > LIBTOOLFLAGS?= LIBTOOLOPTS?=--quiet LIBTOOLOPTS_CC?= +LIBTOOLOPTS_OBJC?= LIBTOOLOPTS_CXX?= SHARE?=none < at >< at > -103,12 +106,12 < at >< at > # Compile Objective-C code into an object file .m.o: -${CC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< +${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.lo: ${LIBTOOL} -${LIBTOOL} ${LIBTOOLOPTS} ${LIBTOOLOPTS_CC} --mode=compile \ - ${CC} ${LIBTOOLFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< +${LIBTOOL} ${LIBTOOLOPTS} ${LIBTOOLOPTS_OBJC} --mode=compile \ + ${OBJC} ${LIBTOOLFLAGS} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.po: -${CC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< +${OBJC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< # Compile C++ code into an object file .cc.o: < at >< at > -516,8 +519,8 < at >< at > < at >if [ "${LIB}" != "" -a "${USE_LIBTOOL}" = "Yes" \ -a "${LIBTOOL_BUNDLED}" = "yes" ]; then \ echo "${SH} ${LTCONFIG} ${LTMAIN_SH} ${HOST}"; \ - env CC="${CC}" CXX="${CXX}" \ - CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \ + env CC="${CC}" OBJC="${OBJC}" CXX="${CXX}" \ + CFLAGS="${CFLAGS}" OBJCFLAGS="${OBJCFLAGS}" CXXFLAGS="${CXXFLAGS}" \ ${SH} ${LTCONFIG} ${LTMAIN_SH} ${HOST}; \ if [ $? != 0 ]; then \ echo "${LTCONFIG} failed"; \ Modified: trunk/build.prog.mk =================================================================== --- trunk/build.prog.mk2012-07-03 04:20:43 UTC (rev 947) +++ trunk/build.prog.mk2012-07-03 04:26:32 UTC (rev 948) < at >< at > -31,6 +31,8 < at >< at > WINRES?= CC?=cc +OBJC?=cc +CXX?=c++ ASM?=nasm LEX?=lex YACC?=yacc < at >< at > -89,11 +91,11 < at >< at > .cpp.po: ${CXX} -pg -DPROF ${CXXFLAGS} ${CPPFLAGS} -o $< at > -c $< -# Compile C+Objective-C code into an object file +# Compile Objective-C code into an object file .m.o: -${CC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< +${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< .m.po: -${CC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< +${OBJC} -pg -DPROF ${OBJCFLAGS} ${CPPFLAGS} -o $< at > -c $< # Compile assembly code into an object file .asm.o: [Less]
Posted over 12 years ago by BSDBuild-SVN
Author: vedge Date: 2012-07-03 00:20:43 -0400 (Tue, 03 Jul 2012) New Revision: 947 Added: trunk/BSDBuild/cocoa.pm Log: test for MacOSX Cocoa framework Added: trunk/BSDBuild/cocoa.pm ... [More] =================================================================== --- trunk/BSDBuild/cocoa.pm (rev 0) +++ trunk/BSDBuild/cocoa.pm2012-07-03 04:20:43 UTC (rev 947) < at >< at > -0,0 +1,93 < at >< at > +# vim:ts=4 +# +# Copyright (c) 2012 Hypertriton Inc. <http://hypertriton.com/> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution.. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.. + +sub Test +{ +my ($ver, $pfx) = < at >_; + +MkDefine('COCOA_CFLAGS', '-DTARGET_API_MAC_CARBON ' . + '-DTARGET_API_MAC_OSX ' . + '-falign-loops=16 -force_cpusubtype_ALL '. + '-fpascal-strings'); +MkDefine('COCOA_LIBS', '-lobjc '. + '-Wl,framework,Cocoa ' . + '-Wl,framework,Carbon ' . + '-Wl,framework,IOKit'); + +MkCompileOBJC('HAVE_COCOA', '${COCOA_CFLAGS}', '${COCOA_LIBS}', << 'EOF'); +#import <Cocoa/Cocoa.h> +EOF +MkSaveIfTrue('${HAVE_COCOA}', 'COCOA_CFLAGS', 'COCOA_LIBS'); +return (0); +} + +sub Link +{ +my $lib = shift; + +if ($lib ne 'Cocoa') { +return (0); +} +PmIfHDefined('HAVE_COCOA'); +if ($EmulEnv =~ /^cb-/) { +PmIncludePath('$(#Cocoa.include)'); +PmLibPath('$(#Cocoa.lib)'); +} +PmEndif; +return (1); +} + +sub Emul +{ +my ($os, $osrel, $machine) = < at >_; + +if ($os eq 'darwin') { +MkDefine('HAVE_COCOA', 'yes'); +MkDefine('COCOA_CFLAGS', '-DTARGET_API_MAC_CARBON ' . + '-DTARGET_API_MAC_OSX ' . + '-falign-loops=16 -force_cpusubtype_ALL '. + '-fpascal-strings'); +MkDefine('COCOA_LIBS', '-lobjc '. + '-Wl,framework,Cocoa ' . + '-Wl,framework,Carbon ' . + '-Wl,framework,IOKit'); +MkSave('HAVE_COCOA', 'COCOA_CFLAGS', 'COCOA_LIBS'); +} else { +MkDefine('HAVE_COCOA', 'no'); +MkSaveUndef('HAVE_COCOA', 'COCOA_CFLAGS', 'COCOA_LIBS'); +} +return (1); +} + +BEGIN +{ +$DESCR{'cocoa'} = 'the Cocoa framework'; +$TESTS{'cocoa'} = \&Test; +$LINK{'cocoa'} = \&Link; +$EMUL{'cocoa'} = \&Emul; +$DEPS{'cocoa'} = 'objc'; +} + +;1 [Less]