]> git.donarmstrong.com Git - lilypond.git/blobdiff - stepmake/aclocal.m4
Autoconf: fix CFLAGS/CXXFLAGS recognition
[lilypond.git] / stepmake / aclocal.m4
index a3ecf3f9a472223e619447d75fefa4fb23d5eff8..83c07c3a2ddc549c012917841ce641fc9a0122fe 100644 (file)
@@ -163,8 +163,7 @@ AC_DEFUN(STEPMAKE_BISON, [
     fi
 ])
 
-
-AC_DEFUN(STEPMAKE_COMPILE, [
+AC_DEFUN(STEPMAKE_COMPILE_BEFORE, [
     # -O is necessary to get inlining
     CFLAGS=${CFLAGS-""}
     CXXFLAGS=${CXXFLAGS-$CFLAGS}
@@ -204,8 +203,13 @@ AC_DEFUN(STEPMAKE_COMPILE, [
     if test $debug_b = yes; then
        OPTIMIZE="$OPTIMIZE -g"
     fi
-    AC_PROG_CC
+])
+
+AC_DEFUN(STEPMAKE_COMPILE, [
+
+    AC_REQUIRE([STEPMAKE_COMPILE_BEFORE])
+    AC_REQUIRE([AC_PROG_CC])
+
     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
     LD='$(CC)'
     AC_SUBST(LD)
@@ -317,7 +321,31 @@ AC_DEFUN(STEPMAKE_LIBDIR, [
 ])
 
 
+AC_DEFUN(STEPMAKE_PREFIX_EXPAND_FIXUP, [
+    # undo expanding of explicit --infodir=/usr/share
+    # to ease install-time override with prefix=...
+    strip=`echo $includedir | eval sed s@^$prefix@@`
+    if test "$includedir" = "`eval echo $prefix$strip`"; then
+           includedir='${prefix}'$strip''
+    fi
+    strip=`echo $libdir | eval sed s@^$exec_prefix@@`
+    if test "$libdir" = "`eval echo $exec_prefix$strip`"; then
+           libdir='${exec_prefix}'$strip''
+    fi
+    strip=`echo $infodir | eval sed s@^$datarootdir@@`
+    if test "$infodir" = "`eval echo $datarootdir$strip`"; then
+           infodir='${datarootdir}'$strip''
+    fi
+    strip=`echo $mandir | eval sed s@^$datarootdir@@`
+    if test "$mandir" = "`eval echo $datarootdir$strip`"; then
+           mandir='${datarootdir}'$strip''
+    fi
+])
+
+
 AC_DEFUN(STEPMAKE_END, [
+    STEPMAKE_PREFIX_EXPAND_FIXUP
+
     AC_SUBST(OPTIONAL)
     AC_SUBST(REQUIRED)
     
@@ -377,6 +405,7 @@ EOF
 print 'depth=' + ('../' * ( $d-1 ) )
 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
 print 'include \$(configure-srcdir)/$mf'
+print 'MODULE_INCLUDES += \$(src-dir)/\$(outbase)'
 EOF
            done
            for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do