From f6b60d33e756a8bfc5bc012c83c872ceb267524c Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <vital.had@gmail.com>
Date: Mon, 13 Jul 2026 11:45:20 +0800
Subject: [PATCH 5/6] Remove hardcoded paths to /usr/local

---
 baselib/configure                    |  8 ++++----
 baselib/src/bl_path.c                |  4 ++--
 baselib/src/bl_path.h                |  2 +-
 configure                            | 10 ++++++----
 configure.in                         |  2 +-
 encodefilter/configure               |  8 ++++----
 encodefilter/module/Makefile.in      |  3 +--
 encodefilter/src/Makefile.in         |  2 +-
 encodefilter/src/ef_tblfunc_loader.h |  2 +-
 inputmethod/canna/Makefile.in        |  3 +--
 inputmethod/fcitx/Makefile.in        |  3 +--
 inputmethod/ibus/Makefile.in         |  3 +--
 inputmethod/iiimf/Makefile.in        |  3 +--
 inputmethod/kbd/Makefile.in          |  3 +--
 inputmethod/m17nlib/Makefile.in      |  3 +--
 inputmethod/scim/Makefile.in         |  3 +--
 inputmethod/skk/Makefile.in          |  3 +--
 inputmethod/uim/Makefile.in          |  3 +--
 inputmethod/wnn/Makefile.in          |  3 +--
 libind/Makefile.in                   |  2 +-
 libvterm/Makefile.in                 |  2 +-
 main/Makefile.in                     |  6 +++---
 main/main-con.c                      |  2 +-
 script/config.rpath                  |  2 +-
 tool/accessories/Makefile            |  2 +-
 tool/mlconfig/Makefile.in            |  1 -
 tool/mlconfig/mc_im.c                |  2 +-
 tool/mlconfig/mc_sb_view.c           |  2 +-
 tool/mlfc/Makefile.in                |  4 ++--
 tool/mlimgloader/Makefile.in         |  5 ++---
 tool/mlmenu/main.c                   |  2 +-
 tool/registobmp/Makefile.in          |  4 ++--
 tool/servman/Makefile.in             |  4 ++--
 uitoolkit/Makefile.in                |  2 +-
 uitoolkit/fb/ui_virtual_kbd.c        |  2 +-
 uitoolkit/libotl/Makefile.in         |  4 ++--
 uitoolkit/libotl/otl.h               |  2 +-
 uitoolkit/libtype/Makefile.in        |  4 ++--
 uitoolkit/ui_im.c                    |  2 +-
 uitoolkit/ui_sb_view_factory.c       |  4 ++--
 uitoolkit/xlib/ui_type_loader.c      |  2 +-
 vtemu/Makefile.in                    |  2 +-
 vtemu/libctl/Makefile.in             |  2 +-
 vtemu/libctl/vt_iscii.c              |  2 +-
 vtemu/libptymosh/Makefile.in         |  2 +-
 vtemu/libptyssh/Makefile.in          |  2 +-
 vtemu/vt_ctl_loader.c                |  2 +-
 vtemu/vt_pty_mosh.c                  |  2 +-
 vtemu/vt_pty_ssh.c                   |  2 +-
 vtemu/vt_term_manager.c              |  2 +-
 vtemu/vt_transfer.c                  |  2 +-
 51 files changed, 71 insertions(+), 82 deletions(-)

diff --git baselib/configure baselib/configure
index 893380cc..52d0e26e 100755
--- baselib/configure
+++ baselib/configure
@@ -575,7 +575,7 @@ ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 #
 # Initializations.
 #
-ac_default_prefix=/usr/local
+ac_default_prefix=/opt/local
 ac_clean_files=
 ac_config_libobj_dir=.
 LIBOBJS=
@@ -10166,7 +10166,7 @@ BEGIN {RS = " "; FS = "/|\n";} {
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_search_path_spec="/lib /usr/lib /opt/local/lib"
 fi
 library_names_spec=
 libname_spec='lib$name'
@@ -10450,8 +10450,8 @@ darwin* | rhapsody*)
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /opt/local/lib"
+  sys_lib_dlsearch_path_spec='/opt/local/lib /lib /usr/lib'
   ;;
 
 dgux*)
diff --git baselib/src/bl_path.c baselib/src/bl_path.c
index f165b54d..478b3f5a 100644
--- baselib/src/bl_path.c
+++ baselib/src/bl_path.c
@@ -391,9 +391,9 @@ static void TEST_bl_path_common(void) {
   char uri3[] = "ken@localhost.localdomain:22:utf8";
   char uri4[] = "ken@localhost.localdomain";
   char uri5[] = "ssh://localhost.localdomain";
-  char uri6[] = "telnet://ken@localhost.localdomain:22:eucjp/usr/local/";
+  char uri6[] = "telnet://ken@localhost.localdomain:22:eucjp/opt/local/";
   char uri7[] = "ssh://ken@localhost.localdomain:22:eucjp/";
-  char uri8[] = "ssh://localhost:eucjp/usr/local";
+  char uri8[] = "ssh://localhost:eucjp/opt/local";
   char *user;
   char *proto;
   char *host;
diff --git baselib/src/bl_path.h baselib/src/bl_path.h
index 144c629f..bba93cd5 100644
--- baselib/src/bl_path.h
+++ baselib/src/bl_path.h
@@ -27,7 +27,7 @@
 #endif
 #else
 #ifndef LIBEXECDIR
-#define BL_LIBEXECDIR(suffix) "/usr/local/libexec/" suffix
+#define BL_LIBEXECDIR(suffix) "/opt/local/libexec/" suffix
 #else
 #define BL_LIBEXECDIR(suffix) LIBEXECDIR "/" suffix
 #endif
diff --git configure configure
index 8baa92bc..4b88d01a 100755
--- configure
+++ configure
@@ -575,7 +575,7 @@ ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 #
 # Initializations.
 #
-ac_default_prefix=/usr/local
+ac_default_prefix=/opt/local
 ac_clean_files=
 ac_config_libobj_dir=.
 LIBOBJS=
@@ -11611,8 +11611,8 @@ darwin* | rhapsody*)
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /opt/local/lib"
+  sys_lib_dlsearch_path_spec='/opt/local/lib /lib /usr/lib'
   ;;
 
 dgux*)
@@ -16307,6 +16307,8 @@ fi
 # Standard set of common directories for X headers.
 # Check X11 before X11Rn because it is often a symlink to the current release.
 ac_x_header_dirs='
+/opt/local/include
+
 /usr/X11/include
 /usr/X11R7/include
 /usr/X11R6/include
@@ -21880,7 +21882,7 @@ fi
 		echo "** WARNING  **"
 		echo " couldn't find perl in PATH environment variable."
 		echo ""
-		PERL="/usr/local/bin/perl" # should be "/usr/bin/env perl"?
+		PERL="/usr/bin/perl" # may also be "/opt/local/bin/perl"
 	fi
 	MAKE_DIRS2="tool/w3mmlconfig ${MAKE_DIRS2}"
 	OUTPUT_FILES="tool/w3mmlconfig/Makefile tool/w3mmlconfig/mlconfig.cgi tool/w3mmlconfig/w3mmlconfig ${OUTPUT_FILES}"
diff --git configure.in configure.in
index 6397bc0a..1888f767 100644
--- configure.in
+++ configure.in
@@ -1204,7 +1204,7 @@ w3mmlconfig)
 		echo "** WARNING  **"
 		echo " couldn't find perl in PATH environment variable."
 		echo ""
-		PERL="/usr/local/bin/perl" # should be "/usr/bin/env perl"?
+		PERL="/usr/bin/perl" # may also be "/opt/local/bin/perl"
 	fi
 	MAKE_DIRS2="tool/w3mmlconfig ${MAKE_DIRS2}"
 	OUTPUT_FILES="tool/w3mmlconfig/Makefile tool/w3mmlconfig/mlconfig.cgi tool/w3mmlconfig/w3mmlconfig ${OUTPUT_FILES}"
diff --git encodefilter/configure encodefilter/configure
index 2d16a43d..13c0afb6 100755
--- encodefilter/configure
+++ encodefilter/configure
@@ -575,7 +575,7 @@ ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 #
 # Initializations.
 #
-ac_default_prefix=/usr/local
+ac_default_prefix=/opt/local
 ac_clean_files=
 ac_config_libobj_dir=.
 LIBOBJS=
@@ -10051,7 +10051,7 @@ BEGIN {RS = " "; FS = "/|\n";} {
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_search_path_spec="/lib /usr/lib /opt/local/lib"
 fi
 library_names_spec=
 libname_spec='lib$name'
@@ -10335,8 +10335,8 @@ darwin* | rhapsody*)
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /opt/local/lib"
+  sys_lib_dlsearch_path_spec='/opt/local/lib /lib /usr/lib'
   ;;
 
 dgux*)
diff --git encodefilter/module/Makefile.in encodefilter/module/Makefile.in
index cf36d81e..c1db40ea 100644
--- encodefilter/module/Makefile.in
+++ encodefilter/module/Makefile.in
@@ -13,8 +13,7 @@ INCDIR = $(DESTDIR)$(prefix)/include
 
 VPATH = $(top_srcdir)/module
 
-CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @TABLE_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-I/usr/local/include
+CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @TABLE_CFLAGS@ @CFLAGS@ @CPPFLAGS@
 
 JAJP_TABLE_OBJ = ef_ucs4_jisx0208.o ef_ucs4_jisx0212.o ef_ucs4_jisx0213.o
 KOKR_TABLE_OBJ = ef_ucs4_uhc.o ef_uhc_johab.o
diff --git encodefilter/src/Makefile.in encodefilter/src/Makefile.in
index 0ac981d0..43627cb5 100644
--- encodefilter/src/Makefile.in
+++ encodefilter/src/Makefile.in
@@ -16,7 +16,7 @@ VPATH = $(top_srcdir)/src
 INCDIR_TMP = ../include
 
 CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @TABLE_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-DLIBDIR=\"$(libdir)\" -I/usr/local/include
+	-DLIBDIR=\"$(libdir)\"
 
 PARSER_OBJ = ef_parser.o ef_iso2022_parser.o ef_iso8859_parser.o ef_xct_parser.o \
 	ef_eucjp_parser.o ef_euckr_parser.o ef_euccn_parser.o ef_iso2022jp_parser.o \
diff --git encodefilter/src/ef_tblfunc_loader.h encodefilter/src/ef_tblfunc_loader.h
index 1449346c..5b4ad71d 100644
--- encodefilter/src/ef_tblfunc_loader.h
+++ encodefilter/src/ef_tblfunc_loader.h
@@ -9,7 +9,7 @@
 #include "ef_char.h"
 
 #ifndef LIBDIR
-#define MEFLIB_DIR "/usr/local/lib/mef/"
+#define MEFLIB_DIR "/opt/local/lib/mef/"
 #else
 #define MEFLIB_DIR LIBDIR "/mef/"
 #endif
diff --git inputmethod/canna/Makefile.in inputmethod/canna/Makefile.in
index 4c808cf5..88024d2d 100644
--- inputmethod/canna/Makefile.in
+++ inputmethod/canna/Makefile.in
@@ -24,8 +24,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @CANNA_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @CANNA_LIBS@
 
diff --git inputmethod/fcitx/Makefile.in inputmethod/fcitx/Makefile.in
index 219a8fc3..c8b1a943 100644
--- inputmethod/fcitx/Makefile.in
+++ inputmethod/fcitx/Makefile.in
@@ -24,8 +24,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @FCITX_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @FCITX_LIBS@
 
diff --git inputmethod/ibus/Makefile.in inputmethod/ibus/Makefile.in
index cae381cf..c9b9fe20 100644
--- inputmethod/ibus/Makefile.in
+++ inputmethod/ibus/Makefile.in
@@ -24,8 +24,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @IBUS_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @IBUS_LIBS@
 
diff --git inputmethod/iiimf/Makefile.in inputmethod/iiimf/Makefile.in
index a4607939..1a7f3312 100644
--- inputmethod/iiimf/Makefile.in
+++ inputmethod/iiimf/Makefile.in
@@ -27,8 +27,7 @@ CFLAGS = $(CFLAGS_LOCAL)		\
 	 @IM_CFLAGS@			\
 	 @IIIMCF_CFLAGS@		\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @LMEF@ @IIIMCF_LIBS@
 
diff --git inputmethod/kbd/Makefile.in inputmethod/kbd/Makefile.in
index 43e21cbc..12150ac6 100644
--- inputmethod/kbd/Makefile.in
+++ inputmethod/kbd/Makefile.in
@@ -22,8 +22,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @CFLAGS@			\
 	 @CPPFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @LMEF@
 
diff --git inputmethod/m17nlib/Makefile.in inputmethod/m17nlib/Makefile.in
index ddef0a84..58da7070 100644
--- inputmethod/m17nlib/Makefile.in
+++ inputmethod/m17nlib/Makefile.in
@@ -24,8 +24,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @M17NLIB_CFLAGS@		\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @M17NLIB_LIBS@
 
diff --git inputmethod/scim/Makefile.in inputmethod/scim/Makefile.in
index ee203ae2..7f138de6 100644
--- inputmethod/scim/Makefile.in
+++ inputmethod/scim/Makefile.in
@@ -25,8 +25,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @SCIM_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @SCIM_LIBS@
 
diff --git inputmethod/skk/Makefile.in inputmethod/skk/Makefile.in
index a86cbb20..d8cb2988 100644
--- inputmethod/skk/Makefile.in
+++ inputmethod/skk/Makefile.in
@@ -23,8 +23,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @CPPFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
 	 -I${top_srcdir}/uitoolkit	\
-	 -I${top_srcdir}/common		\
-	 -I/usr/local/include
+	 -I${top_srcdir}/common
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @LMEF@ @SKK_LIBS@
 
diff --git inputmethod/uim/Makefile.in inputmethod/uim/Makefile.in
index a20d03a9..f9bb511e 100644
--- inputmethod/uim/Makefile.in
+++ inputmethod/uim/Makefile.in
@@ -24,8 +24,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @IM_CFLAGS@			\
 	 @UIM_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
-	 -I${top_srcdir}/uitoolkit	\
-	 -I/usr/local/include
+	 -I${top_srcdir}/uitoolkit
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @UIM_LIBS@
 
diff --git inputmethod/wnn/Makefile.in inputmethod/wnn/Makefile.in
index e57849d8..2aac2734 100644
--- inputmethod/wnn/Makefile.in
+++ inputmethod/wnn/Makefile.in
@@ -25,8 +25,7 @@ CFLAGS = $(CFLAGS_LOCAL) 		\
 	 @WNN_CFLAGS@			\
 	 -I$(top_srcdir)/vtemu		\
 	 -I${top_srcdir}/uitoolkit	\
-	 -I${top_srcdir}/common		\
-	 -I/usr/local/include
+	 -I${top_srcdir}/common
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @LMEF@ @WNN_LIBS@
 
diff --git libind/Makefile.in libind/Makefile.in
index 0fe45912..e01aa42d 100644
--- libind/Makefile.in
+++ libind/Makefile.in
@@ -16,7 +16,7 @@ LIBEXECDIR = $(libexecdir)
 VPATH = $(top_srcdir)/libind
 
 CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/libind \
-	-I/usr/local/include -DLIBDIR=\"$(LIBDIR)\"
+	-DLIBDIR=\"$(LIBDIR)\"
 LIBS = $(LIBS_LOCAL)
 
 OBJ = indian.o keyboard.o lex.split.o
diff --git libvterm/Makefile.in libvterm/Makefile.in
index d75dd3e2..4577c050 100644
--- libvterm/Makefile.in
+++ libvterm/Makefile.in
@@ -16,7 +16,7 @@ LIBDIR = $(DESTDIR)$(libdir)
 VPATH = $(top_srcdir)/libvterm
 
 CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @MEF_CFLAGS@ @TRUECOLOR_CFLAGS@ \
-	@SSH2_CFLAGS@ @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/vtemu -I/usr/local/include
+	@SSH2_CFLAGS@ @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/vtemu
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @LMEF@
 
diff --git main/Makefile.in main/Makefile.in
index 83e810c1..49524d24 100644
--- main/Makefile.in
+++ main/Makefile.in
@@ -42,12 +42,12 @@ CFLAGS = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @MEF_CFLAGS@ @DEB_CFLAGS@ @BRLAPI_CFLAGS@
 	@DAEMON_CFLAGS@ @SPLIT_CFLAGS@ @DND_CFLAGS@ @TRANSFER_CFLAGS@ @IMAGE_CFLAGS@ \
 	@TRUECOLOR_CFLAGS@ @CFLAGS@ @CPPFLAGS@ -DSYSCONFDIR=\"$(sysconfdir)\" \
 	-I$(top_srcdir)/vtemu \
-	-I${top_srcdir}/uitoolkit -I${top_builddir}/main -I/usr/local/include
+	-I${top_srcdir}/uitoolkit -I${top_builddir}/main
 
 CFLAGS_FOR_FEATURES = @OT_LAYOUT_CFLAGS@ @CTL_CFLAGS@ @IM_CFLAGS@ @IMAGELIB_CFLAGS@ @UTMP_CFLAGS@
 
-LIBS1 = $(LIBS_LOCAL) $(LUITK) $(LMLTERM) $(LMEF) $(LPOBL) -L/usr/local/lib \
-	-R/usr/local/lib @SSH2_LIBS_FOR_PROG@ @BRLAPI_LIBS@ @OT_LAYOUT_LIBS_FOR_PROG@ @PTHREAD_LIB@ @REGEX_LIBS@
+LIBS1 = $(LIBS_LOCAL) $(LUITK) $(LMLTERM) $(LMEF) $(LPOBL) \
+	@SSH2_LIBS_FOR_PROG@ @BRLAPI_LIBS@ @OT_LAYOUT_LIBS_FOR_PROG@ @PTHREAD_LIB@ @REGEX_LIBS@
 
 LIBS2_xlib = @IMAGELIB_LIBS@ @DL_LIBS_IM@ @DL_LIBS_SB@ @MATH_LIBS@ @TYPE_LIBS_FOR_PROG@ \
 	@X_LIBS@ @X_EXTRA_LIBS@
diff --git main/main-con.c main/main-con.c
index 799538d3..1149c6cc 100644
--- main/main-con.c
+++ main/main-con.c
@@ -25,7 +25,7 @@
 #define MLLIBEXECDIR BINDIR
 #else
 #ifndef LIBEXECDIR
-#define LIBEXECDIR "/usr/local/libexec"
+#define LIBEXECDIR "/opt/local/libexec"
 #endif
 #define MLLIBEXECDIR LIBEXECDIR "/mlterm"
 #endif
diff --git script/config.rpath script/config.rpath
index 5ead7586..f667cdfc 100755
--- script/config.rpath
+++ script/config.rpath
@@ -351,7 +351,7 @@ fi
 # Check dynamic linker characteristics
 libname_spec='lib$name'
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+sys_lib_search_path_spec="/lib /usr/lib /opt/local/lib"
 case "$host_os" in
   aix3*)
     shlibext=so
diff --git tool/accessories/Makefile tool/accessories/Makefile
index ccf716a4..38884a6c 100644
--- tool/accessories/Makefile
+++ tool/accessories/Makefile
@@ -1,4 +1,4 @@
-prefix=/usr/local
+prefix=/opt/local
 bindir=$(prefix)/bin
 
 DESTDIR=
diff --git tool/mlconfig/Makefile.in tool/mlconfig/Makefile.in
index 88749109..9417068c 100644
--- tool/mlconfig/Makefile.in
+++ tool/mlconfig/Makefile.in
@@ -26,7 +26,6 @@ CFLAGS = $(CFLAGS_LOCAL) @GTK_CFLAGS@ @IMAGELIB_CFLAGS@ @DEB_CFLAGS@ \
 	-I${top_srcdir}/xwindow -I${top_srcdir}/vtemu \
 	-I${top_builddir}/common -I${top_srcdir}/common \
 	-I${top_srcdir}/inputmethod \
-	-I/usr/local/include \
 	-DSYSCONFDIR=\"$(sysconfdir)\" -DLOCALEDIR=\"$(datadir)/locale\" \
 	-DXDATADIR=\"$(datadir)\" -DLIBDIR=\"$(libdir)\"
 
diff --git tool/mlconfig/mc_im.c tool/mlconfig/mc_im.c
index 3927f366..b9c173c5 100644
--- tool/mlconfig/mc_im.c
+++ tool/mlconfig/mc_im.c
@@ -33,7 +33,7 @@
 #endif
 
 #ifndef LIBDIR
-#define IM_DIR "/usr/local/lib/mlterm/"
+#define IM_DIR "/opt/local/lib/mlterm/"
 #else
 #define IM_DIR LIBDIR "/mlterm/"
 #endif
diff --git tool/mlconfig/mc_sb_view.c tool/mlconfig/mc_sb_view.c
index 5de77c4a..e20a74a0 100644
--- tool/mlconfig/mc_sb_view.c
+++ tool/mlconfig/mc_sb_view.c
@@ -16,7 +16,7 @@
 #include "mc_io.h"
 
 #ifndef XDATADIR
-#define SB_DIR "/usr/local/share/mlterm/scrollbars"
+#define SB_DIR "/opt/local/share/mlterm/scrollbars"
 #else
 #define SB_DIR XDATADIR "/mlterm/scrollbars"
 #endif
diff --git tool/mlfc/Makefile.in tool/mlfc/Makefile.in
index f79a9a4d..91f9db96 100644
--- tool/mlfc/Makefile.in
+++ tool/mlfc/Makefile.in
@@ -14,9 +14,9 @@ VPATH = $(top_srcdir)/tool/mlfc
 
 OBJ = main.o
 
-CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@ @FONTCONFIG_CFLAGS@ -I/usr/local/include
+CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@ @FONTCONFIG_CFLAGS@
 
-LIBS = $(LIBS_LOCAL) @FONTCONFIG_LIBS@ -L/usr/local/lib -R/usr/local/lib
+LIBS = $(LIBS_LOCAL) @FONTCONFIG_LIBS@
 
 PROG = mlfc
 
diff --git tool/mlimgloader/Makefile.in tool/mlimgloader/Makefile.in
index e2896a81..3bb15561 100644
--- tool/mlimgloader/Makefile.in
+++ tool/mlimgloader/Makefile.in
@@ -22,8 +22,7 @@ OBJ = @MLIMGLOADER_LIB@.o
 LPOBL = @LPOBL@
 LPOBL_DEB = -lpobl_deb
 
-CFLAGS1 = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @DEB_CFLAGS@ @GUI_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-I/usr/local/include
+CFLAGS1 = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @DEB_CFLAGS@ @GUI_CFLAGS@ @CFLAGS@ @CPPFLAGS@
 
 CFLAGS2_gdk-pixbuf = @GDK_PIXBUF_CFLAGS@ @X_CFLAGS@ @X_CFLAGS_AUX@ @EMOJI_CFLAGS@
 CFLAGS2_libpng = @LIBPNG_CFLAGS@ @X_CFLAGS@ @X_CFLAGS_AUX@ @EMOJI_CFLAGS@
@@ -31,7 +30,7 @@ CFLAGS2_libpng = @LIBPNG_CFLAGS@ @X_CFLAGS@ @X_CFLAGS_AUX@ @EMOJI_CFLAGS@
 CFLAGS = $(CFLAGS1) $(CFLAGS2_@MLIMGLOADER_LIB@) -DLIBEXECDIR=\"$(libexecdir)\" \
 	-DBINDIR=\"$(bindir)\"
 
-LIBS1 = $(LIBS_LOCAL) $(LPOBL) -L/usr/local/lib -R/usr/local/lib
+LIBS1 = $(LIBS_LOCAL) $(LPOBL)
 
 LIBS2_xlib_gdk-pixbuf = @X_LIBS@ @X_EXTRA_LIBS@ @GDK_PIXBUF_LIBS@ @EMOJI_LIBS@
 LIBS2_xlib_libpng = @X_LIBS@ @X_EXTRA_LIBS@ @LIBPNG_LIBS@ @EMOJI_LIBS@
diff --git tool/mlmenu/main.c tool/mlmenu/main.c
index d6747e0d..dda7ff99 100644
--- tool/mlmenu/main.c
+++ tool/mlmenu/main.c
@@ -10,7 +10,7 @@
 #include <X11/Xutil.h>
 
 #ifndef SYSCONFDIR
-#define SYSCONFDIR "/usr/local/etc"
+#define SYSCONFDIR "/opt/local/etc"
 #endif
 
 #define MENU_FILE SYSCONFDIR "/mlterm/menu-simple"
diff --git tool/registobmp/Makefile.in tool/registobmp/Makefile.in
index 0b09e93b..acb723f9 100644
--- tool/registobmp/Makefile.in
+++ tool/registobmp/Makefile.in
@@ -17,9 +17,9 @@ VPATH = $(top_srcdir)/tool/registobmp
 OBJ = main.o
 
 CFLAGS = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @DEB_CFLAGS@ @CFLAGS@ @CPPFLAGS@ @SDL_CFLAGS@ @GUI_CFLAGS@ \
-	@FONTCONFIG_CFLAGS@ -I/usr/local/include
+	@FONTCONFIG_CFLAGS@
 
-LIBS = $(LIBS_LOCAL) @SDL_LIBS@ @FONTCONFIG_LIBS@ -L/usr/local/lib -R/usr/local/lib -lm
+LIBS = $(LIBS_LOCAL) @SDL_LIBS@ @FONTCONFIG_LIBS@ -lm
 
 PROG = registobmp
 
diff --git tool/servman/Makefile.in tool/servman/Makefile.in
index 674ca0f1..734a1a1d 100644
--- tool/servman/Makefile.in
+++ tool/servman/Makefile.in
@@ -15,9 +15,9 @@ VPATH = $(top_srcdir)/tool/servman
 OBJ = main.o servman.o
 
 # XDATADIR is to avoid conflicting with DATADIR structure in w32api/objidl.h.
-CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@ -I/usr/local/include
+CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@
 
-LIBS = $(LIBS_LOCAL) -L/usr/local/lib -R/usr/local/lib -mwindows -lcomctl32
+LIBS = $(LIBS_LOCAL) -mwindows -lcomctl32
 
 PROG = servman
 
diff --git uitoolkit/Makefile.in uitoolkit/Makefile.in
index b7b96de5..b335d1e6 100644
--- uitoolkit/Makefile.in
+++ uitoolkit/Makefile.in
@@ -66,7 +66,7 @@ CFLAGS = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @MEF_CFLAGS@ @DEB_CFLAGS@ @MATH_CFLAGS@ \
 	@CFLAGS@ @CPPFLAGS@ \
 	-DBINDIR=\"$(bindir)\" -DLIBDIR=\"$(libdir)\" -DLIBEXECDIR=\"$(libexecdir)\" \
 	-DXDATADIR=\"$(datadir)\" \
-	-I$(top_srcdir)/vtemu -I$(top_srcdir)/uitoolkit/libotl -I/usr/local/include
+	-I$(top_srcdir)/vtemu -I$(top_srcdir)/uitoolkit/libotl
 
 LIBTOOL_CC = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS)
 LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CC) @LDFLAGS@
diff --git uitoolkit/fb/ui_virtual_kbd.c uitoolkit/fb/ui_virtual_kbd.c
index c89d8dc1..dc421212 100644
--- uitoolkit/fb/ui_virtual_kbd.c
+++ uitoolkit/fb/ui_virtual_kbd.c
@@ -20,7 +20,7 @@ ui_window_t *ui_is_virtual_kbd_area(int y) { return NULL; }
 #include "../ui_imagelib.h"
 
 #ifndef XDATADIR
-#define KBD_DIR "/usr/local/share/mlterm/kbd"
+#define KBD_DIR "/opt/local/share/mlterm/kbd"
 #else
 #define KBD_DIR XDATADIR "/mlterm/kbd"
 #endif
diff --git uitoolkit/libotl/Makefile.in uitoolkit/libotl/Makefile.in
index 6d140ffa..601b1d17 100644
--- uitoolkit/libotl/Makefile.in
+++ uitoolkit/libotl/Makefile.in
@@ -23,11 +23,11 @@ LPOBL_DEB = -lpobl_deb
 
 # XDATADIR is to avoid conflicting with DATADIR structure in w32api/objidl.h.
 CFLAGS = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @DEB_CFLAGS@ @GUI_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	@OT_LAYOUT_CFLAGS@ -I/usr/local/include
+	@OT_LAYOUT_CFLAGS@
 
 CFLAGS_beos = @FONTCONFIG_CFLAGS@
 
-LIBS = $(LIBS_LOCAL) @OT_LAYOUT_LIBS@ $(LPOBL) -L/usr/local/lib -R/usr/local/lib
+LIBS = $(LIBS_LOCAL) @OT_LAYOUT_LIBS@ $(LPOBL)
 
 LIBS_win32 = -mwindows
 LIBS_beos = @FONTCONFIG_LIBS@
diff --git uitoolkit/libotl/otl.h uitoolkit/libotl/otl.h
index 446209cc..102b395d 100644
--- uitoolkit/libotl/otl.h
+++ uitoolkit/libotl/otl.h
@@ -22,7 +22,7 @@
 #include <stdio.h>
 
 #ifndef LIBDIR
-#define OTL_DIR "/usr/local/lib/mlterm/"
+#define OTL_DIR "/opt/local/lib/mlterm/"
 #else
 #define OTL_DIR LIBDIR "/mlterm/"
 #endif
diff --git uitoolkit/libtype/Makefile.in uitoolkit/libtype/Makefile.in
index 920fac4a..7b10b0b0 100644
--- uitoolkit/libtype/Makefile.in
+++ uitoolkit/libtype/Makefile.in
@@ -27,11 +27,11 @@ LPOBL_DEB = -lpobl_deb
 CFLAGS = $(CFLAGS_LOCAL) @POBL_CFLAGS@ @MEF_CFLAGS@ @DEB_CFLAGS@ @X_CFLAGS@ @XFT_CFLAGS@ \
 	@CAIRO_CFLAGS@ @TYPE_CFLAGS@ @OT_LAYOUT_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
 	-DLIBDIR=\"$(libdir)\" \
-	-I/usr/local/include -I${top_srcdir}/vtemu -I${top_srcdir}/uitoolkit/libotl
+	-I${top_srcdir}/vtemu -I${top_srcdir}/uitoolkit/libotl
 
 XFT_LIBS = @XFT_LIBS@
 CAIRO_LIBS = @CAIRO_LIBS@
-LIBS = $(LIBS_LOCAL) $(LPOBL) -L/usr/local/lib -R/usr/local/lib
+LIBS = $(LIBS_LOCAL) $(LPOBL)
 
 LIBTOOL_CC = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS)
 LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CC) @LDFLAGS@
diff --git uitoolkit/ui_im.c uitoolkit/ui_im.c
index 754ddfe4..5ea902ee 100644
--- uitoolkit/ui_im.c
+++ uitoolkit/ui_im.c
@@ -13,7 +13,7 @@
 #ifdef USE_IM_PLUGIN
 
 #ifndef LIBDIR
-#define IM_DIR "/usr/local/lib/mlterm/"
+#define IM_DIR "/opt/local/lib/mlterm/"
 #else
 #define IM_DIR LIBDIR "/mlterm/"
 #endif
diff --git uitoolkit/ui_sb_view_factory.c uitoolkit/ui_sb_view_factory.c
index e3c5fe66..5746bb40 100644
--- uitoolkit/ui_sb_view_factory.c
+++ uitoolkit/ui_sb_view_factory.c
@@ -13,13 +13,13 @@
 #include "ui_imagelib.h"
 
 #ifndef LIBDIR
-#define SBLIB_DIR "/usr/local/lib/mlterm/"
+#define SBLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define SBLIB_DIR LIBDIR "/mlterm/"
 #endif
 
 #ifndef XDATADIR
-#define SB_DIR "/usr/local/share/mlterm/scrollbars"
+#define SB_DIR "/opt/local/share/mlterm/scrollbars"
 #else
 #define SB_DIR XDATADIR "/mlterm/scrollbars"
 #endif
diff --git uitoolkit/xlib/ui_type_loader.c uitoolkit/xlib/ui_type_loader.c
index dcb562d2..794eddb8 100644
--- uitoolkit/xlib/ui_type_loader.c
+++ uitoolkit/xlib/ui_type_loader.c
@@ -9,7 +9,7 @@
 #include <pobl/bl_debug.h>
 
 #ifndef LIBDIR
-#define TYPELIB_DIR "/usr/local/lib/mlterm/"
+#define TYPELIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define TYPELIB_DIR LIBDIR "/mlterm/"
 #endif
diff --git vtemu/Makefile.in vtemu/Makefile.in
index 28063f88..2f42a5f0 100644
--- vtemu/Makefile.in
+++ vtemu/Makefile.in
@@ -20,7 +20,7 @@ CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @MEF_CFLAGS@ @SSH2_CFLAGS@ \
 	@UTMP_CFLAGS@ @FRIBIDI_CFLAGS@ @IND_CFLAGS@ @CTL_CFLAGS@ @VT52_CFLAGS@ \
 	@IMAGE_CFLAGS@ @TOOLS_CFLAGS@ @OT_LAYOUT_CFLAGS@ @TRANSFER_CFLAGS@ @CFLAGS@ \
 	@VT_NORM_CFLAGS@ @TRUECOLOR_CFLAGS@ @PTY_CFLAGS@ @CPPFLAGS@ \
-	-I/usr/local/include -DLIBEXECDIR=\"$(libexecdir)\" -DBINDIR=\"$(bindir)\" \
+	-DLIBEXECDIR=\"$(libexecdir)\" -DBINDIR=\"$(bindir)\" \
 	-DLIBDIR=\"$(libdir)\"
 
 OBJ_CORE = vt_char.o vt_str.o vt_line.o vt_model.o vt_ot_layout.o @VT_NORM_OBJ@ @CTL_LOADER_OBJ@
diff --git vtemu/libctl/Makefile.in vtemu/libctl/Makefile.in
index 48f88b27..1fb5deaa 100644
--- vtemu/libctl/Makefile.in
+++ vtemu/libctl/Makefile.in
@@ -10,7 +10,7 @@ VPATH = ${top_srcdir}/vtemu/libctl
 
 CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @MEF_CFLAGS@ \
 	@FRIBIDI_CFLAGS@ @IND_CFLAGS@ @CTL_CFLAGS@ @TRUECOLOR_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-I/usr/local/include -DLIBDIR=\"$(libdir)\" \
+	-DLIBDIR=\"$(libdir)\" \
 
 LIBS = $(LIBS_LOCAL) @LPOBL@
 LIBS_BIDI = @FRIBIDI_LIBS@
diff --git vtemu/libctl/vt_iscii.c vtemu/libctl/vt_iscii.c
index 6db1c06a..61d5888c 100644
--- vtemu/libctl/vt_iscii.c
+++ vtemu/libctl/vt_iscii.c
@@ -10,7 +10,7 @@
 #include <indian.h>
 
 #ifndef LIBDIR
-#define INDLIB_DIR "/usr/local/lib/mlterm/"
+#define INDLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define INDLIB_DIR LIBDIR "/mlterm/"
 #endif
diff --git vtemu/libptymosh/Makefile.in vtemu/libptymosh/Makefile.in
index 727505d0..3a126094 100644
--- vtemu/libptymosh/Makefile.in
+++ vtemu/libptymosh/Makefile.in
@@ -13,7 +13,7 @@ VPATH = ${top_srcdir}/vtemu/libptymosh:$(MOSH_DIR)/src/network:$(MOSH_DIR)/src/c
 # -I$(MOSH_DIR) is for mosh-1.3.2 or before. (config.h is placed at $(MOSH_DIR))
 # -I$(MOSH_DIR)/src/include is for mosh-1.4.0 or after. (config.h is placed at $(MOSH_DIR)/src/include)
 CFLAGS = $(CFLAGS_LOCAL) -D_GNU_SOURCE @DEB_CFLAGS@ @POBL_CFLAGS@ @MEF_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-pthread @PROTOBUF_CFLAGS@ -I/usr/local/include -DLIBDIR=\"$(libdir)\" \
+	-pthread @PROTOBUF_CFLAGS@ -DLIBDIR=\"$(libdir)\" \
 	-I$(MOSH_DIR) -I$(MOSH_DIR)/src/protobufs -I$(MOSH_DIR)/src/crypto -I$(MOSH_DIR)/src/network \
 	-I$(MOSH_DIR)/src/util -I$(MOSH_DIR)/src/terminal -I$(MOSH_DIR)/src/statesync \
 	-I$(MOSH_DIR)/src/frontend -I$(MOSH_DIR)/src/include
diff --git vtemu/libptyssh/Makefile.in vtemu/libptyssh/Makefile.in
index 2ff3fc37..a34fde44 100644
--- vtemu/libptyssh/Makefile.in
+++ vtemu/libptyssh/Makefile.in
@@ -10,7 +10,7 @@ VPATH = ${top_srcdir}/vtemu/libptyssh
 
 CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @POBL_CFLAGS@ @MEF_CFLAGS@ \
 	@SSH2_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
-	-I/usr/local/include -DLIBDIR=\"$(libdir)\"
+	-DLIBDIR=\"$(libdir)\"
 
 LIBS = $(LIBS_LOCAL) @LPOBL@ @SSH2_LIBS@
 
diff --git vtemu/vt_ctl_loader.c vtemu/vt_ctl_loader.c
index 1689cbd3..223423bb 100644
--- vtemu/vt_ctl_loader.c
+++ vtemu/vt_ctl_loader.c
@@ -9,7 +9,7 @@
 #include <pobl/bl_debug.h>
 
 #ifndef LIBDIR
-#define CTLLIB_DIR "/usr/local/lib/mlterm/"
+#define CTLLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define CTLLIB_DIR LIBDIR "/mlterm/"
 #endif
diff --git vtemu/vt_pty_mosh.c vtemu/vt_pty_mosh.c
index e9bd3535..67ebce93 100644
--- vtemu/vt_pty_mosh.c
+++ vtemu/vt_pty_mosh.c
@@ -10,7 +10,7 @@
 #include <pobl/bl_debug.h>
 
 #ifndef LIBDIR
-#define MOSHLIB_DIR "/usr/local/lib/mlterm/"
+#define MOSHLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define MOSHLIB_DIR LIBDIR "/mlterm/"
 #endif
diff --git vtemu/vt_pty_ssh.c vtemu/vt_pty_ssh.c
index 24997115..c9bdd8b3 100644
--- vtemu/vt_pty_ssh.c
+++ vtemu/vt_pty_ssh.c
@@ -21,7 +21,7 @@
 #include <pobl/bl_file.h>
 
 #ifndef LIBDIR
-#define SSHLIB_DIR "/usr/local/lib/mlterm/"
+#define SSHLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define SSHLIB_DIR LIBDIR "/mlterm/"
 #endif
diff --git vtemu/vt_term_manager.c vtemu/vt_term_manager.c
index b538f4d3..f9c22d60 100644
--- vtemu/vt_term_manager.c
+++ vtemu/vt_term_manager.c
@@ -17,7 +17,7 @@
 #define MTU (8 * sizeof(*dead_mask))         /* MAX_TERMS unit */
 
 #ifndef BINDIR
-#define BINDIR "/usr/local/bin"
+#define BINDIR "/opt/local/bin"
 #endif
 
 #if 0
diff --git vtemu/vt_transfer.c vtemu/vt_transfer.c
index bf4e7ee9..87da3ac4 100644
--- vtemu/vt_transfer.c
+++ vtemu/vt_transfer.c
@@ -12,7 +12,7 @@
 #include "zmodem.h"
 
 #ifndef LIBDIR
-#define TRANSFERLIB_DIR "/usr/local/lib/mlterm/"
+#define TRANSFERLIB_DIR "/opt/local/lib/mlterm/"
 #else
 #define TRANSFERLIB_DIR LIBDIR "/mlterm/"
 #endif
-- 
2.54.0

