diff --git a/Makefile.am.template b/Makefile.am.template
index d3a9bc6dc4ced65c60b13afd3d549a2597ce488f..24030cdf2fe861e9f41308137188b23a83bff0fd 100644
--- a/Makefile.am.template
+++ b/Makefile.am.template
@@ -93,3 +93,6 @@ endif
 %NO_MULTI_DIM% $(top_srcdir)/generate-alberta-automakefiles.sh
 %NO_MULTI_DIM%	cd $(top_srcdir) && sh generate-alberta-automakefiles.sh
 %NO_MULTI_DIM%endif
+
+all-local:
+	make -C ../Common all-local
diff --git a/configure.ac b/configure.ac
index 0ed22e664b49a26279f708d698d1c667f3fb9e0f..e40888d4b66adbdfbcbc0595e1729d4748540ee3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,6 +239,9 @@ ALBERTA_ENABLE_FLAG([gcc-attribute-flatten],
 if test "${CFLAGS+set}" = set; then
     alberta_save_CFLAGS="$CFLAGS"
 fi
+if test "${CXXFLAGS+set}" = set; then
+    alberta_save_CXXFLAGS="$CXXFLAGS"
+fi
 if test "${FFLAGS+set}" = set; then
     alberta_save_FFLAGS="$FFLAGS"
 fi
@@ -409,7 +412,11 @@ if test "${BUILD_PROFILE_LIBS}" = "1"; then
 #
     if ! test "${ALBERTA_PROFILE_CFLAGS+set}" = set; then
 	if test "${alberta_save_CFLAGS+set}" = set; then
-	    ALBERTA_PROFILE_CFLAGS="${alberta_save_CFLAGS}"
+	    if test "$GCC" = yes; then
+		ALBERTA_PROFILE_CFLAGS="${alberta_save_CFLAGS} -pg -ggdb3"
+	    else
+		ALBERTA_PROFILE_CFLAGS="${alberta_save_CFLAGS} -p"
+	    fi
 	else
 	    if test "$GCC" = yes; then
 		ALBERTA_PROFILE_CFLAGS="-Wall -pedantic -std=c99 -O3 -pg -ggdb3"
@@ -425,10 +432,14 @@ if test "${BUILD_PROFILE_LIBS}" = "1"; then
     
     if ! test "${ALBERTA_PROFILE_CXXFLAGS+set}" = set; then
 	if test "${alberta_save_CXXFLAGS+set}" = set; then
-	    ALBERTA_PROFILE_CXXFLAGS="${alberta_save_CXXFLAGS}"
+	    if test "$GCC" = yes; then
+		ALBERTA_PROFILE_CXXFLAGS="${alberta_save_CXXFLAGS} -pg -ggdb3"
+	    else
+		ALBERTA_PROFILE_CXXFLAGS="${alberta_save_CXXFLAGS} -p"
+	    fi
 	else
 	    if test "$GCC" = yes; then
-		ALBERTA_PROFILE_CXXFLAGS="-Wall -fno-rtti -fno-exceptions -O3 -pg"
+		ALBERTA_PROFILE_CXXFLAGS="-Wall -fno-rtti -fno-exceptions -O3 -pg -ggdb3"
 	    else # use autoconf defaults
 		ALBERTA_PROFILE_CXXFLAGS="${CXXFLAGS}"
 	    fi
@@ -436,6 +447,25 @@ if test "${BUILD_PROFILE_LIBS}" = "1"; then
     fi
     AC_ARG_VAR([ALBERTA_PROFILE_CXXFLAGS],
 	[C++ compiler-flags used to create the profiling libraries])
+
+    if ! test "${ALBERTA_PROFILE_FFLAGS+set}" = set; then
+	if test "${alberta_save_FFLAGS+set}" = set; then
+	    if test "$GCC" = yes; then
+		ALBERTA_PROFILE_FFLAGS="${alberta_save_FFLAGS} -pg -ggdb3"
+	    else
+		ALBERTA_PROFILE_FFLAGS="${alberta_save_FFLAGS} -p"
+	    fi
+	else
+	    if test "$GCC" = yes; then
+		ALBERTA_FFLAGS="${FFLAGS} -O3 -pg -ggdb3"
+	    else
+		ALBERTA_PROFILE_FFLAGS="-O -p"
+	    fi
+	fi
+    fi
+    AC_ARG_VAR([ALBERTA_PROFILE_FFLAGS],
+	[Fortran compiler-flags for profiling enabled libraries])
+
 fi
 
 #
diff --git a/gen-assemble-fcts.sh b/gen-assemble-fcts.sh
index 547e997cd0a849f811090a052651ae65603d9a28..7dc294af47441750f453fe265847ca8fb7f262d4 100755
--- a/gen-assemble-fcts.sh
+++ b/gen-assemble-fcts.sh
@@ -60,6 +60,13 @@ for target in DST SRC LALT LB C; do
 	SED_STRING="${SED_STRING} -e 's|@${PTR_TYPE}@|REAL_D *|g'"
 	SED_STRING="${SED_STRING} -e 's|@${DOWB_NAME}@|real_dd|g'"
 	SED_STRING="${SED_STRING} -e 's|@${CONSTCAST}@|(const REAL_D *)|g'"
+	if test "${target}" = "LB"; then
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${RET_TYPE}@|const REAL_DDD *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${TYPE}@|REAL_DDD|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${PTR_TYPE}@|REAL_DD *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${DOWB_NAME}@|real_ddd|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${CONSTCAST}@|(const REAL_DD *)|g'"
+	fi
 	;;
 	DM)
 	case ${target} in
@@ -77,6 +84,13 @@ for target in DST SRC LALT LB C; do
 	SED_STRING="${SED_STRING} -e 's|@${PTR_TYPE}@|REAL *|g'"
 	SED_STRING="${SED_STRING} -e 's|@${DOWB_NAME}@|real_d|g'"
 	SED_STRING="${SED_STRING} -e 's|@${CONSTCAST}@|/**/|g'"
+	if test "${target}" = "LB"; then
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${RET_TYPE}@|const REAL_DD *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${TYPE}@|REAL_DD|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${PTR_TYPE}@|REAL_D *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${DOWB_NAME}@|real_dd|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${CONSTCAST}@|(const REAL_D *)|g'"
+	fi
 	;;
 	SCM)
 	case ${target} in
@@ -94,6 +108,13 @@ for target in DST SRC LALT LB C; do
 	SED_STRING="${SED_STRING} -e 's|@${PTR_TYPE}@|NOT_NEEDED|g'"
 	SED_STRING="${SED_STRING} -e 's|@${DOWB_NAME}@|real|g'"
 	SED_STRING="${SED_STRING} -e 's|@${CONSTCAST}@|/**/|g'"
+	if test "${target}" = "LB"; then
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${RET_TYPE}@|const REAL_D *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${TYPE}@|REAL_D|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${PTR_TYPE}@|REAL *|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${DOWB_NAME}@|real_d|g'"
+	    SED_STRING="${SED_STRING} -e 's|@ADV_${CONSTCAST}@|/**/|g'"
+	fi
 	;;
     esac
 done