summaryrefslogtreecommitdiff
path: root/libcrypto/libcrypto/downstream/internal/platform.h
blob: 251c223a0429276cc1e560c196aae152863acf19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* file      : libcrypto/downstream/internal/platform.h -*- C -*-
 * copyright : Copyright (c) 2018-2019 Code Synthesis Ltd
 * license   : OpenSSL and SSLeay Licenses; see accompanying LICENSE file
 */

/*
 * This header is used for inclusion of upstream's auto-generated
 * platform-specific header.
 *
 * If there is the auto-generated header foo.h, then the workflow is normally
 * as follows:
 *
 * - Create foo/.
 *
 * - Symlink platform.h into foo/.
 *
 * - Copy upstream's auto-generated for different platforms foo.h into foo/,
 *   using the `<architecture>-<os>[-<compiler>].h` naming convention (see
 *   below for exact names).
 *
 * - Create foo.h including foo/platform.h.
 *
 * See bn_conf.h for the real example.
 */

#ifndef _WIN32
#  if defined(__x86_64__)                                 /* POSIX x86_64 */
#    if defined(__linux__)
#      include "x86_64-linux.h"
#    elif defined(__FreeBSD__)
#      include "x86_64-freebsd.h"
#    elif defined(__APPLE__)
#      include "x86_64-macos.h"
#    else
#      error x86_64 architecture is not supported for this OS
#    endif
#  elif defined(__i386__)                                 /* POSIX i386 */
#    if defined(__linux__)
#      include "i686-linux.h"
/*
 * i686 architecture is not currently supported for FreeBSD and Mac OS.
 */
/*
#    elif defined(__FreeBSD__)
#      include "i686-freebsd.h"
#    elif defined(__APPLE__)
#      include "i686-macos.h"
*/
#    else
#      error i686 architecture is not supported for this OS
#    endif
#  else
#    error unknown architecture
#  endif
#else
#  if defined(_WIN64)                                     /* Windows x86_64 */
#    if defined(_MSC_VER)
#      include "x86_64-win32-msvc.h"
#    elif defined(__MINGW32__)
#      include "x86_64-win32-mingw32.h"
#    else
#      error x86_64 architecture is not supported for this compiler
#    endif
#  else                                                   /* Windows i386 */
#    if defined(_MSC_VER)
#      include "i686-win32-msvc.h"
#    elif defined(__MINGW32__)
#      include "i686-win32-mingw32.h"
#    else
#      error i686 architecture is not supported for this compiler
#    endif
#  endif
#endif