3 # Copyright (c) 2007-2017. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
9 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
10 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
14 INCLUDEARGS="@includeflag@"
15 CMAKE_LINKARGS="-L@libdir@"
21 if [ "x@WIN32@" = "x1" ]; then
22 list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
23 list_add LINKARGS "@libdir@\libsimgrid.dll"
24 elif [ "x@APPLE@" = "x1" ]; then
25 list_add CFLAGS "-fpic"
26 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
27 list_add LINKARGS "-shared"
29 echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
31 list_add LINKARGS "-lsimgrid" "-Wl,-undefined,error"
33 list_add CFLAGS "-fpic"
34 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
35 list_add LINKARGS "-shared"
37 echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
39 list_add LINKARGS "-lsimgrid" "-Wl,-z,defs"
44 while [ $# -gt 0 ]; do
54 SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
55 if [ -z "$SRCFILE" ] ; then
58 list_add CMDARGS "${SRCFILE}"
60 '-version' | '--version')
61 printf '%b\n' "$SIMGRID_VERSION"
64 "-git-version" | "--git-version")
65 printf '%b\n' "$SIMGRID_GITHASH"
68 '-trace-call-location')
69 list_add_not_empty CMDARGS "-DTRACE_CALL_LOCATION"
71 '-compiler-version' | '--compiler-version')
75 list_add CMDARGS "${ARG}"
80 list_set CMDLINE "${CC}"
81 list_add_not_empty CMDLINE "${CFLAGS}"
82 list_add_not_empty CMDLINE ${INCLUDEARGS}
83 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
84 list_add_not_empty CMDLINE "${CMDARGS}"
85 list_add_not_empty CMDLINE "${LINKARGS}"
87 eval $(list_get CMDLINE)