If an Autotools package wants to install a -gdb.py script under "auto-load scripts-directory" during "make install", what is the procedure to determine the destination path? I wrote this code: AC_CHECK_PROG(gdb, gdb, found) if $gdb = found; then GDB_AUTO_LOAD_SCRIPTS_DIRECTORY=$(gdb -q -ex "show data-directory" -ex "show auto-load scripts-directory" -ex quit |sed "1d;2{N;s/\n//g; s/.*\"\(.*\)\".*:\(.*\)./\1 \2/}; /\$datadir/ {s/\(.*\) \$datadir\(.*\)/\1\2/;q}; s/.* \(.\)/\1/") else GDB_AUTO_LOAD_SCRIPTS_DIRECTORY='${datadir}/gdb/auto-load/${libdir}' fi AC_SUBST(GDB_AUTO_LOAD_SCRIPTS_DIRECTORY) which exposes the current "auto-load scripts-directory" to the Makefile Isn't there a better way? show configuration prints: This GDB was configured as follows: configure --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-auto-load-dir=$debugdir:$datadir/auto-load --with-auto-load-safe-path=$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=/usr/local/share/gdb (relocatable) --with-jit-reader-dir=/usr/local/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --with-python=/usr/local (relocatable) --with-guile --with-separate-debug-dir=/usr/local/lib/debug (relocatable) --without-babeltrace ("Relocatable" means the directory can be moved with the GDB installation tree, and GDB will still find it.) info '(gdb)Data Files': If the data directory is inside GDB's configured binary prefix (set with '--prefix' or '--exec-prefix'), then the default data directory will be updated automatically if the installed GDB is moved to a new location. and my gdb is in /usr/local/bin. Where shall I move gdb, so that 'show configurtion' prints something different for '--with-gdb-datadir'?
I mean AC_CHECK_PROG(gdb, gdb, found) if $gdb = found; then GDB_AUTO_LOAD_SCRIPTS_DIRECTORY=$(gdb -q -ex "show data-directory" -ex "show auto-load scripts-directory" -ex quit |sed "1d;2{N;s/\n//g; s/.*\"\(.*\)\".*:\(.*\)./\1 \2/}; /\$datadir/ {s/\(.*\) \$datadir\(.*\)/\1\2/;q}; s/.* \(.\)/\1/") else GDB_AUTO_LOAD_SCRIPTS_DIRECTORY='${datadir}/gdb/auto-load' fi AC_SUBST(GDB_AUTO_LOAD_SCRIPTS_DIRECTORY)
AC_CHECK_PROG(gdb, gdb, found) if test $gdb = found; then GDB_AUTO_LOAD_SCRIPTS_DIRECTORY=$(gdb -q -ex "show data-directory" -ex "show auto-load scripts-directory" -ex quit |sed "1d;2{N;s/\n//g; s/.*\"\(.*\)\".*:\(.*\)./\1 \2/}; /\$datadir/ {s/\(.*\) \$datadir\(.*\)/\1\2/;q}; s/.* \(.\)/\1/") else GDB_AUTO_LOAD_SCRIPTS_DIRECTORY='${datadir}/gdb/auto-load' fi AC_SUBST(GDB_AUTO_LOAD_SCRIPTS_DIRECTORY)