summaryrefslogblamecommitdiffstats
path: root/c/src/configure.ac
blob: 44575ca66cfd2773f48e06d34e31dfc25988307b (plain) (tree)
1
2
3
4
5
6
7
8



                                                                 
               
                                                                       
                          
                


                       

                          
 
                                                                   


                     
                            
                  
 


                                 
                                
 


                                       





                                                                   


                                                                            
                 

                      





                                                                 
                                                       
                                                 








                                                               

                                        
                          


                                    
                                                                  
                              
                                          
                         

                                                                             
 
                                                                   
                              
                                            
                          

                                                                               
 
                                                       
                              
                                
 
                                                                     
                              
                                              



                                                             
 
                        
              
               
                        
 

                    


                          

                           
            
                                                                        

                          
                                                             
                                                           
                                               
    
                            
 

                                                        
                               

                             
                                                    
                                  






                                                                      
                                         
                                      


                                  


                                        
                              
                                  
 
                                             
                                 
                                       
  
 
                                  
                              
                                 
 

                                 
                    
                                                  





                                                               


                              
                                                              



                                                               
 



                                                         

                                  
                              


                                                              

                                                           








                                                              
                                                
                                   

                                                           
    
                                                               
 
                                      
 
                                  



                                                
                                                                 
 
                                                       



                                                               


                                                  
                                                                 
 

                                                                


                                                        
                  
 
                                    




                                  

                 
 
                
 
               
 

            


                   
 

            

               
 
         
## Process this file with autoconf to produce a configure script.
## 
## $Id$

AC_PREREQ(2.60)
AC_INIT([rtems-c-src],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([optman])
RTEMS_TOP(../..)

RTEMS_ENABLE_CXX
RTEMS_ENABLE_NETWORKING

RTEMS_CANONICAL_TARGET_CPU

AM_INIT_AUTOMAKE([no-define subdir-objects no-exeext foreign 1.10])
AM_MAINTAINER_MODE

RTEMS_ENABLE_MULTILIB
RTEMS_ENABLE_MULTIPROCESSING
RTEMS_ENV_RTEMSBSP

RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)

RTEMS_CHECK_NETWORKING(RTEMS_BSP)
RTEMS_CHECK_POSIX_API(RTEMS_BSP)

AC_MSG_NOTICE([setting up make/custom])

AS_MKDIR_P([make/custom])
AM_SET_DEPDIR
test -d ${DEPDIR} || mkdir ${DEPDIR}

rm -f ${DEPDIR}/cfg.P
echo "# Do not edit - automatically generated by" > ${DEPDIR}/cfg.P
echo "# $0" >> ${DEPDIR}/cfg.P

# Collect and copy the BSP's make/custom/*.cfg files from the toplevel make 
# directory into the build tree's <bsp>/make/custom subdirectories
CUSTOM_CFG_FILES=
f="${RTEMS_BSP}.cfg"
while test -n "$f"; do
  cfg_file=
  _RTEMS_CHECK_CUSTOM_BSP([$f],cfg_file)
  if test -n "${cfg_file}"; then
    cp ${cfg_file} make/custom/$f
    echo "make/custom/$f: ${cfg_file}" >> ${DEPDIR}/cfg.P
    echo "	cp ${cfg_file} make/custom/$f" >> ${DEPDIR}/cfg.P
    CUSTOM_CFG_FILES="$CUSTOM_CFG_FILES make/custom/$f"
    f=`grep "^include.*make/custom" ${cfg_file} \
    | sed \
      -e 's%^.*custom\/%%' \
      -e s%\$\(RTEMS_HOST\)%${RTEMS_HOST}% \
      -e 's%default\.cfg%%'`;
  else break; fi;
done
cp ${srcdir}/make/custom/default.cfg.in make/custom/default.cfg

AC_MSG_NOTICE([creating make/${RTEMS_BSP}.cache])
${MAKE-make} -f ${srcdir}/make/bsp.mak \
RTEMS_BSP=${RTEMS_BSP} \
RTEMS_HOST=${RTEMS_HOST} \
RTEMS_ROOT=. make/${RTEMS_BSP}.cache

# Read back the cache
AC_CACHE_CHECK([for RTEMS_CPU_MODEL], [ac_cv_env_RTEMS_CPU_MODEL],
[. ./make/${RTEMS_BSP}.cache])
RTEMS_CPU_MODEL=$ac_cv_env_RTEMS_CPU_MODEL
AC_SUBST(RTEMS_CPU_MODEL)
test -n "${RTEMS_CPU_MODEL}" && \
  ac_configure_args="$ac_configure_args 'RTEMS_CPU_MODEL=${RTEMS_CPU_MODEL}'"

AC_CACHE_CHECK([for RTEMS_BSP_FAMILY],[ac_cv_env_RTEMS_BSP_FAMILY],
[. ./make/${RTEMS_BSP}.cache])
RTEMS_BSP_FAMILY=$ac_cv_env_RTEMS_BSP_FAMILY
AC_SUBST(RTEMS_BSP_FAMILY)
test -n "${RTEMS_BSP_FAMILY}" && \
  ac_configure_args="$ac_configure_args 'RTEMS_BSP_FAMILY=${RTEMS_BSP_FAMILY}'"

AC_CACHE_CHECK([for CPU_CFLAGS],[ac_cv_env_CPU_CFLAGS],
[. ./make/${RTEMS_BSP}.cache])
CPU_CFLAGS=$ac_cv_env_CPU_CFLAGS

AC_CACHE_CHECK([for CFLAGS_OPTIMIZE_V],[ac_cv_env_CFLAGS_OPTIMIZE_V],
[. ./make/${RTEMS_BSP}.cache])
CFLAGS_OPTIMIZE_V=$ac_cv_env_CFLAGS_OPTIMIZE_V

CFLAGS="${CFLAGS-${CPU_CFLAGS} ${CFLAGS_OPTIMIZE_V}}"
AS_IF([test x"${CFLAGS}" != x" "],[
  ac_configure_args="$ac_configure_args 'CFLAGS=${CFLAGS}'"])

RTEMS_PROG_CC_FOR_TARGET
AM_PROG_CC_C_O
RTEMS_PROG_CCAS
RTEMS_CANONICALIZE_TOOLS

RTEMS_CHECK_GCC_WEAK

AC_SUBST(CUSTOM_CFG_FILES)
AC_SUBST(cfg_dir)

RTEMS_CHECK_MULTIPROCESSING

BSP_SUBDIRS=
## Configure ${srcdir}/../../cpukit as cpukit/ if multilibs are disabled
RTEMS_BSP_CONFIG_SUBDIR(
  [cpukit],[../../cpukit],
  ['--with-project-root=${with_project_root}../$RTEMS_BSP/' \
   '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \
   '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \
  ],
  [test x"$multilib" = xno])

## Note: the order of the directories below is essential
AC_CONFIG_SUBDIRS([make])
BSP_SUBDIRS="$BSP_SUBDIRS make"

RTEMS_CPU_SUBDIRS(lib/libcpu)
if test -d "${srcdir}/lib/libcpu/${RTEMS_CPU}"; then
  libcpu_cpu_subdir="${RTEMS_CPU}"
else
  libcpu_cpu_subdir=
fi
AC_SUBST(libcpu_cpu_subdir)

# Is there code where there should be for this BSP?
# The bare bsp is a special case as it is not under the RTEMS_CPU path
if test "$RTEMS_BSP_FAMILY" = bare ; then
  AC_CONFIG_SUBDIRS([lib/libbsp/bare])
  AC_SUBST(libbsp_cpu_subdir,bare)
else
  RTEMS_CPU_SUBDIRS([lib/libbsp])
  AC_SUBST(libbsp_cpu_subdir,$RTEMS_CPU)
fi

BSP_SUBDIRS="$BSP_SUBDIRS lib"
BSP_SUBDIRS="$BSP_SUBDIRS libchip"

AS_IF([test "$RTEMS_HAS_CPLUSPLUS" = "yes"],[
  AC_CONFIG_SUBDIRS([librtems++])
  BSP_SUBDIRS="$BSP_SUBDIRS librtems++"
])

BSP_SUBDIRS="$BSP_SUBDIRS support"
BSP_SUBDIRS="$BSP_SUBDIRS ada"
BSP_SUBDIRS="$BSP_SUBDIRS wrapup"

BSP_SUBDIRS="$BSP_SUBDIRS optman"

AC_ARG_ENABLE([ada],
[AS_HELP_STRING(--enable-ada,enable ada support)],
[case "${enable_ada}" in
  yes) ;;
  no) ;;
  *)  AC_MSG_ERROR(bad value ${enable_ada} for --enable-ada) ;;
esac],[enable_ada=no])

RTEMS_BSP_CONFIG_SUBDIR(
  [ada-tests],[ada-tests],
  ['--enable-rtems-root=../' \
   '--enable-project-root=${with_project_root}../$RTEMS_BSP' \
   '--with-project-top=${with_project_top}../' \
   '--enable-rtemsbsp=$RTEMS_BSP' \
  ],
  [test x"$enable_tests" = xyes && test x"$enable_ada" = xyes])

# HACK ALERT!

# FIXME: Assume multilib implies in-source-tree multilibs
# Build testsuites multilibbed
RTEMS_BSP_CONFIG_SUBDIR(
  [testsuites],[../../testsuites],
  ['--enable-rtems-root=../' \
   '--enable-project-root=${with_project_root}../$RTEMS_BSP' \
   '--with-project-top=${with_project_top}../' \
   '--enable-rtemsbsp=$RTEMS_BSP' \
   '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \
   '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \
  ],
  [test x"$enable_tests" != x"no" && test x"$multilib" = xno])

# Build testsuites non-multilibbed
RTEMS_BSP_CONFIG_SUBDIR(
  [testsuites],[../../testsuites],
  ['--enable-rtems-root=../' \
   '--enable-cpukit-root=${with_project_root}..' \
   '--enable-project-root=${with_project_root}../$RTEMS_BSP' \
   '--with-project-top=${with_project_top}../' \
   '--enable-rtemsbsp=$RTEMS_BSP' \
   '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \
   '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \
  ],
  [test x"$enable_tests" != x"no" && test x"$multilib" = xyes])

AC_SUBST([BSP_SUBDIRS],[$BSP_SUBDIRS])

AS_IF([test "$host_cpu" = sparc],[
  AC_DEFINE_UNQUOTED([CPU_U32_FIX],[1],
    [whether to enable ipalignment work-around])
])

AM_CONDITIONAL([HAS_NETWORKING],[test "$HAS_NETWORKING" = "yes"])

AM_CONDITIONAL(HAS_POSIX,test "$HAS_POSIX_API" = "yes")

# The posix bsp doesn't support libchip
# FIXME: We should use a feature based check, here
AM_CONDITIONAL([LIBCHIP],[test "$RTEMS_BSP_FAMILY" != "posix"])

# The bare bsp doesn't have libbsp.a
# FIXME: We should use a feature based check, here
AM_CONDITIONAL([HAS_LIBBSP],[test "$RTEMS_BSP_FAMILY" != "bare"])

AM_CONDITIONAL([MULTILIB],[test x"${enable_multilib}" = x"yes"])

AM_CONDITIONAL(RTEMS_ADA,[test x"$enable_ada" = x"yes" \
  && test x"$rtems_cv_HAS_POSIX_API" = x"yes"])

RTEMS_PROJECT_ROOT

# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile],
[${MAKE} make/${RTEMS_BSP}.cache],
[RTEMS_BSP=${RTEMS_BSP}
 MAKE=${MAKE}])

AC_CONFIG_FILES([
support/Makefile 

libchip/Makefile

optman/Makefile

lib/Makefile

lib/libcpu/Makefile

lib/libbsp/Makefile

ada/Makefile

wrapup/Makefile
])

AC_OUTPUT