1335640Shselasky/* 2335640Shselasky * Copyright (c) 1994, 1995, 1996 3335640Shselasky * The Regents of the University of California. All rights reserved. 4335640Shselasky * 5335640Shselasky * Redistribution and use in source and binary forms, with or without 6335640Shselasky * modification, are permitted provided that the following conditions 7335640Shselasky * are met: 8335640Shselasky * 1. Redistributions of source code must retain the above copyright 9335640Shselasky * notice, this list of conditions and the following disclaimer. 10335640Shselasky * 2. Redistributions in binary form must reproduce the above copyright 11335640Shselasky * notice, this list of conditions and the following disclaimer in the 12335640Shselasky * documentation and/or other materials provided with the distribution. 13335640Shselasky * 3. All advertising materials mentioning features or use of this software 14335640Shselasky * must display the following acknowledgement: 15335640Shselasky * This product includes software developed by the Computer Systems 16335640Shselasky * Engineering Group at Lawrence Berkeley Laboratory. 17335640Shselasky * 4. Neither the name of the University nor of the Laboratory may be used 18335640Shselasky * to endorse or promote products derived from this software without 19335640Shselasky * specific prior written permission. 20335640Shselasky * 21335640Shselasky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22335640Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23335640Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24335640Shselasky * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25335640Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26335640Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27335640Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28335640Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29335640Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30335640Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31335640Shselasky * SUCH DAMAGE. 32335640Shselasky */ 33335640Shselasky 34335640Shselasky#ifndef ftmacros_h 35335640Shselasky#define ftmacros_h 36335640Shselasky 37335640Shselasky/* 38335640Shselasky * Define some feature test macros to make sure that everything we want 39335640Shselasky * to be declared gets declared. 40335640Shselasky * 41335640Shselasky * On some UN*Xes we need to force strtok_r() to be declared. 42335640Shselasky * We do *NOT* want to define _POSIX_C_SOURCE, as that tends 43335640Shselasky * to make non-POSIX APIs that we use unavailable. 44335640Shselasky * XXX - is there no portable way to say "please pollute the 45335640Shselasky * namespace to the maximum extent possible"? 46335640Shselasky */ 47335640Shselasky#if defined(sun) || defined(__sun) 48335640Shselasky #define __EXTENSIONS__ 49335640Shselasky 50335640Shselasky /* 51335640Shselasky * We also need to define _XPG4_2 in order to get 52335640Shselasky * the Single UNIX Specification version of 53335640Shselasky * recvmsg(). 54335640Shselasky */ 55335640Shselasky #define _XPG4_2 56335640Shselasky#elif defined(_hpux) || defined(hpux) || defined(__hpux) 57335640Shselasky #define _REENTRANT 58335640Shselasky 59335640Shselasky /* 60335640Shselasky * We need this to get the versions of socket functions that 61335640Shselasky * use socklen_t. Define it only if it's not already defined, 62335640Shselasky * so we don't get redefiniton warnings. 63335640Shselasky */ 64335640Shselasky #ifndef _XOPEN_SOURCE_EXTENDED 65335640Shselasky #define _XOPEN_SOURCE_EXTENDED 66335640Shselasky #endif 67335640Shselasky 68335640Shselasky /* 69335640Shselasky * XXX - the list of PA-RISC options for GCC makes it sound as if 70335640Shselasky * building code that uses a particular vintage of UNIX API/ABI 71335640Shselasky * is complicated: 72335640Shselasky * 73335640Shselasky * https://gcc.gnu.org/onlinedocs/gcc/HPPA-Options.html 74335640Shselasky * 75335640Shselasky * See the description of the -munix flag. 76335640Shselasky * 77335640Shselasky * We probably want libpcap to work with programs built for any 78335640Shselasky * UN*X standard. I'm not sure whether that's possible and, if 79335640Shselasky * it is, what sort of stuff it'd have to do. 80335640Shselasky * 81335640Shselasky * It might also be a requirement that we build with a special 82335640Shselasky * flag to allow the library to be used with threaded code, at 83335640Shselasky * least with HP's C compiler; hopefully doing so won't make it 84335640Shselasky * *not* work with *un*-threaded code. 85335640Shselasky */ 86335640Shselasky#elif defined(__linux__) || defined(linux) || defined(__linux) 87335640Shselasky /* 88356341Scy * Turn on _GNU_SOURCE to get everything GNU libc has to offer, 89356341Scy * including asprintf(). 90335640Shselasky * 91356341Scy * Unfortunately, one thing it has to offer is a strerror_r() 92356341Scy * that's not POSIX-compliant, but we deal with that in 93356341Scy * pcap_fmt_errmsg_for_errno(). 94335640Shselasky */ 95356341Scy #define _GNU_SOURCE 96335640Shselasky 97335640Shselasky /* 98335640Shselasky * We turn on both _DEFAULT_SOURCE and _BSD_SOURCE to try to get 99335640Shselasky * the BSD u_XXX types, such as u_int and u_short, defined. We 100335640Shselasky * define _DEFAULT_SOURCE first, so that newer versions of GNU libc 101335640Shselasky * don't whine about _BSD_SOURCE being deprecated; we still have 102335640Shselasky * to define _BSD_SOURCE to handle older versions of GNU libc that 103335640Shselasky * don't support _DEFAULT_SOURCE. 104335640Shselasky */ 105335640Shselasky #define _DEFAULT_SOURCE 106335640Shselasky #define _BSD_SOURCE 107335640Shselasky#endif 108335640Shselasky 109335640Shselasky#endif 110