Blame ftmacros.h

Packit 209cc3
/*
Packit 209cc3
 * Copyright (c) 1994, 1995, 1996
Packit 209cc3
 *	The Regents of the University of California.  All rights reserved.
Packit 209cc3
 *
Packit 209cc3
 * Redistribution and use in source and binary forms, with or without
Packit 209cc3
 * modification, are permitted provided that the following conditions
Packit 209cc3
 * are met:
Packit 209cc3
 * 1. Redistributions of source code must retain the above copyright
Packit 209cc3
 *    notice, this list of conditions and the following disclaimer.
Packit 209cc3
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 209cc3
 *    notice, this list of conditions and the following disclaimer in the
Packit 209cc3
 *    documentation and/or other materials provided with the distribution.
Packit 209cc3
 * 3. All advertising materials mentioning features or use of this software
Packit 209cc3
 *    must display the following acknowledgement:
Packit 209cc3
 *	This product includes software developed by the Computer Systems
Packit 209cc3
 *	Engineering Group at Lawrence Berkeley Laboratory.
Packit 209cc3
 * 4. Neither the name of the University nor of the Laboratory may be used
Packit 209cc3
 *    to endorse or promote products derived from this software without
Packit 209cc3
 *    specific prior written permission.
Packit 209cc3
 *
Packit 209cc3
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 209cc3
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 209cc3
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 209cc3
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 209cc3
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 209cc3
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 209cc3
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 209cc3
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 209cc3
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 209cc3
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 209cc3
 * SUCH DAMAGE.
Packit 209cc3
 */
Packit 209cc3
Packit 209cc3
#ifndef ftmacros_h
Packit 209cc3
#define	ftmacros_h
Packit 209cc3
Packit 209cc3
/*
Packit 209cc3
 * Define some feature test macros to make sure that everything we want
Packit 209cc3
 * to be declared gets declared.
Packit 209cc3
 *
Packit 209cc3
 * On some UN*Xes we need to force strtok_r() to be declared.
Packit 209cc3
 * We do *NOT* want to define _POSIX_C_SOURCE, as that tends
Packit 209cc3
 * to make non-POSIX APIs that we use unavailable.
Packit 209cc3
 * XXX - is there no portable way to say "please pollute the
Packit 209cc3
 * namespace to the maximum extent possible"?
Packit 209cc3
 */
Packit 209cc3
#if defined(sun) || defined(__sun)
Packit 209cc3
  #define __EXTENSIONS__
Packit 209cc3
Packit 209cc3
  /*
Packit 209cc3
   * We also need to define _XPG4_2 in order to get
Packit 209cc3
   * the Single UNIX Specification version of
Packit 209cc3
   * recvmsg().
Packit 209cc3
   */
Packit 209cc3
  #define _XPG4_2
Packit 209cc3
#elif defined(_hpux) || defined(hpux) || defined(__hpux)
Packit 209cc3
  #define _REENTRANT
Packit 209cc3
Packit 209cc3
  /*
Packit 209cc3
   * We need this to get the versions of socket functions that
Packit 209cc3
   * use socklen_t.  Define it only if it's not already defined,
Packit 209cc3
   * so we don't get redefiniton warnings.
Packit 209cc3
   */
Packit 209cc3
  #ifndef _XOPEN_SOURCE_EXTENDED
Packit 209cc3
    #define _XOPEN_SOURCE_EXTENDED
Packit 209cc3
  #endif
Packit 209cc3
Packit 209cc3
  /*
Packit 209cc3
   * XXX - the list of PA-RISC options for GCC makes it sound as if
Packit 209cc3
   * building code that uses a particular vintage of UNIX API/ABI
Packit 209cc3
   * is complicated:
Packit 209cc3
   *
Packit 209cc3
   *    https://gcc.gnu.org/onlinedocs/gcc/HPPA-Options.html
Packit 209cc3
   *
Packit 209cc3
   * See the description of the -munix flag.
Packit 209cc3
   *
Packit 209cc3
   * We probably want libpcap to work with programs built for any
Packit 209cc3
   * UN*X standard.  I'm not sure whether that's possible and, if
Packit 209cc3
   * it is, what sort of stuff it'd have to do.
Packit 209cc3
   *
Packit 209cc3
   * It might also be a requirement that we build with a special
Packit 209cc3
   * flag to allow the library to be used with threaded code, at
Packit 209cc3
   * least with HP's C compiler; hopefully doing so won't make it
Packit 209cc3
   * *not* work with *un*-threaded code.
Packit 209cc3
   */
Packit 209cc3
#elif defined(__linux__) || defined(linux) || defined(__linux)
Packit 209cc3
  /*
Packit 209cc3
   * Turn on _GNU_SOURCE to get everything GNU libc has to offer,
Packit 209cc3
   * including asprintf().
Packit 209cc3
   *
Packit 209cc3
   * Unfortunately, one thing it has to offer is a strerror_r()
Packit 209cc3
   * that's not POSIX-compliant, but we deal with that in
Packit 209cc3
   * pcap_fmt_errmsg_for_errno().
Packit 209cc3
   */
Packit 209cc3
  #define _GNU_SOURCE
Packit 209cc3
Packit 209cc3
  /*
Packit 209cc3
   * We turn on both _DEFAULT_SOURCE and _BSD_SOURCE to try to get
Packit 209cc3
   * the BSD u_XXX types, such as u_int and u_short, defined.  We
Packit 209cc3
   * define _DEFAULT_SOURCE first, so that newer versions of GNU libc
Packit 209cc3
   * don't whine about _BSD_SOURCE being deprecated; we still have
Packit 209cc3
   * to define _BSD_SOURCE to handle older versions of GNU libc that
Packit 209cc3
   * don't support _DEFAULT_SOURCE.
Packit 209cc3
   */
Packit 209cc3
  #define _DEFAULT_SOURCE
Packit 209cc3
  #define _BSD_SOURCE
Packit 209cc3
#endif
Packit 209cc3
Packit 209cc3
#endif