@@ -229,6 +229,7 @@ extern GTY(()) int darwin_ms_struct;
%:replace-outfile(-lobjc libobjc-gnu.a%s); \
:%:replace-outfile(-lobjc -lobjc-gnu ) } }\
%{static|static-libgcc|static-libgfortran:%:replace-outfile(-lgfortran libgfortran.a%s)}\
+ %{static|static-libgcc|static-libquadmath:%:replace-outfile(-lquadmath libquadmath.a%s)}\
%{static|static-libgcc|static-libstdc++|static-libgfortran:%:replace-outfile(-lgomp libgomp.a%s)}\
%{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ libstdc++.a%s)}\
%{!Zdynamiclib: \
===
@@ -61,6 +61,10 @@ along with GCC; see the file COPYING3. If not see
#define FORTRAN_LIBRARY "gfortran"
#endif
+#ifndef QUADMATH_LIBRARY
+#define QUADMATH_LIBRARY "quadmath"
+#endif
+
/* Name of the spec file. */
#define SPEC_FILE "libgfortran.spec"
@@ -160,19 +164,28 @@ append_option (size_t opt_index, const char *arg, int value)
}
/* Append a libgfortran argument to the list being built. If
- FORCE_STATIC, ensure the library is linked statically. */
+ FORCE_STATIC, ensure the library is linked statically. If
+ FORCE_STATIC_LIBQUADMATH, also link the quadmath library statically. */
static void
-add_arg_libgfortran (bool force_static ATTRIBUTE_UNUSED)
+add_arg_libgfortran (bool force_static ATTRIBUTE_UNUSED,
+ bool force_static_libquadmath ATTRIBUTE_UNUSED)
{
#ifdef HAVE_LD_STATIC_DYNAMIC
if (force_static)
append_option (OPT_Wl_, LD_STATIC_OPTION, 1);
#endif
+
append_option (OPT_l, FORTRAN_LIBRARY, 1);
+
#ifdef HAVE_LD_STATIC_DYNAMIC
+ if (force_static_libquadmath)
+ append_option (OPT_l, QUADMATH_LIBRARY, 1);
if (force_static)
append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1);
+#else
+ if (force_static_libquadmath)
+ append_option (OPT_l, QUADMATH_LIBRARY, 1);
#endif
}
@@ -198,8 +211,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
/* By default, we throw on the math library if we have one. */
int need_math = (MATH_LIBRARY[0] != '\0');
- /* Whether we should link a static libgfortran. */
- int static_lib = 0;
+ /* Whether we should link a static libgfortran / libquadmath. */
+ int static_libgfortran = 0;
+ int static_libquadmath = 0;
/* Whether we need to link statically. */
int static_linking = 0;
@@ -247,15 +261,19 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
case OPT_E:
/* These options disable linking entirely or linking of the
standard libraries. */
- library = 0;
+ library = NULL;
break;
case OPT_static_libgfortran:
#ifdef HAVE_LD_STATIC_DYNAMIC
- static_lib = 1;
+ static_libgfortran = 1;
#endif
break;
+ case OPT_static_libquadmath:
+ static_libquadmath = 1;
+ break;
+
case OPT_static:
#ifdef HAVE_LD_STATIC_DYNAMIC
static_linking = 1;
@@ -300,7 +318,7 @@ For more information about these matters, see the file named COPYING\n\n"));
/* If there are no input files, no need for the library. */
if (n_infiles == 0)
- library = 0;
+ library = NULL;
/* Second pass through arglist, transforming arguments as appropriate. */
@@ -364,13 +382,15 @@ For more information about these matters, see the file named COPYING\n\n"));
if (saw_library == 1)
saw_library = 2; /* -l<library> -lm. */
else
- add_arg_libgfortran (static_lib && !static_linking);
+ add_arg_libgfortran (static_libgfortran && !static_linking,
+ static_libquadmath && !static_linking);
}
else if (decoded_options[i].opt_index == OPT_l
&& strcmp (decoded_options[i].arg, FORTRAN_LIBRARY) == 0)
{
saw_library = 1; /* -l<library>. */
- add_arg_libgfortran (static_lib && !static_linking);
+ add_arg_libgfortran (static_libgfortran && !static_linking,
+ static_libquadmath && !static_linking);
continue;
}
else
@@ -393,7 +413,8 @@ For more information about these matters, see the file named COPYING\n\n"));
switch (saw_library)
{
case 0:
- add_arg_libgfortran (static_lib && !static_linking);
+ add_arg_libgfortran (static_libgfortran && !static_linking,
+ static_libquadmath && !static_linking);
/* Fall through. */
case 1: