Browse Source

* adapted configuration files when generating on macOS 10.14
- use new search path for binutils
- custom library search path for i386
- our configuration files do not support options depending on the host OS
version, so this can only be done at installation time

git-svn-id: trunk@39844 -

Jonas Maebe 6 years ago
parent
commit
9857b840f3
3 changed files with 319 additions and 292 deletions
  1. 3 5
      utils/fpcmkcfg/fpc.cft
  2. 281 286
      utils/fpcmkcfg/fpccfg.inc
  3. 35 1
      utils/fpcmkcfg/fpcmkcfg.pp

+ 3 - 5
utils/fpcmkcfg/fpc.cft

@@ -41,8 +41,6 @@
 #ifdef darwin
 # use pipes instead of temporary files for assembling
 -ap
-# path to Xcode 4.3+ utilities (no problem if it doesn't exist)
--FD/Applications/Xcode.app/Contents/Developer/usr/bin
 #endif
 
 # ----------------
@@ -174,6 +172,9 @@
 # searchpath for fppkg user-specific packages
 -Fu%localbasepath%/units/$FPCTARGET/*
 
+# searchpath for tools
+-FD%basepath%/bin/$FPCTARGET
+
 # path to the gcclib
 %gcclibpath%
 
@@ -182,9 +183,6 @@
 #-Fl/lib;/usr/lib
 -Fl%basepath%/lib/$FPCTARGET
 
-# searchpath for tools
--FD%basepath%/bin/$FPCTARGET
-
 %NEEDCROSSBINUTILSIFDEF%
 
 # never need cross-prefix when targeting the JVM

+ 281 - 286
utils/fpcmkcfg/fpccfg.inc

@@ -1,303 +1,298 @@
 {$ifdef Delphi}
-const DefaultConfig : array[0..32] of string[240]=(
+const DefaultConfig : array[0..30] of string[240]=(
 {$else Delphi}
-const DefaultConfig : array[0..32,1..240] of char=(
+const DefaultConfig : array[0..30,1..240] of char=(
 {$endif Delphi}
-  '#'#013#010+
-  '# Config file generated by fpcmkcfg on %BUILDDATE% - %BUILDTIME%'#013#010+
-  '# Example fpc.cfg for Free Pascal Compiler'#013#010+
-  '#'#013#010+
-  #013#010+
-  '# ----------------------'#013#010+
-  '# Defines (preprocessor)'#013#010+
-  '# ----------------------'#013#010+
-  #013#010+
-  '#'#013#010+
-  '# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE',', #DEFINE, #UNDEF are allowed'+
-  #013#010+
-  '#'#013#010+
-  '# -d is the same as #DEFINE'#013#010+
-  '# -u is the same as #UNDEF'#013#010+
-  '#'#013#010+
-  #013#010+
-  '#'#013#010+
-  '# Some examples (for switches see below, and the -? helppages)'#013#010+
-  '#'#013#010+
-  '# Try compiling with the -dRELEASE or -dDEBUG on the commandline'#013#010+
-  '#'#013#010+
-  #013#010+
-  '# F','or a release compile with optimizes and strip debuginfo'#013#010+
-  '#IFDEF RELEASE'#013#010+
-  '  -O2'#013#010+
-  '  -Xs'#013#010+
-  '  #WRITE Compiling Release Version'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
+  '#'#010+
+  '# Config file generated by fpcmkcfg on %BUILDDATE% - %BUILDTIME%'#010+
+  '# Example fpc.cfg for Free Pascal Compiler'#010+
+  '#'#010+
+  #010+
+  '# ----------------------'#010+
+  '# Defines (preprocessor)'#010+
+  '# ----------------------'#010+
+  #010+
+  '#'#010+
+  '# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE,',' #UNDEF are allowed'+
+  #010+
+  '#'#010+
+  '# -d is the same as #DEFINE'#010+
+  '# -u is the same as #UNDEF'#010+
+  '#'#010+
+  #010+
+  '#'#010+
+  '# Some examples (for switches see below, and the -? helppages)'#010+
+  '#'#010+
+  '# Try compiling with the -dRELEASE or -dDEBUG on the commandline'#010+
+  '#'#010+
+  #010+
+  '# For a release compile w','ith optimizes and strip debuginfo'#010+
+  '#IFDEF RELEASE'#010+
+  '  -O2'#010+
+  '  -Xs'#010+
+  '  #WRITE Compiling Release Version'#010+
+  '#ENDIF'#010+
+  #010+
   '# For a debug version compile with debuginfo and all codegeneration ch'+
-  'ecks on'#013#010+
-  '#IFDEF DEBUG'#013#010+
-  '  -gl'#013#010+
-  '  -Crto','i'#013#010+
-  '  #WRITE Compiling Debug Version'#013#010+
-  '#ELSE'#013#010+
-  '  # Strip debuginfo from the executable if not in debug mode'#013#010+
-  '  -Xs'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
-  '# assembling'#013#010+
-  '#ifdef darwin'#013#010+
-  '# use pipes instead of temporary files for assembling'#013#010+
-  '-ap'#013#010+
-  '# path to Xcode 4.3+ utiliti','es (no problem if it doesn'#039't exist)'#013+
-  #010+
-  '-FD/Applications/Xcode.app/Contents/Developer/usr/bin'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# ----------------'#013#010+
-  '# Parsing switches'#013#010+
-  '# ----------------'#013#010+
-  #013#010+
-  '# Pascal language mode'#013#010+
-  '#      -Mfpc      free pascal dialect (default)'#013#010+
-  '#  ','    -Mobjfpc   switch some Delphi 2 extensions on'#013#010+
-  '#      -Mdelphi   tries to be Delphi compatible'#013#010+
-  '#      -Mtp       tries to be TP/BP 7.0 compatible'#013#010+
-  '#      -Mgpc      tries to be gpc compatible'#013#010+
-  '#      -Mmacpas   tries to be compatible t','o the macintosh pascal dia'+
-  'lects'#013#010+
-  '#'#013#010+
-  '# Turn on Object Pascal extensions by default'#013#010+
-  '#-Mobjfpc'#013#010+
-  #013#010+
-  '# Assembler reader mode'#013#010+
-  '#      -Rdefault  use default assembler'#013#010+
-  '#      -Ratt      read AT&T style assembler'#013#010+
-  '#      -Rintel    read Intel styl','e assembler'#013#010+
-  '#'#013#010+
-  '# All assembler blocks are AT&T styled by default'#013#010+
-  '#-Ratt'#013#010+
-  #013#010+
-  '# Semantic checking'#013#010+
-  '#      -S2        same as -Mobjfpc'#013#010+
-  '#      -Sc        supports operators like C (*=,+=,/= and -=)'#013#010+
-  '#      -Sa        include assertion code.'#013#010,
-  '#      -Sd        same as -Mdelphi'#013#010+
+  'ecks on'#010+
+  '#IFDEF DEBUG'#010+
+  '  -gl'#010+
+  '  -Crtoi'#010+
+  '  #WRITE Compiling Debug Versi','on'#010+
+  '#ELSE'#010+
+  '  # Strip debuginfo from the executable if not in debug mode'#010+
+  '  -Xs'#010+
+  '#ENDIF'#010+
+  #010+
+  '# assembling'#010+
+  '#ifdef darwin'#010+
+  '# use pipes instead of temporary files for assembling'#010+
+  '-ap'#010+
+  '#endif'#010+
+  #010+
+  '# ----------------'#010+
+  '# Parsing switches'#010+
+  '# ----------------'#010+
+  #010+
+  '# Pas','cal language mode'#010+
+  '#      -Mfpc      free pascal dialect (default)'#010+
+  '#      -Mobjfpc   switch some Delphi 2 extensions on'#010+
+  '#      -Mdelphi   tries to be Delphi compatible'#010+
+  '#      -Mtp       tries to be TP/BP 7.0 compatible'#010+
+  '#      -Mgpc      trie','s to be gpc compatible'#010+
+  '#      -Mmacpas   tries to be compatible to the macintosh pascal diale'+
+  'cts'#010+
+  '#'#010+
+  '# Turn on Object Pascal extensions by default'#010+
+  '#-Mobjfpc'#010+
+  #010+
+  '# Assembler reader mode'#010+
+  '#      -Rdefault  use default assembler'#010+
+  '#      -Ratt      re','ad AT&T style assembler'#010+
+  '#      -Rintel    read Intel style assembler'#010+
+  '#'#010+
+  '# All assembler blocks are AT&T styled by default'#010+
+  '#-Ratt'#010+
+  #010+
+  '# Semantic checking'#010+
+  '#      -S2        same as -Mobjfpc'#010+
+  '#      -Sc        supports operators like C (*=,+=,/= an','d -=)'#010+
+  '#      -Sa        include assertion code.'#010+
+  '#      -Sd        same as -Mdelphi'#010+
   '#      -Se<x>     error options. <x> is a combination of the following'+
-  ':'#013#010+
-  '#         <n> : compiler stops after <n> errors (default is 1)'#013#010+
-  '#         w   : compiler stops also after warnings'#013#010+
-  '#         n   :',' compiler stops also after notes'#013#010+
-  '#         h   : compiler stops also after hints'#013#010+
-  '#      -Sg        allow LABEL and GOTO'#013#010+
-  '#      -Sh        Use ansistrings'#013#010+
-  '#      -Si        support C++ styled INLINE'#013#010+
-  '#      -Sk        load fpcylix unit'#013#010,
-  '#      -SI<x>     set interface style to <x>'#013#010+
-  '#         -SIcom    COM compatible interface (default)'#013#010+
-  '#         -SIcorba  CORBA compatible interface'#013#010+
-  '#      -Sm        support macros like C (global)'#013#010+
-  '#      -So        same as -Mtp'#013#010+
-  '#      -','Sp        same as -Mgpc'#013#010+
+  ':'#010+
+  '#         <n> : compiler stops after <n> errors (default is 1)'#010+
+  '#         w   : compil','er stops also after warnings'#010+
+  '#         n   : compiler stops also after notes'#010+
+  '#         h   : compiler stops also after hints'#010+
+  '#      -Sg        allow LABEL and GOTO'#010+
+  '#      -Sh        Use ansistrings'#010+
+  '#      -Si        support C++ styled INLIN','E'#010+
+  '#      -Sk        load fpcylix unit'#010+
+  '#      -SI<x>     set interface style to <x>'#010+
+  '#         -SIcom    COM compatible interface (default)'#010+
+  '#         -SIcorba  CORBA compatible interface'#010+
+  '#      -Sm        support macros like C (global)'#010+
+  '#     ',' -So        same as -Mtp'#010+
+  '#      -Sp        same as -Mgpc'#010+
   '#      -Ss        constructor name must be init (destructor must be do'+
-  'ne)'#013#010+
+  'ne)'#010+
   '#      -Sx        enable exception keywords (default in Delphi/ObjFPC '+
-  'modes)'#013#010+
-  '#'#013#010+
-  '# Allow goto, inline, C-operators, C-vars'#013#010+
-  '-Sgic'#013#010+
-  #013#010+
-  '# -----','----------'#013#010+
-  '# Code generation'#013#010+
-  '# ---------------'#013#010+
-  #013#010+
+  'modes)'#010+
+  '#'#010+
+  '# Allow goto, inline, C-operat','ors, C-vars'#010+
+  '-Sgic'#010+
+  #010+
+  '# ---------------'#010+
+  '# Code generation'#010+
+  '# ---------------'#010+
+  #010+
   '# Uncomment the next line if you always want static/dynamic units by d'+
-  'efault'#013#010+
-  '# (can be overruled with -CD, -CS at the commandline)'#013#010+
-  '#-CS'#013#010+
-  '#-CD'#013#010+
-  #013#010+
-  '# Set the default heapsize to 8Mb'#013#010+
-  '#-Ch80','00000'#013#010+
-  #013#010+
-  '# Set default codegeneration checks (iocheck, overflow, range, stack)'#013+
-  #010+
-  '#-Ci'#013#010+
-  '#-Co'#013#010+
-  '#-Cr'#013#010+
-  '#-Ct'#013#010+
-  #013#010+
-  '# Optimizer switches'#013#010+
-  '# -Os        generate smaller code'#013#010+
-  '# -Oa=N      set alignment to N'#013#010+
-  '# -O1        level 1 optimizations (quick o','ptimizations, debuggable)'+
-  #013#010+
+  'efault'#010+
+  '# (can be overruled with -CD, -CS at the commandline)'#010+
+  '#-CS'#010+
+  '#-CD'#010+
+  #010+
+  '# Set the default heapsi','ze to 8Mb'#010+
+  '#-Ch8000000'#010+
+  #010+
+  '# Set default codegeneration checks (iocheck, overflow, range, stack)'#010+
+  '#-Ci'#010+
+  '#-Co'#010+
+  '#-Cr'#010+
+  '#-Ct'#010+
+  #010+
+  '# Optimizer switches'#010+
+  '# -Os        generate smaller code'#010+
+  '# -Oa=N      set alignment to N'#010+
+  '# -O1        level 1 optimizations (qu','ick optimizations, debuggable)'+
+  #010+
   '# -O2        level 2 optimizations (-O1 + optimizations which make deb'+
-  'ugging more difficult)'#013#010+
+  'ugging more difficult)'#010+
   '# -O3        level 3 optimizations (-O2 + optimizations which also may'+
-  ' make the program slower rather than faster)'#013#010+
-  '# -','Oo<x>     switch on optimalization x. See fpc -i for possible val'+
-  'ues'#013#010+
+  ' make the program slower rather than faster)'#010+
+  '#',' -Oo<x>     switch on optimalization x. See fpc -i for possible val'+
+  'ues'#010+
   '# -OoNO<x>   switch off optimalization x. See fpc -i for possible valu'+
-  'es'#013#010+
+  'es'#010+
   '# -Op<x>     set target cpu for optimizing, see fpc -i for possible va'+
-  'lues'#013#010+
-  #013#010+
-  '#ifdef darwin'#013#010+
-  '#if','def cpui386'#013#010+
-  '-Cppentiumm'#013#010+
-  '-Oppentiumm'#013#010+
-  '#endif'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# -----------------------'#013#010+
-  '# Set Filenames and Paths'#013#010+
-  '# -----------------------'#013#010+
-  #013#010+
-  '# Both slashes and backslashes are allowed in paths'#013#010+
-  #013#010+
-  '# path to the messagefile, not necessary anym','ore but can be used to '+
-  'override'#013#010+
-  '# the default language'#013#010+
-  '#-Fr%basepath%/msg/errore.msg'#013#010+
-  '#-Fr%basepath%/msg/errorn.msg'#013#010+
-  '#-Fr%basepath%/msg/errores.msg'#013#010+
-  '#-Fr%basepath%/msg/errord.msg'#013#010+
-  '#-Fr%basepath%/msg/errorr.msg'#013#010+
-  #013#010+
-  '# search path for unicode',' binary files (FPC 2.x does not know this s'+
-  'witch)'#013#010+
-  '#ifndef VER2'#013#010+
-  '-FM%sharepath%/unicode/'#013#010+
-  '#endif'#013#010+
-  #013#010+
+  'lues'#010+
+  #010+
+  '#ifdef darwin'#010+
+  '#ifdef',' cpui386'#010+
+  '-Cppentiumm'#010+
+  '-Oppentiumm'#010+
+  '#endif'#010+
+  '#endif'#010+
+  #010+
+  '# -----------------------'#010+
+  '# Set Filenames and Paths'#010+
+  '# -----------------------'#010+
+  #010+
+  '# Both slashes and backslashes are allowed in paths'#010+
+  #010+
+  '# path to the messagefile, not necessary anymore but can be ','used to '+
+  'override'#010+
+  '# the default language'#010+
+  '#-Fr%basepath%/msg/errore.msg'#010+
+  '#-Fr%basepath%/msg/errorn.msg'#010+
+  '#-Fr%basepath%/msg/errores.msg'#010+
+  '#-Fr%basepath%/msg/errord.msg'#010+
+  '#-Fr%basepath%/msg/errorr.msg'#010+
+  #010+
+  '# search path for unicode binary files (FPC 2.x ','does not know this s'+
+  'witch)'#010+
+  '#ifndef VER2'#010+
+  '-FM%sharepath%/unicode/'#010+
+  '#endif'#010+
+  #010+
   '# Search for $fpctarget/$fpcsubarch-$fpcmemorymodel/ subdirectory firs'+
-  't'#013#010+
-  '# for i8086 CPU'#013#010+
-  '#ifdef cpui8086'#013#010+
-  '-Fu%basepath%/units/$fpctarget/$f','pcsubarch-$fpcmemorymodel'#013#010+
-  '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*'#013#010+
-  '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# searchpath for units and other system dependent things'#013#010+
-  '-Fu%basepath%/units','/$fpctarget'#013#010+
-  '-Fu%basepath%/units/$fpctarget/*'#013#010+
-  '-Fu%basepath%/units/$fpctarget/rtl'#013#010+
-  #013#010+
-  '#IFDEF FPCAPACHE_1_3'#013#010+
-  '-Fu%basepath%/units/$fpctarget/httpd13/'#013#010+
-  '#ELSE'#013#010+
-  '#IFDEF FPCAPACHE_2_0'#013#010+
-  '-Fu%basepath%/units/$fpctarget/httpd20'#013#010+
-  '#ELSE'#013#010+
-  '-Fu%basepath%/un','its/$fpctarget/httpd22'#013#010+
-  '#ENDIF'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
-  '# searchpath for fppkg user-specific packages'#013#010+
-  '-Fu%localbasepath%/units/$FPCTARGET/*'#013#010+
-  #013#010+
-  '# path to the gcclib'#013#010+
-  '%gcclibpath%'#013#010+
-  #013#010+
-  '# searchpath for libraries'#013#010+
-  '#-Fl%basepath%/lib'#013#010+
-  '#-Fl/lib;/usr/lib'#013#010+
-  '-Fl%b','asepath%/lib/$FPCTARGET'#013#010+
-  #013#010+
-  '# searchpath for tools'#013#010+
-  '-FD%basepath%/bin/$FPCTARGET'#013#010+
-  #013#010+
-  '%NEEDCROSSBINUTILSIFDEF%'#013#010+
-  #013#010+
-  '# never need cross-prefix when targeting the JVM'#013#010+
-  '# (no native compiler, always cross-compiling)'#013#010+
-  '#ifdef cpujvm'#013#010+
-  '#undef NEEDCROSS','BINUTILS'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# for android cross-prefix is set by compiler'#013#010+
-  '#ifdef android'#013#010+
-  '#undef NEEDCROSSBINUTILS'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# never need cross-prefix when targeting the i8086'#013#010+
-  '# (no native compiler, always cross-compiling)'#013#010+
-  '#ifdef cpui8086'#013#010+
-  '#und','ef NEEDCROSSBINUTILS'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# never need cross-prefix when targeting the i8086'#013#010+
-  '# (no native compiler, always cross-compiling)'#013#010+
-  '#ifdef cpujvm'#013#010+
-  '#undef NEEDCROSSBINUTILS'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  '# binutils prefix for cross compiling'#013#010+
-  '#IFDEF FPC_CROSSCO','MPILING'#013#010+
-  '#IFDEF NEEDCROSSBINUTILS'#013#010+
-  '  -XP$FPCTARGET-'#013#010+
-  '#ENDIF'#013#010+
-  '#ENDIF'#013#010+
-  #013#010+
-  #013#010+
-  '# -------------'#013#010+
-  '# Linking'#013#010+
-  '# -------------'#013#010+
-  #013#010+
+  't'#010+
+  '# for i8086 CPU'#010+
+  '#ifdef cpui8086'#010+
+  '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel'#010+
+  '-Fu%b','asepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*'#010+
+  '-Fu%basepath%/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl'#010+
+  '#endif'#010+
+  #010+
+  '# searchpath for units and other system dependent things'#010+
+  '-Fu%basepath%/units/$fpctarget'#010+
+  '-Fu%basepath%/units/$fpct','arget/*'#010+
+  '-Fu%basepath%/units/$fpctarget/rtl'#010+
+  #010+
+  '#IFDEF FPCAPACHE_1_3'#010+
+  '-Fu%basepath%/units/$fpctarget/httpd13/'#010+
+  '#ELSE'#010+
+  '#IFDEF FPCAPACHE_2_0'#010+
+  '-Fu%basepath%/units/$fpctarget/httpd20'#010+
+  '#ELSE'#010+
+  '-Fu%basepath%/units/$fpctarget/httpd22'#010+
+  '#ENDIF'#010+
+  '#ENDIF'#010+
+  #010+
+  '# searchp','ath for fppkg user-specific packages'#010+
+  '-Fu%localbasepath%/units/$FPCTARGET/*'#010+
+  #010+
+  '# searchpath for tools'#010+
+  '-FD%basepath%/bin/$FPCTARGET'#010+
+  #010+
+  '# path to the gcclib'#010+
+  '%gcclibpath%'#010+
+  #010+
+  '# searchpath for libraries'#010+
+  '#-Fl%basepath%/lib'#010+
+  '#-Fl/lib;/usr/lib'#010+
+  '-Fl%basepath','%/lib/$FPCTARGET'#010+
+  #010+
+  '%NEEDCROSSBINUTILSIFDEF%'#010+
+  #010+
+  '# never need cross-prefix when targeting the JVM'#010+
+  '# (no native compiler, always cross-compiling)'#010+
+  '#ifdef cpujvm'#010+
+  '#undef NEEDCROSSBINUTILS'#010+
+  '#endif'#010+
+  #010+
+  '# for android cross-prefix is set by compiler'#010+
+  '#ifdef ','android'#010+
+  '#undef NEEDCROSSBINUTILS'#010+
+  '#endif'#010+
+  #010+
+  '# never need cross-prefix when targeting the i8086'#010+
+  '# (no native compiler, always cross-compiling)'#010+
+  '#ifdef cpui8086'#010+
+  '#undef NEEDCROSSBINUTILS'#010+
+  '#endif'#010+
+  #010+
+  '# never need cross-prefix when targeting the i8086'#010+
+  '#',' (no native compiler, always cross-compiling)'#010+
+  '#ifdef cpujvm'#010+
+  '#undef NEEDCROSSBINUTILS'#010+
+  '#endif'#010+
+  #010+
+  '# binutils prefix for cross compiling'#010+
+  '#IFDEF FPC_CROSSCOMPILING'#010+
+  '#IFDEF NEEDCROSSBINUTILS'#010+
+  '  -XP$FPCTARGET-'#010+
+  '#ENDIF'#010+
+  '#ENDIF'#010+
+  #010+
+  #010+
+  '# -------------'#010+
+  '# Linking',#010+
+  '# -------------'#010+
+  #010+
   '# generate always debugging information for GDB (slows down the compil'+
-  'ing'#013#010+
-  '# process)'#013#010+
-  '#      -gc        generate checks',' for pointers'#013#010+
-  '#      -gd        use dbx'#013#010+
-  '#      -gg        use gsym'#013#010+
-  '#      -gh        use heap trace unit (for memory leak debugging)'#013#010+
-  '#      -gl        use line info unit to show more info for backtraces'#013+
-  #010+
-  '#      -gv        generates prog','rams tracable with valgrind'#013#010+
-  '#      -gw        generate dwarf debugging info'#013#010+
-  '#'#013#010+
-  '# Enable debuginfo and use the line info unit by default'#013#010+
-  '#-gl'#013#010+
-  #013#010+
-  '# always pass an option to the linker'#013#010+
-  '#-k-s'#013#010+
-  #013#010+
-  '# Always use smartlinking on i8086, because t','he system unit exceeds '+
-  'the 64kb'#013#010+
-  '# code limit'#013#010+
-  '#ifdef cpui8086'#013#010+
-  '-CX'#013#010+
-  '-XX'#013#010+
-  '#endif'#013#010+
-  #013#010+
-  #013#010+
-  '# -------------'#013#010+
-  '# Miscellaneous'#013#010+
-  '# -------------'#013#010+
-  #013#010+
-  '# Write always a nice FPC logo ;)'#013#010+
-  '-l'#013#010+
-  #013#010+
-  '# Verbosity'#013#010+
-  '#      e : Show errors (default)       d : Show',' debug info'#013#010+
-  '#      w : Show warnings               u : Show unit info'#013#010+
-  '#      n : Show notes                  t : Show tried/used files'#013#010+
-  '#      h : Show hints                  s : Show time stamps'#013#010+
-  '#      i : Show general info           q ',': Show message numbers'#013#010+
-  '#      l : Show linenumbers            c : Show conditionals'#013#010+
-  '#      a : Show everything             0 : Show nothing (except errors'+
-  ')'#013#010+
+  'ing'#010+
+  '# process)'#010+
+  '#      -gc        generate checks for pointers'#010+
+  '#      -gd        use dbx'#010+
+  '#      -gg        use gsym'#010+
+  '#      -gh        use heap trace unit',' (for memory leak debugging)'#010+
+  '#      -gl        use line info unit to show more info for backtraces'#010+
+  '#      -gv        generates programs tracable with valgrind'#010+
+  '#      -gw        generate dwarf debugging info'#010+
+  '#'#010+
+  '# Enable debuginfo and use the ','line info unit by default'#010+
+  '#-gl'#010+
+  #010+
+  '# always pass an option to the linker'#010+
+  '#-k-s'#010+
+  #010+
+  '# Always use smartlinking on i8086, because the system unit exceeds th'+
+  'e 64kb'#010+
+  '# code limit'#010+
+  '#ifdef cpui8086'#010+
+  '-CX'#010+
+  '-XX'#010+
+  '#endif'#010+
+  #010+
+  #010+
+  '# -------------'#010+
+  '# Miscellaneous'#010+
+  '# ------','-------'#010+
+  #010+
+  '# Write always a nice FPC logo ;)'#010+
+  '-l'#010+
+  #010+
+  '# Verbosity'#010+
+  '#      e : Show errors (default)       d : Show debug info'#010+
+  '#      w : Show warnings               u : Show unit info'#010+
+  '#      n : Show notes                  t : Show tried/used files',#010+
+  '#      h : Show hints                  s : Show time stamps'#010+
+  '#      i : Show general info           q : Show message numbers'#010+
+  '#      l : Show linenumbers            c : Show conditionals'#010+
+  '#      a : Show everything             0 : Show nothin','g (except erro'+
+  'rs)'#010+
   '#      b : Write file names messages   r : Rhide/GCC compatibility mod'+
-  'e'#013#010+
-  '#       ','   with full path              x : Executable info (Win32 on'+
-  'ly)'#013#010+
+  'e'#010+
+  '#          with full path              x : Executable info (Win32 only'+
+  ')'#010+
   '#      v : write fpcdebug.txt with     p : Write tree.log with parse t'+
-  'ree'#013#010+
-  '#          lots of debugging info'#013#010+
-  '#'#013#010+
-  '# Display Info, Warnings and Notes'#013#010+
-  '-viwn'#013#010+
-  '# If you don'#039't want',' so much verbosity use'#013#010+
-  '#-vw'#013#010
+  'ree'#010+
+  '#   ','       lots of debugging info'#010+
+  '#'#010+
+  '# Display Info, Warnings and Notes'#010+
+  '-viwn'#010+
+  '# If you don'#039't want so much verbosity use'#010+
+  '#-vw'#010
 );

+ 35 - 1
utils/fpcmkcfg/fpcmkcfg.pp

@@ -215,7 +215,41 @@ begin
        AddConditionalLinkerPath('cpux86_64', x86_64, result);
        AddConditionalLinkerPath('cpupowerpc', powerpc, result);
        AddConditionalLinkerPath('cpupowerpc64', powerpc64, result);
-       end
+       { macOS 10.14 or later:
+          1) command line tools are installed under /Library/Developer/CommandLineTools
+          2) the system libraries still contain i386 code, but the 10.14 sdk doesn't
+            (-> only use the 10.14 sdk when targeting x86_64 or unknown architectures )
+          3) crt1.o is no longer installed under /usr -> add its directory explicitly via
+             -Fl
+            
+        We can't detect the macOS version inside fpc.cfg, unfortunately, so we can only
+        insert this while generating the configuration file.
+        
+        This will stop working when macOS 10.15 is released without i386 support, but then
+        users will be responsible for supplying their own i386 SDK anyway.
+       }
+       if DirectoryExists('/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk') then
+         begin
+           result:=result + LineEnding +
+             '-FD/Library/Developer/CommandLineTools/usr/bin' + LineEnding +
+             '#ifdef cpui386' + LineEnding +
+             '-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib' + LineEnding +
+             '#endif' + LineEnding +
+             '#ifndef cpui386' + LineEnding +
+             '#ifndef cpupowerpc' + LineEnding +
+             '#ifndef cpupowerpc64' + LineEnding +
+             '-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' + LineEnding +
+             '#endif' + LineEnding +
+             '#endif' + LineEnding +
+             '#endif';
+         end
+       else
+         begin
+           { add Xcode.app binutils to search path}
+           result:=result + LineEnding +
+             '-FD/Applications/Xcode.app/Contents/Developer/usr/bin';
+         end;
+      end;
   end; {case}
 end;