diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/Kinfold/configure ViennaRNA-2.1.8/Kinfold/configure
--- ViennaRNA-2.1.8.orig/Kinfold/configure	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/Kinfold/configure	2018-05-08 11:47:01.000000000 -0400
@@ -3938,7 +3938,7 @@
 fi
 
 if [ -d ../lib ] && [ "$ac_VRNA_includes" = "../H" ]; then
-  ac_VRNA_lib=../lib
+  ac_VRNA_lib=../lib/libRNA.a
 fi
 
 if test -z "$ac_VRNA_lib"; then
@@ -3954,9 +3954,6 @@
   done
 done
 fi # $ac_VRNA_lib = NO
-if test $ac_VRNA_lib; then
-  LDFLAGS="-L$ac_VRNA_lib $LDFLAGS"
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result:  headers in \"$ac_VRNA_includes\" and library... \"$ac_VRNA_lib\"" >&5
 $as_echo " headers in \"$ac_VRNA_includes\" and library... \"$ac_VRNA_lib\"" >&6; }
 
@@ -4553,7 +4550,14 @@
 
 
 
-LIBS="-lRNA ${LIBS}"
+if test $ac_VRNA_lib; then
+  if test -d $ac_VRNA_lib; then
+    LDFLAGS="-L$ac_VRNA_lib $LDFLAGS"
+    LIBS="-lRNA ${LIBS}"
+  else
+    LIBS="$ac_VRNA_lib $LIBS"
+  fi
+fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/RNAforester/configure ViennaRNA-2.1.8/RNAforester/configure
--- ViennaRNA-2.1.8.orig/RNAforester/configure	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/RNAforester/configure	2018-05-08 11:40:08.000000000 -0400
@@ -4212,18 +4212,18 @@
 
   LDFLAGS="-L$withval -R$withval ${LDFLAGS}"
 else
-  LDFLAGS="-L../../lib -L../../ViennaRNA ${LDFLAGS} ${OPENMP_CXXFLAGS}"
+  LDFLAGS="${LDFLAGS} ${OPENMP_CXXFLAGS}"
   if test -r "../lib/fold.c"; then
     $as_echo "#define HAVE_LIBRNA 1" >>confdefs.h
 
-    LIBS="-lRNA ${LIBS}"
+    LIBS="../../lib/libRNA.a ${LIBS}"
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: using (to be built) libRNA.a in ../lib" >&5
 $as_echo "using (to be built) libRNA.a in ../lib" >&6; }
   else
     if test -r "../ViennaRNA/fold.c"; then
       $as_echo "#define HAVE_LIBRNA 1" >>confdefs.h
 
-      LIBS="-lRNA ${LIBS}"
+      LIBS="../../ViennaRNA/libRNA.a ${LIBS}"
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: using (to be built) libRNA.a in ../ViennaRNA" >&5
 $as_echo "using (to be built) libRNA.a in ../ViennaRNA" >&6; }
     fi
@@ -4876,11 +4876,10 @@
 fi
 
 
-CPPFLAGS="$save_CPPFLAGS -I../g2-0.70/include/ "
-LDFLAGS="-L../g2-0.70 ${LDFLAGS}"
+CPPFLAGS="-I../g2-0.70/include $save_CPPFLAGS"
 
 if ${HAVE_LIBG2}; then
-  LIBS="-lg2 ${LIBS}"
+  LIBS="../g2-0.70/libg2.a ${LIBS}"
 fi
 
 
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/Makefile.in ViennaRNA-2.1.8/RNAforester/g2-0.70/Makefile.in
--- ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/Makefile.in	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/RNAforester/g2-0.70/Makefile.in	2018-05-08 11:40:08.000000000 -0400
@@ -23,7 +23,7 @@
 
 CC           = @CC@
 CFLAGS       = 
-INCLUDES     = -I./src @CFLAGS@ @DEFS@
+INCLUDES     = -I./src @CPPFLAGS@ @CFLAGS@ @DEFS@ -MD
 INSTALL      = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 FIND         = @FIND@
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/demo/Makefile.in ViennaRNA-2.1.8/RNAforester/g2-0.70/demo/Makefile.in
--- ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/demo/Makefile.in	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/RNAforester/g2-0.70/demo/Makefile.in	2018-05-08 11:40:08.000000000 -0400
@@ -25,7 +25,7 @@
 
 CFLAGS = -I../src -I../src/X11 -I../src/PS -I../src/Win32 -I../src/GD -I../src/FIG @CFLAGS@ @DEFS@
 CXXFLAGS = -I../src -I../src/X11 -I../src/PS -I../src/Win32 -I../src/GD/ -I../src/FIG @CXXFLAGS@ @DEFS@
-LDFLAGS = -L.. -lg2 @LDFLAGS@
+LDFLAGS = ../libg2.a @LDFLAGS@
 
 @DO_PS@DEMO_PS = simple_PS
 @DO_FIG@DEMO_FIG = simple_FIG
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/g2_perl/Makefile.PL ViennaRNA-2.1.8/RNAforester/g2-0.70/g2_perl/Makefile.PL
--- ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/g2_perl/Makefile.PL	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/RNAforester/g2-0.70/g2_perl/Makefile.PL	2018-05-08 11:40:08.000000000 -0400
@@ -4,7 +4,7 @@
 WriteMakefile(
     'NAME'	=> 'G2',
     'VERSION_FROM' => 'G2.pm', # finds $VERSION
-    'LIBS'	=> ['-L./.. -lg2   -L/usr/local/lib -lm -lX11 -lgd'],  # e.g., '-lm' 
+    'LIBS'	=> ['../libg2.a -lm -lX11 -lgd'],  # e.g., '-lm' 
     'DEFINE'	=> '-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DLINUX=1 -DDO_PS=1 -DDO_FIG=1 -DDO_X11=1 -DDO_GD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1',                   # e.g., '-DHAVE_SOMETHING' 
     'INC'	=> '-I./../include',           # e.g., '-I/usr/local/include' 
 );
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/perl/Makefile.PL ViennaRNA-2.1.8/RNAforester/g2-0.70/perl/Makefile.PL
--- ViennaRNA-2.1.8.orig/RNAforester/g2-0.70/perl/Makefile.PL	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/RNAforester/g2-0.70/perl/Makefile.PL	2018-05-08 11:40:08.000000000 -0400
@@ -2,8 +2,8 @@
 
 # =====> PATHS: CHECK AND ADJUST <=====
 my @INC     = qw(-I../src  -I../src/win32 -I../src/PS -I../src/GD); 
-my @LIBPATH = qw(-L../Debug -L../../gd-1.8.4);
-my @LIBS    = qw(-lg2);
+my @LIBPATH = qw(-L../Debug);
+my @LIBS    = qw(../../gd-1.8.4/libg2.a);
 
 # FEATURE FLAGS
 warn "\nPlease choose the features that match how g2 was built:\n";
diff -Nurd -x'*~' ViennaRNA-2.1.8.orig/Utils/Makefile.in ViennaRNA-2.1.8/Utils/Makefile.in
--- ViennaRNA-2.1.8.orig/Utils/Makefile.in	2018-05-08 11:39:54.000000000 -0400
+++ ViennaRNA-2.1.8/Utils/Makefile.in	2018-05-08 11:40:08.000000000 -0400
@@ -330,7 +330,7 @@
 GENGETOPT_CMDL = ct2db_cmdl.c ct2db_cmdl.h
 GENGETOPT_FILES = ct2db.ggo
 EXTRA_DIST = $(pscript) Fold ${GENGETOPT_FILES} ${GENGETOPT_CMDL}
-LDADD = -L../lib -lRNA -lm
+LDADD = ../lib/libRNA.a -lm
 AM_CPPFLAGS = -I$(srcdir)/../H
 ct2db_SOURCES = ct2db_cmdl.c ct2db.c
 all: all-am
