1ee67461eSJoseph Mingrone /* 2ee67461eSJoseph Mingrone * Copyright (c) 1994, 1995, 1996 3ee67461eSJoseph Mingrone * The Regents of the University of California. All rights reserved. 4ee67461eSJoseph Mingrone * 5ee67461eSJoseph Mingrone * Redistribution and use in source and binary forms, with or without 6ee67461eSJoseph Mingrone * modification, are permitted provided that the following conditions 7ee67461eSJoseph Mingrone * are met: 8ee67461eSJoseph Mingrone * 1. Redistributions of source code must retain the above copyright 9ee67461eSJoseph Mingrone * notice, this list of conditions and the following disclaimer. 10ee67461eSJoseph Mingrone * 2. Redistributions in binary form must reproduce the above copyright 11ee67461eSJoseph Mingrone * notice, this list of conditions and the following disclaimer in the 12ee67461eSJoseph Mingrone * documentation and/or other materials provided with the distribution. 13ee67461eSJoseph Mingrone * 3. All advertising materials mentioning features or use of this software 14ee67461eSJoseph Mingrone * must display the following acknowledgement: 15ee67461eSJoseph Mingrone * This product includes software developed by the Computer Systems 16ee67461eSJoseph Mingrone * Engineering Group at Lawrence Berkeley Laboratory. 17ee67461eSJoseph Mingrone * 4. Neither the name of the University nor of the Laboratory may be used 18ee67461eSJoseph Mingrone * to endorse or promote products derived from this software without 19ee67461eSJoseph Mingrone * specific prior written permission. 20ee67461eSJoseph Mingrone * 21ee67461eSJoseph Mingrone * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22ee67461eSJoseph Mingrone * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23ee67461eSJoseph Mingrone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24ee67461eSJoseph Mingrone * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25ee67461eSJoseph Mingrone * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26ee67461eSJoseph Mingrone * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27ee67461eSJoseph Mingrone * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28ee67461eSJoseph Mingrone * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29ee67461eSJoseph Mingrone * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30ee67461eSJoseph Mingrone * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31ee67461eSJoseph Mingrone * SUCH DAMAGE. 32ee67461eSJoseph Mingrone */ 33ee67461eSJoseph Mingrone 34ee67461eSJoseph Mingrone #ifndef ftmacros_h 35ee67461eSJoseph Mingrone #define ftmacros_h 36ee67461eSJoseph Mingrone 37ee67461eSJoseph Mingrone /* 38ee67461eSJoseph Mingrone * Define some feature test macros to make sure that everything we want 39ee67461eSJoseph Mingrone * to be declared gets declared. 40ee67461eSJoseph Mingrone * 41ee67461eSJoseph Mingrone * On some UN*Xes we need to force strtok_r() to be declared. 42ee67461eSJoseph Mingrone * We do *NOT* want to define _POSIX_C_SOURCE, as that tends 43ee67461eSJoseph Mingrone * to make non-POSIX APIs that we use unavailable. 44ee67461eSJoseph Mingrone * XXX - is there no portable way to say "please pollute the 45ee67461eSJoseph Mingrone * namespace to the maximum extent possible"? 46ee67461eSJoseph Mingrone */ 47ee67461eSJoseph Mingrone #if defined(sun) || defined(__sun) 48ee67461eSJoseph Mingrone /* 49ee67461eSJoseph Mingrone * On Solaris Clang defines __EXTENSIONS__ automatically. 50ee67461eSJoseph Mingrone */ 51ee67461eSJoseph Mingrone #ifndef __EXTENSIONS__ 52ee67461eSJoseph Mingrone #define __EXTENSIONS__ 53ee67461eSJoseph Mingrone #endif 54ee67461eSJoseph Mingrone 55ee67461eSJoseph Mingrone /* 56ee67461eSJoseph Mingrone * We also need to define _XPG4_2 in order to get 57ee67461eSJoseph Mingrone * the Single UNIX Specification version of 58ee67461eSJoseph Mingrone * recvmsg(). 59ee67461eSJoseph Mingrone */ 60ee67461eSJoseph Mingrone #define _XPG4_2 61ee67461eSJoseph Mingrone #elif defined(_hpux) || defined(hpux) || defined(__hpux) 62ee67461eSJoseph Mingrone #define _REENTRANT 63ee67461eSJoseph Mingrone 64ee67461eSJoseph Mingrone /* 65ee67461eSJoseph Mingrone * We need this to get the versions of socket functions that 66ee67461eSJoseph Mingrone * use socklen_t. Define it only if it's not already defined, 67*0a7e5f1fSJoseph Mingrone * so we don't get redefinition warnings. 68ee67461eSJoseph Mingrone */ 69ee67461eSJoseph Mingrone #ifndef _XOPEN_SOURCE_EXTENDED 70ee67461eSJoseph Mingrone #define _XOPEN_SOURCE_EXTENDED 71ee67461eSJoseph Mingrone #endif 72ee67461eSJoseph Mingrone 73ee67461eSJoseph Mingrone /* 74ee67461eSJoseph Mingrone * XXX - the list of PA-RISC options for GCC makes it sound as if 75ee67461eSJoseph Mingrone * building code that uses a particular vintage of UNIX API/ABI 76ee67461eSJoseph Mingrone * is complicated: 77ee67461eSJoseph Mingrone * 78ee67461eSJoseph Mingrone * https://gcc.gnu.org/onlinedocs/gcc/HPPA-Options.html 79ee67461eSJoseph Mingrone * 80ee67461eSJoseph Mingrone * See the description of the -munix flag. 81ee67461eSJoseph Mingrone * 82ee67461eSJoseph Mingrone * We probably want libpcap to work with programs built for any 83ee67461eSJoseph Mingrone * UN*X standard. I'm not sure whether that's possible and, if 84ee67461eSJoseph Mingrone * it is, what sort of stuff it'd have to do. 85ee67461eSJoseph Mingrone * 86ee67461eSJoseph Mingrone * It might also be a requirement that we build with a special 87ee67461eSJoseph Mingrone * flag to allow the library to be used with threaded code, at 88ee67461eSJoseph Mingrone * least with HP's C compiler; hopefully doing so won't make it 89ee67461eSJoseph Mingrone * *not* work with *un*-threaded code. 90ee67461eSJoseph Mingrone */ 91ee67461eSJoseph Mingrone #else 92ee67461eSJoseph Mingrone /* 93ee67461eSJoseph Mingrone * Turn on _GNU_SOURCE to get everything GNU libc has to offer, 94ee67461eSJoseph Mingrone * including asprintf(), if we're using GNU libc. 95ee67461eSJoseph Mingrone * 96ee67461eSJoseph Mingrone * Unfortunately, one thing it has to offer is a strerror_r() 97ee67461eSJoseph Mingrone * that's not POSIX-compliant, but we deal with that in 98ee67461eSJoseph Mingrone * pcap_fmt_errmsg_for_errno(). 99ee67461eSJoseph Mingrone * 100ee67461eSJoseph Mingrone * We don't limit this to, for example, Linux and Cygwin, because 101ee67461eSJoseph Mingrone * this might, for example, be GNU/HURD or one of Debian's kFreeBSD 102ee67461eSJoseph Mingrone * OSes ("GNU/FreeBSD"). 103ee67461eSJoseph Mingrone */ 104ee67461eSJoseph Mingrone #define _GNU_SOURCE 105ee67461eSJoseph Mingrone 106ee67461eSJoseph Mingrone /* 107ee67461eSJoseph Mingrone * We turn on both _DEFAULT_SOURCE and _BSD_SOURCE to try to get 108ee67461eSJoseph Mingrone * the BSD u_XXX types, such as u_int and u_short, defined. We 109ee67461eSJoseph Mingrone * define _DEFAULT_SOURCE first, so that newer versions of GNU libc 110ee67461eSJoseph Mingrone * don't whine about _BSD_SOURCE being deprecated; we still have 111ee67461eSJoseph Mingrone * to define _BSD_SOURCE to handle older versions of GNU libc that 112ee67461eSJoseph Mingrone * don't support _DEFAULT_SOURCE. 113ee67461eSJoseph Mingrone * 114ee67461eSJoseph Mingrone * But, if it's already defined, don't define it, so that we don't 115ee67461eSJoseph Mingrone * get a warning of it being redefined if it's defined as, for 116ee67461eSJoseph Mingrone * example, 1. 117ee67461eSJoseph Mingrone */ 118ee67461eSJoseph Mingrone #ifndef _DEFAULT_SOURCE 119ee67461eSJoseph Mingrone #define _DEFAULT_SOURCE 120ee67461eSJoseph Mingrone #endif 121ee67461eSJoseph Mingrone /* Avoid redefining _BSD_SOURCE if it's already defined as for ex. 1 */ 122ee67461eSJoseph Mingrone #ifndef _BSD_SOURCE 123ee67461eSJoseph Mingrone #define _BSD_SOURCE 124ee67461eSJoseph Mingrone #endif 125ee67461eSJoseph Mingrone #endif 126ee67461eSJoseph Mingrone 127ee67461eSJoseph Mingrone #endif 128