*-pc-os2_emx )
       ;;
       *-*-beos* )
-        SHARED_LD="${CC} -shared -o"
+                        SHARED_LD="${LD} -shared -o"
         PIC_FLAG="-fPIC"
         WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
         WX_ALL="CREATE_LINKS"
             SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS bombs controls dialogs drawing dynamic \
                      font forty fractal image minimal richedit wxpoem"
 
-        EXTRADEFS="-DwxINSTALL_PREFIX=\"$prefix\""
+        CPPFLAGS="$CPPFLAGS \$(EXTRADEFS)"
 else
     SAMPLES_SUBDIRS=""
-    EXTRADEFS=
 fi
 
 SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '`"
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:12963: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:12962: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 
                      font forty fractal image minimal richedit wxpoem"
 
     dnl this is needed to be able to find AFM files
-    EXTRADEFS="-DwxINSTALL_PREFIX=\"$prefix\""
+    CPPFLAGS="$CPPFLAGS \$(EXTRADEFS)"
 else
     SAMPLES_SUBDIRS=""
-    EXTRADEFS=
 fi
 
 dnl for convenience, sort the samples in alphabetical order
 
 WXLIB = @WX_LIBRARY_NAME_STATIC@
 WXSHLIB = @WX_LIBRARY_NAME_SHARED@
 
-EXTRADEFS = @EXTRADEFS@
+EXTRADEFS="-DwxINSTALL_PREFIX=\"@prefix@\""
 
 ########################### VERSION #################################
 
 # We *must* include CPPFLAGS in both of these, to make sure that all
 # header files get found.  (KB)
 
-CFLAGS = @TOOLKIT_DEF@ @WXDEBUG_DEFINE@ @CFLAGS@ @CPPFLAGS@ $(EXTRADEFS)
-CPPFLAGS = @TOOLKIT_DEF@ @WXDEBUG_DEFINE@ @CXXFLAGS@ @CPPFLAGS@ $(EXTRADEFS)
+CFLAGS = @TOOLKIT_DEF@ @WXDEBUG_DEFINE@ @CFLAGS@ @CPPFLAGS@
+CPPFLAGS = @TOOLKIT_DEF@ @WXDEBUG_DEFINE@ @CXXFLAGS@ @CPPFLAGS@
 PICFLAGS = @PIC_FLAG@
 LDFLAGS = @LDFLAGS@