7646f2265253b53a715d9469cf4edc1afb25aae5
max
  Wed Apr 30 18:02:55 2025 -0700
gbic: newer linuxes do not have mysql_config symlinks anymore, so detect if mysql_config actually exists

diff --git src/inc/common.mk src/inc/common.mk
index f7057a8f688..11447d291da 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -260,50 +260,58 @@
 endif
 ifeq (${PNGLIB},)
   PNGLIB=-lpng
 endif
 ifeq (${PNGINCL},)
   PNGINCL := $(shell libpng-config --I_opts  || true)
 #       $(info using libpng-config to set PNGINCL: ${PNGINCL})
 endif
 
 # autodetect where mysql includes and libraries are installed
 # do not need to do this during 'clean' target (this is very slow for 'clean')
 ifneq ($(MAKECMDGOALS),clean)
 
   # set MYSQL include path
   ifeq (${MYSQLINC},)
-    MYSQLINC := $(shell mysql_config --include | sed -e 's/-I//' || true)
+    # newer distros do not have the mysql_config symlink anymore
+    ifeq (, $(shell which mysql_config))
+        MYSQLCONFIG := mariadb_config
+    else
+        MYSQLCONFIG := mysql_config
+    endif
+	
+    MYSQLINC := $(shell ${MYSQLCONFIG} --include | sed -e 's/-I//' || true)
         # $(info using mysql_config to set MYSQLINC: ${MYSQLINC})
   endif
+
   ifeq (${MYSQLINC},)
     ifneq ($(wildcard /usr/local/mysql/include/mysql.h),)
 	  MYSQLINC=/usr/local/mysql/include
     endif
   endif
   ifeq (${MYSQLINC},)
     ifneq ($(wildcard /usr/include/mysql/mysql.h),)
 	  MYSQLINC=/usr/include/mysql
     endif
   endif
 
   # this does *not* work on Mac OSX with the dynamic libraries
   ifneq ($(UNAME_S),Darwin)
     ifeq (${MYSQLLIBS},)
       # mysql_config --libs includes -lm, however libm must be a dynamic library
       # so to handle SEMI_STATIC it is removed here and will be added at the end
-      MYSQLLIBS := $(shell mysql_config --libs | sed 's/-lm$$//' || true)
+      MYSQLLIBS := $(shell ${MYSQLCONFIG} --libs | sed 's/-lm$$//' || true)
 #        $(info using mysql_config to set MYSQLLIBS: ${MYSQLLIBS})
     endif
   endif
   ifeq ($(findstring src/hg/,${CURDIR}),src/hg/)
     ifeq (${MYSQLINC},)
         $(error can not find installed mysql development system)
     endif
   endif
   ifeq (${MYSQLLIBS},)
     ifneq ($(wildcard /usr/lib64/libmysqlclient.a),)
       MYSQLLIBS = /usr/lib64/libmysqlclient.a
     endif
   endif
     # last resort, hoping the compiler can find it in standard locations
   ifeq (${MYSQLLIBS},)