 -	    echo -e "Required GSL version 2.3 not found, exiting...\n"
 -	    exit 72
 +	if ( [[ "${CONDA_BUILD}" ]] ) ; then
-+            export GSLLIBDIR=${CONDA_PREFIX}/lib
-+	    export GSLINCDIR=${CONDA_PREFIX}/include
++            export GSLLIBDIR=${PREFIX}/lib
++	    export GSLINCDIR=${PREFIX}/include
 +	    echo -e "Uisng GSL library from conda in ${GSLLIBDIR}\n"
 +        else
 +    	    if ( [[ "${ACC_PKG}" ]] && [[ "${ACC_PKG}/${BUILD_TYPE}/lib/libgsl*19*" ]] ) ; then

 ENDIF ()
 
+# If this is a conda build we must expand the
+# library search with the CONDA_PREFIX/lib
+# folder.
+IF ($ENV{ACC_CONDA_BUILD})
+  link_directories($ENV{CONDA_PREFIX}/lib)
+ENDIF ()
+
 IF ($ENV{ACC_PLOT_PACKAGE} MATCHES "plplot")

+# one level deeper in the include folder
+IF ($ENV{ACC_CONDA_BUILD})
+  SET (INC_DIRS
+    $ENV{PREFIX}/include/xraylib/
   )
+ELSE ()
+  set (INC_DIRS
