--- a/config/determine-cc.sh
+++ b/config/determine-cc.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 # determine what compiler is behind "cc" (and presumably "CC" and "ftn") wrapper
 
-CC=`which cc 2>/dev/null`
 COMP=
 if [ -z "$CC" ]; then
   echo "No 'cc' located!"
--- a/config/determine-compiler-version.sh
+++ b/config/determine-compiler-version.sh
@@ -24,8 +24,8 @@
          | cut -d\  -f 1`
        COMPVER="${CVER}/${FVER}"
        ;;
-  gnu) COMPVER=`gcc -dumpfullversion -dumpversion`
-       #COMPVER=`gcc -v 2>&1 | grep -i 'Version [0-9]' \
+  gnu) COMPVER=`${CC} -dumpfullversion -dumpversion`
+       #COMPVER=`${CC} -v 2>&1 | grep -i 'Version [0-9]' \
        #  | sed -e 's/^.*ersion \(.\..\..\).*$/\1/'`
        ;;
   *)   ErrorAndExit "Unknown compiler '${COMP}'"
--- a/config/select-compiler.sh
+++ b/config/select-compiler.sh
@@ -9,7 +9,7 @@
 CPS=""
 COMP=""
 
-GNU=`which gcc 2> /dev/null`
+GNU="${CC}"
 if [ -n "${GNU}" ]
 then
   NCPS=`expr ${NCPS} + 1`
--- a/config/select-mpi.sh
+++ b/config/select-mpi.sh
@@ -76,7 +76,6 @@
   if [ -z "${MPIS}" ]; then MPIS="${MPI}"; else MPIS="${MPIS}|${MPI}"; fi
 fi
 
-MPICC=`which mpicc 2> /dev/null`
 if [ -n "${MPICC}" ]
 then
   FMPI=""
@@ -86,7 +85,7 @@
   MPIROOTDIR1=`dirname ${MBINDIR}`
 
   echo "#include <mpi.h>" > conftest.c
-  mpicc -E conftest.c | grep '/mpi.h"' | head -1 > mpiconf.txt
+  "${MPICC}" -E conftest.c | grep '/mpi.h"' | head -1 > mpiconf.txt
   MINCDIR=`cat mpiconf.txt | sed -e 's#^.* "##' -e 's#/mpi.h".*##'`
   if [ -n "${MINCDIR}" ]
   then
--- a/mf/Makefile.defs.linux-gomp
+++ b/mf/Makefile.defs.linux-gomp
@@ -23,24 +23,19 @@
 #------------------------------------------------------------------------------
 # SIONlib General Settings
 #------------------------------------------------------------------------------
-OPTFLAGS = -g -O0 -Wall
+CFLAGS   += -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
 
-CC       = gcc
-CFLAGS   = -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
+CXXFLAGS += $(PFLAG) $(OPTFLAGS) -fPIC
 
-CXX      = g++
-CXXFLAGS = $(PFLAG) $(OPTFLAGS) -O3
-
-F77      = gfortran
-FFLAGS   = $(PFLAG) $(OPTFLAGS)
+FFLAGS   += $(PFLAG) $(OPTFLAGS) -fPIC
 
 F90      = $(F77)
-F90FLAGS = $(PFLAG) $(OPTFLAGS) -ffree-form
+F90FLAGS += $(PFLAG) $(OPTFLAGS) -ffree-form -fPIC $(FCFLAGS)
 
 FPP      =
 FDOPT    = -D
 
-LDFLAGS  = $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
+LDFLAGS  += $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
 UTILLIB  =
 FOBASE   = pomp_fwrapper_base.o
 
@@ -101,10 +96,6 @@
 #------------------------------------------------------------------------------
 
 MPIENABLE = 1
-MPICC     = mpicc
-MPICXX    = mpicxx
-MPIF77    = mpif77
-MPIF90    = mpif90
 MPILIB    = -lmpich
 PMPILIB   = -lpmpich
 #PMPILIB   = # MPICH2
@@ -139,8 +130,7 @@
 #------------------------------------------------------------------------------
 
 SZLIB          = szlib
-SZLIB_OPTFLAGS = -O3
-SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED
+SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED $(CFLAGS)
 SZLIB_LIBPATH  = -L$(TOPDIR)/utils/szlib
 SZLIB_LIB      = -lsc.z
 
--- a/mf/Makefile.defs.linux-gomp10
+++ b/mf/Makefile.defs.linux-gomp10
@@ -23,24 +23,19 @@
 #------------------------------------------------------------------------------
 # SIONlib General Settings
 #------------------------------------------------------------------------------
-OPTFLAGS = -g -O0 -Wall
+CFLAGS   += -std=c99 $(PFLAG) -fPIC
 
-CC       = gcc
-CFLAGS   = -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
+CXXFLAGS += $(PFLAG) -fPIC
 
-CXX      = g++
-CXXFLAGS = $(PFLAG) $(OPTFLAGS) -O3
-
-F77      = gfortran
-FFLAGS   = $(PFLAG) $(OPTFLAGS) -fallow-argument-mismatch
+FFLAGS   += $(PFLAG) -fallow-argument-mismatch -fPIC
 
 F90      = $(F77)
-F90FLAGS = $(PFLAG) $(OPTFLAGS) -ffree-form -fallow-argument-mismatch
+F90FLAGS += $(PFLAG) -ffree-form -fallow-argument-mismatch -fPIC $(FCFLAGS)
 
 FPP      =
 FDOPT    = -D
 
-LDFLAGS  = $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
+LDFLAGS  += $(PFLAG) $(HINTSLIB)
 UTILLIB  =
 FOBASE   = pomp_fwrapper_base.o
 
@@ -101,10 +96,6 @@
 #------------------------------------------------------------------------------
 
 MPIENABLE = 1
-MPICC     = mpicc
-MPICXX    = mpicxx
-MPIF77    = mpif77
-MPIF90    = mpif90
 MPILIB    = -lmpich
 PMPILIB   = -lpmpich
 #PMPILIB   = # MPICH2
@@ -139,7 +130,7 @@
 #------------------------------------------------------------------------------
 
 SZLIB          = szlib
-SZLIB_OPTFLAGS = -O3
+SZLIB_OPTFLAGS = $(CFLAGS)
 SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED
 SZLIB_LIBPATH  = -L$(TOPDIR)/utils/szlib
 SZLIB_LIB      = -lsc.z
--- a/src/fortraninterface/Makefile
+++ b/src/fortraninterface/Makefile
@@ -121,21 +121,21 @@
 	$(CPP) $(F90FLAGS) $(F90FLAGS_CPP) $(F90MPIFLAGS) -P -E -I ../lib sion_f90_mpi.F90 > sion_f90_mpi.f90
 sion_f90_mpi.mod : sion_f90_mpi.o
 sion_f90_mpi.o : sion_f90_mpi.f90 sion_f90.mod $(SION_HDRS)
-	$(MPIF90) $(F90FLAGS) -c sion_f90_mpi.f90
+	$(MPIF90) $(F90FLAGS) $(F90MPIFLAGS) -c sion_f90_mpi.f90
 
 # F90 Interface (OMP)
 sion_f90_omp.f90: sion_f90_omp.F90
 	$(CPP) $(F90OMPFLAGS) $(F90FLAGS) $(F90FLAGS_CPP) -P -E -I ../lib sion_f90_omp.F90 > sion_f90_omp.f90
 sion_f90_omp.mod : sion_f90_omp.o 
 sion_f90_omp.o : sion_f90_omp.f90 sion_f90.mod $(SION_HDRS)
-	$(OMPF90) $(F90FLAGS) -c sion_f90_omp.f90
+	$(OMPF90) $(F90FLAGS) $(F90OMPFLAGS) -c sion_f90_omp.f90
 
 # F90 Interface (OMPI)
 sion_f90_ompi.f90: sion_f90_ompi.F90 $(SION_HDRS)
 	$(CPP) $(F90MPIFLAGS) $(F90OMPFLAGS) $(F90FLAGS) $(F90FLAGS_CPP) -P -E -I ../lib sion_f90_ompi.F90 > sion_f90_ompi.f90
 sion_f90_ompi.mod : sion_f90_ompi.o
 sion_f90_ompi.o : sion_f90_ompi.f90 $(SION_HDRS)
-	$(MPIF90) $(F90FLAGS) -c sion_f90_ompi.f90
+	$(MPIF90) $(F90FLAGS) $(F90MPIFLAGS) -c sion_f90_ompi.f90
 
 
 
