PowerPC64-be arch support. Qemu ("qppc") platform support.
[vpp.git] / vpp / app / version.c
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <vlib/vlib.h>
16 #include <app/version.h>
17
18 #if DPDK > 0
19 #include <rte_version.h>
20 #endif /* DPDK */
21
22 static char * vpe_version_string = 
23     "vpp v" VPP_BUILD_VER 
24     " built by " VPP_BUILD_USER 
25     " on " VPP_BUILD_HOST 
26     " at " VPP_BUILD_DATE;
27 static char * vpe_dir_string = "Built in " VPP_BUILD_TOPDIR;
28
29 static char * vpe_compiler = "Compiled with "
30 #if defined(__INTEL_COMPILER)
31 #define __(x) #x
32 #define _(x) __(x)
33         "icc " _(__INTEL_COMPILER) " (" __VERSION__ ")";
34 #undef _
35 #undef __
36 #elif defined(__clang__)
37         "Clang/LLVM " __clang_version__;
38 #elif defined (__GNUC__)
39         "GCC " __VERSION__;
40 #else
41         "unknown compiler";
42 #endif
43
44 static clib_error_t *
45 show_vpe_version_command_fn (vlib_main_t * vm,
46                  unformat_input_t * input,
47                  vlib_cli_command_t * cmd)
48 {
49   vlib_cli_output (vm, "%s", vpe_version_string);
50   if (unformat (input, "verbose")){
51      vlib_cli_output (vm, "%s", vpe_dir_string);
52      vlib_cli_output (vm, "%s", vpe_compiler);
53 #if DPDK > 0
54      vlib_cli_output (vm, "DPDK version is %s", rte_version());
55 #endif
56   }
57   return 0;
58 }
59
60 VLIB_CLI_COMMAND (show_vpe_version_command, static) = {
61   .path = "show version",
62   .short_help = "show version information",
63   .function = show_vpe_version_command_fn,
64 };
65
66 char * vpe_api_get_build_directory (void) 
67 {
68   return VPP_BUILD_TOPDIR;
69 }
70
71 char * vpe_api_get_version (void) 
72 {
73   return VPP_BUILD_VER;
74 }
75 char * vpe_api_get_build_date (void) 
76 {
77   return VPP_BUILD_DATE;
78 }