fio: use LDFLAGS when linking dynamic engines
[fio.git] / fio.c
1 /*
2  * fio - the flexible io tester
3  *
4  * Copyright (C) 2005 Jens Axboe <axboe@suse.de>
5  * Copyright (C) 2006-2012 Jens Axboe <axboe@kernel.dk>
6  *
7  * The license below covers all files distributed with fio unless otherwise
8  * noted in the file itself.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2 as
12  *  published by the Free Software Foundation.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  *
23  */
24 #include "fio.h"
25
26 int main(int argc, char *argv[], char *envp[])
27 {
28         int ret = 1;
29
30         compiletime_assert(TD_NR <= TD_ENG_FLAG_SHIFT, "TD_ENG_FLAG_SHIFT");
31
32         if (initialize_fio(envp))
33                 return 1;
34
35 #if !defined(CONFIG_GETTIMEOFDAY) && !defined(CONFIG_CLOCK_GETTIME)
36 #error "No available clock source!"
37 #endif
38
39         if (fio_server_create_sk_key())
40                 goto done;
41
42         if (parse_options(argc, argv))
43                 goto done_key;
44
45         /*
46          * line buffer stdout to avoid output lines from multiple
47          * threads getting mixed
48          */
49         setvbuf(stdout, NULL, _IOLBF, 0);
50
51         fio_time_init();
52
53         if (nr_clients) {
54                 set_genesis_time();
55
56                 if (fio_start_all_clients())
57                         goto done_key;
58                 ret = fio_handle_clients(&fio_client_ops);
59         } else
60                 ret = fio_backend(NULL);
61
62 done_key:
63         fio_server_destroy_sk_key();
64 done:
65         deinitialize_fio();
66         return ret;
67 }