Blame include/ap_config.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file ap_config.h
Packit 90a5c9
 * @brief Symbol export macros and hook functions
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef AP_CONFIG_H
Packit 90a5c9
#define AP_CONFIG_H
Packit 90a5c9
Packit 90a5c9
#include "ap_hooks.h"
Packit 90a5c9
Packit 90a5c9
/* Although this file doesn't declare any hooks, declare the exports group here */
Packit 90a5c9
/**
Packit 90a5c9
 * @defgroup exports Apache exports
Packit 90a5c9
 * @ingroup  APACHE_CORE
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
/* define these just so doxygen documents them */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * AP_DECLARE_STATIC is defined when including Apache's Core headers,
Packit 90a5c9
 * to provide static linkage when the dynamic library may be unavailable.
Packit 90a5c9
 *
Packit 90a5c9
 * @see AP_DECLARE_EXPORT
Packit 90a5c9
 *
Packit 90a5c9
 * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
Packit 90a5c9
 * including Apache's Core headers, to import and link the symbols from the
Packit 90a5c9
 * dynamic Apache Core library and assure appropriate indirection and calling
Packit 90a5c9
 * conventions at compile time.
Packit 90a5c9
 */
Packit 90a5c9
# define AP_DECLARE_STATIC
Packit 90a5c9
/**
Packit 90a5c9
 * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
Packit 90a5c9
 * library, so that all public symbols are exported.
Packit 90a5c9
 *
Packit 90a5c9
 * @see AP_DECLARE_STATIC
Packit 90a5c9
 */
Packit 90a5c9
# define AP_DECLARE_EXPORT
Packit 90a5c9
Packit 90a5c9
#endif /* def DOXYGEN */
Packit 90a5c9
Packit 90a5c9
#if !defined(WIN32)
Packit 90a5c9
/**
Packit 90a5c9
 * Apache Core dso functions are declared with AP_DECLARE(), so they may
Packit 90a5c9
 * use the most appropriate calling convention.  Hook functions and other
Packit 90a5c9
 * Core functions with variable arguments must use AP_DECLARE_NONSTD().
Packit 90a5c9
 * @code
Packit 90a5c9
 * AP_DECLARE(rettype) ap_func(args)
Packit 90a5c9
 * @endcode
Packit 90a5c9
 */
Packit 90a5c9
#define AP_DECLARE(type)            type
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Apache Core dso variable argument and hook functions are declared with
Packit 90a5c9
 * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
Packit 90a5c9
 * @see AP_DECLARE
Packit 90a5c9
 * @code
Packit 90a5c9
 * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
Packit 90a5c9
 * @endcode
Packit 90a5c9
 */
Packit 90a5c9
#define AP_DECLARE_NONSTD(type)     type
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
Packit 90a5c9
 * This assures the appropriate indirection is invoked at compile time.
Packit 90a5c9
 *
Packit 90a5c9
 * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
Packit 90a5c9
 * declarations within headers to properly import the variable.
Packit 90a5c9
 * @code
Packit 90a5c9
 * AP_DECLARE_DATA type apr_variable
Packit 90a5c9
 * @endcode
Packit 90a5c9
 */
Packit 90a5c9
#define AP_DECLARE_DATA
Packit 90a5c9
Packit 90a5c9
#elif defined(AP_DECLARE_STATIC)
Packit 90a5c9
#define AP_DECLARE(type)            type __stdcall
Packit 90a5c9
#define AP_DECLARE_NONSTD(type)     type
Packit 90a5c9
#define AP_DECLARE_DATA
Packit 90a5c9
#elif defined(AP_DECLARE_EXPORT)
Packit 90a5c9
#define AP_DECLARE(type)            __declspec(dllexport) type __stdcall
Packit 90a5c9
#define AP_DECLARE_NONSTD(type)     __declspec(dllexport) type
Packit 90a5c9
#define AP_DECLARE_DATA             __declspec(dllexport)
Packit 90a5c9
#else
Packit 90a5c9
#define AP_DECLARE(type)            __declspec(dllimport) type __stdcall
Packit 90a5c9
#define AP_DECLARE_NONSTD(type)     __declspec(dllimport) type
Packit 90a5c9
#define AP_DECLARE_DATA             __declspec(dllimport)
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
Packit 90a5c9
/**
Packit 90a5c9
 * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
Packit 90a5c9
 *
Packit 90a5c9
 * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
Packit 90a5c9
 * declared with AP_MODULE_DECLARE_DATA are always exported.
Packit 90a5c9
 * @code
Packit 90a5c9
 * module AP_MODULE_DECLARE_DATA mod_tag
Packit 90a5c9
 * @endcode
Packit 90a5c9
 */
Packit 90a5c9
#if defined(WIN32)
Packit 90a5c9
#define AP_MODULE_DECLARE(type)            type __stdcall
Packit 90a5c9
#else
Packit 90a5c9
#define AP_MODULE_DECLARE(type)            type
Packit 90a5c9
#endif
Packit 90a5c9
#define AP_MODULE_DECLARE_NONSTD(type)     type
Packit 90a5c9
#define AP_MODULE_DECLARE_DATA
Packit 90a5c9
#else
Packit 90a5c9
/**
Packit 90a5c9
 * AP_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
Packit 90a5c9
 * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
Packit 90a5c9
 *
Packit 90a5c9
 * The old SHARED_MODULE compile-time symbol is now the default behavior,
Packit 90a5c9
 * so it is no longer referenced anywhere with Apache 2.0.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_MODULE_DECLARE_EXPORT
Packit 90a5c9
#define AP_MODULE_DECLARE(type)          __declspec(dllexport) type __stdcall
Packit 90a5c9
#define AP_MODULE_DECLARE_NONSTD(type)   __declspec(dllexport) type
Packit 90a5c9
#define AP_MODULE_DECLARE_DATA           __declspec(dllexport)
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#include "os.h"
Packit 90a5c9
#if (!defined(WIN32) && !defined(NETWARE)) || defined(__MINGW32__)
Packit 90a5c9
#include "ap_config_auto.h"
Packit 90a5c9
#endif
Packit 90a5c9
#include "ap_config_layout.h"
Packit 90a5c9
Packit 90a5c9
/* Where the main/parent process's pid is logged */
Packit 90a5c9
#ifndef DEFAULT_PIDLOG
Packit 90a5c9
#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if defined(NETWARE)
Packit 90a5c9
#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if defined(AP_ENABLE_DTRACE) && HAVE_SYS_SDT_H
Packit 90a5c9
#include <sys/sdt.h>
Packit 90a5c9
#else
Packit 90a5c9
#undef _DTRACE_VERSION
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifdef _DTRACE_VERSION
Packit 90a5c9
#include "apache_probes.h"
Packit 90a5c9
#else
Packit 90a5c9
#include "apache_noprobes.h"
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/* If APR has OTHER_CHILD logic, use reliable piped logs. */
Packit 90a5c9
#if APR_HAS_OTHER_CHILD
Packit 90a5c9
#define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
Packit 90a5c9
#define AP_HAVE_C99
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
/* Presume that the compiler supports C99-style designated
Packit 90a5c9
 * initializers if using GCC (but not G++), or for any other compiler
Packit 90a5c9
 * which claims C99 support. */
Packit 90a5c9
#if (defined(__GNUC__) && !defined(__cplusplus)) || defined(AP_HAVE_C99)
Packit 90a5c9
#define AP_HAVE_DESIGNATED_INITIALIZER
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifndef __has_attribute         /* check for supported attributes on clang */
Packit 90a5c9
#define __has_attribute(x) 0
Packit 90a5c9
#endif
Packit 90a5c9
#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
Packit 90a5c9
#define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
Packit 90a5c9
#else
Packit 90a5c9
#define AP_FN_ATTR_SENTINEL
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if ( defined(__GNUC__) &&                                        \
Packit 90a5c9
      (__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
Packit 90a5c9
    || __has_attribute(warn_unused_result)
Packit 90a5c9
#define AP_FN_ATTR_WARN_UNUSED_RESULT   __attribute__((warn_unused_result))
Packit 90a5c9
#else
Packit 90a5c9
#define AP_FN_ATTR_WARN_UNUSED_RESULT
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#if ( defined(__GNUC__) &&                                        \
Packit 90a5c9
      (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3))                     \
Packit 90a5c9
    || __has_attribute(alloc_size)
Packit 90a5c9
#define AP_FN_ATTR_ALLOC_SIZE(x)     __attribute__((alloc_size(x)))
Packit 90a5c9
#define AP_FN_ATTR_ALLOC_SIZE2(x,y)  __attribute__((alloc_size(x,y)))
Packit 90a5c9
#else
Packit 90a5c9
#define AP_FN_ATTR_ALLOC_SIZE(x)
Packit 90a5c9
#define AP_FN_ATTR_ALLOC_SIZE2(x,y)
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#endif /* AP_CONFIG_H */