@@ -623,6 +623,11 @@ is not compatible with snapshots.")
623
623
:initform t
624
624
:type boolean
625
625
:documentation " Enable long-float" )
626
+ (libraries :accessor libraries
627
+ :initarg :libraries
628
+ :initform nil
629
+ :type list
630
+ :documentation " Local overrides for pkgconfig libraries." )
626
631
(units :accessor units
627
632
:initform ' (:git :describe :cpu-count #+ darwin :xcode :base :default-target :pkg-config
628
633
:clang :llvm :ar :cc :cxx :dis :mpi :nm :etags :ctags :objcopy :jupyter
@@ -911,12 +916,24 @@ the function to the overall configuration."
911
916
(defun configure-library (configuration library &rest rest
912
917
&key required min-version max-version &allow-other-keys )
913
918
" Configure a library"
914
- (message :info " Configuring library ~a " library)
919
+ (message :emph " Configuring library ~a " library)
915
920
(flet ((failure (control-string &rest args)
916
921
(apply #' message (if required :err :warn ) control-string args)
917
- nil ))
918
- (let ((version (run-program-capture (list (pkg-config configuration) " --modversion" library))))
919
- (cond ((not version)
922
+ nil )
923
+ (apply-flags (&key cflags ldflags ldlibs)
924
+ (when cflags
925
+ (apply #' append-cflags configuration cflags rest ))
926
+ (when ldflags
927
+ (apply #' append-ldflags configuration ldflags rest ))
928
+ (when ldlibs
929
+ (apply #' append-ldlibs configuration ldlibs rest ))
930
+ t ))
931
+ (let ((pair (assoc library (libraries configuration) :test #' equalp ))
932
+ (version nil ))
933
+ (cond (pair
934
+ (message :info " Override configuration found for library ~a ." library)
935
+ (apply #' apply-flags (cdr pair)))
936
+ ((not (setf version (run-program-capture (list (pkg-config configuration) " --modversion" library))))
920
937
(failure " Module ~a not found." library))
921
938
((and min-version
922
939
(uiop :version< version min-version))
@@ -925,16 +942,10 @@ the function to the overall configuration."
925
942
(uiop :version<= max-version version))
926
943
(failure " Module ~a with a version of ~a is not less then maximum version of ~a ." library version max-version))
927
944
(t
928
- (apply #' append-cflags configuration
929
- (run-program-capture (list (pkg-config configuration) " --cflags" library))
930
- rest )
931
- (apply #' append-ldflags configuration
932
- (run-program-capture (list (pkg-config configuration) " --libs-only-L" library))
933
- rest )
934
- (apply #' append-ldlibs configuration
935
- (run-program-capture (list (pkg-config configuration) " --libs-only-l" library))
936
- rest )
937
- t )))))
945
+ (message :info " Found version ~a of library ~a ." version library)
946
+ (apply-flags :cflags (run-program-capture (list (pkg-config configuration) " --cflags" library))
947
+ :ldflags (run-program-capture (list (pkg-config configuration) " --libs-only-L" library))
948
+ :ldlibs (run-program-capture (list (pkg-config configuration) " --libs-only-l" library))))))))
938
949
939
950
(defun library (&rest rest )
940
951
" Configure a library with the current configuration state."
0 commit comments