--- rpl/configure.ac 2011/09/23 12:36:15 1.1 +++ rpl/configure.ac 2011/11/17 19:29:36 1.9 @@ -2,7 +2,8 @@ dnl Process this file with autoconf to p AC_INIT([rpl],[4.1.4]) AC_CANONICAL_TARGET AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE(silent-rules) +AM_SILENT_RULES([yes]) AC_SUBST(target_cpu) AC_CONFIG_HEADERS([rplconfig.h]) @@ -15,7 +16,7 @@ GPP=gpp-3.0 GNUPLOT=gnuplot-4.4.3 FILE=file-5.03 ICONV=libiconv-1.13.1 -SQLITE=sqlite-3.7.7.1 +SQLITE=sqlite-3.7.8 OPENSSL=openssl-1.0.0e OPENMOTIF=openmotif-2.3.3 LIBXPM=libXpm-3.5.9 @@ -63,7 +64,7 @@ fi dnl Checks for C++ compiler AC_PROG_CXX(g++) -if test "$CXX" != "g++"; then +if test "$GXX" != yes; then AC_MSG_ERROR([Cannot find g++! You have to install it.]) fi @@ -90,14 +91,14 @@ fi dnl Checks for Fortran 77 compiler AC_PROG_F77(gfortran) -if test "$F77" != gfortran -a "$F77" != gfortran-4.4; then - AC_MSG_ERROR([Cannot find gfortran! You have to install it.]) -fi - dnl Check for Fortran 9* compiler AC_PROG_FC(gfortran) -if test "$FC" != gfortran -a "$FC" != gfortran-4.4; then +if test x"$F77" == x; then + AC_MSG_ERROR([Cannot find gfortran! You have to install it.]) +fi + +if test x"$FC" == x; then AC_MSG_ERROR([Cannot find gfortran! You have to install it.]) fi @@ -164,10 +165,34 @@ fi LDFLAGS="$LDFLAGS $ABI" +AC_ARG_ENABLE(recursive, +[ --enable-recursive recursive configuration (default=yes)],[ +if test "$enableval" = "yes"; then + RECURSIVE=yes +else + RECURSIVE=no +fi],[ + RECURSIVE=yes + ] +) + +AC_ARG_WITH(rpltools, +[ --with-rpltools specify rpltools path used for cross compilation],[ +if test "$with_rpltools" = "no" -o "$with_rpltools" = yes; then + AC_MSG_ERROR([You have to specify rpltools path !]) +else + RPLTOOLS=$with_rpltools +fi],[ + RPLTOOLS=\$\(top_builddir\) + ] +) + +AC_SUBST(RPLTOOLS) + dnl RPL/CAS support -AC_ARG_WITH(rplcas, -[ --with-rplcas compile rplcas (default=no)],[ -if test "$with-rplcas" = "no"; then +AC_ARG_ENABLE(rplcas, +[ --enable-rplcas compile rplcas (default=no)],[ +if test "$enableval" = "no"; then RPLCAS=-URPLCAS LIBRPLCAS= else @@ -204,14 +229,48 @@ fi],[ ] ) -AC_ARG_ENABLE(sysv-semaphores, +AC_MSG_CHECKING([for usable shared memory]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include + ], + [ return(0); ])], +[SHARED_MEMORY=-DSHARED_MEMORY; AC_MSG_RESULT(yes)], +[SHARED_MEMORY=-USHARED_MEMORY; AC_MSG_RESULT(no)] + ) +AC_SUBST(SHARED_MEMORY) + +AC_MSG_CHECKING([for pselect]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include + #include + #include + #include + ], + [ + struct timespec tv; + fd_set s1, s2, s3; + tv.tv_sec=1; + tv.tv_nsec=0; + FD_SET(1, &s1); FD_SET(2, &s2); FD_SET(3, &s3); + pselect(5, &s1, &s2, &s3, &tv, NULL); + return(0); + ])], +[PSELECT=-DPSELECT; AC_MSG_RESULT(yes)], +[PSELECT=-UPSELECT; AC_MSG_RESULT(no)] + ) +AC_SUBST(PSELECT) + +AC_ARG_ENABLE(sysv-ipcs, [ --enable-sysv-ipcs use SystemV IPC functions [[default=guessed]]], [ if test "$enableval" = "no"; then - IPCS_SYSV=no + IPCS_SYSV=-UIPCS_SYSV + POSIX_IPCS=no else - IPCS_SYSV=yes + IPCS_SYSV=-DIPCS_SYSV + POSIX_IPCS=yes fi], REG=$LDFLAGS +POSIX_IPCS=guessed LDFLAGS=-lrt [AC_MSG_CHECKING([for POSIX semaphores and shared objects]) AC_RUN_IFELSE( @@ -234,7 +293,7 @@ fd = shm_open(sem , O_CREAT | O_RDWR, S_ LDFLAGS=$REG ) -if test "$IPCS_SYSV" = "-UIPCS_SYSV"; then +if test "$IPCS_SYSV" = "-UIPCS_SYSV" -a "$POSIX_IPCS" = "guessed"; then REG=$LDFLAGS LDFLAGS=-pthread AC_MSG_CHECKING([for POSIX anonymous semaphores]) @@ -348,10 +407,13 @@ if test "$MOTIF_SUPPORT" = "-DMOTIF_SUPP \$(top_builddir)/tools/$LIBXPM/src/.libs/libXpm.a" INCMOTIF="-I\$(top_srcdir)/tools/$OPENMOTIF/lib \ -I\$(top_builddir)/tools/$OPENMOTIF/lib \ - -I\$(top_builddir)/tools/$LIBXPM/include" + -I\$(top_srcdir)/tools/$LIBXPM/include" BUILD_OPENMOTIF="$LIBXPM $OPENMOTIF" - AC_CONFIG_SUBDIRS(tools/$LIBXPM) - AC_CONFIG_SUBDIRS(tools/$OPENMOTIF) + + if test $RECURSIVE = yes; then + AC_CONFIG_SUBDIRS(tools/$LIBXPM) + AC_CONFIG_SUBDIRS(tools/$OPENMOTIF) + fi; fi AC_ARG_ENABLE(experimental, @@ -615,7 +677,9 @@ AC_SUBST(DATE) dnl Checks for libraries AC_CHECK_LIB(m, main,, AC_MSG_ERROR([Can not find libm !])) -AC_CHECK_LIB(pthread, main,, AC_MSG_ERROR([Can not find libpthread !])) +AC_CHECK_LIB(c, pthread_mutex_init,, + [AC_CHECK_LIB(pthread, main,, + AC_MSG_ERROR([Can not find libpthread !]))]) dnl Check for union semun AC_CHECK_TYPE([union semun], SEMUN=-DUNION_SEMUN, SEMUN=-UUNION_SEMUN, [[ @@ -1001,7 +1065,11 @@ if test "$MYGNUPLOT" = "yes"; then gunzip -c "$srcdir"/tools/$GNUPLOT.tar.gz | \ (cd "$srcdir/tools" && tar -xf -) fi - AC_CONFIG_SUBDIRS(tools/$GNUPLOT) + + if test $RECURSIVE = yes; then + AC_CONFIG_SUBDIRS(tools/$GNUPLOT) + fi + GNUPLOT_COMPILATION=$GNUPLOT else GNUPLOT_COMPILATION= @@ -1009,42 +1077,35 @@ fi AC_SUBST(GNUPLOT_COMPILATION) -HOST=$host +HOST=$target AC_SUBST(HOST) -case $host_cpu in - - i?86) - CFLAGS="$CFLAGS -malign-double -mieee-fp -Wall -funsigned-char \ - -Wno-pointer-sign" - FFLAGS="$FFLAGS -malign-double -mieee-fp -Wall -fno-f2c" - FCFLAGS="$FCFLAGS -malign-double -mieee-fp -Wall -fno-f2c" - break ;; - - x86_64*) - CFLAGS="$CFLAGS -malign-double -mieee-fp -Wall -funsigned-char \ - -Wno-pointer-sign" - FFLAGS="$FFLAGS -malign-double -mieee-fp -Wall -fno-f2c" - FCFLAGS="$FCFLAGS -malign-double -mieee-fp -Wall -fno-f2c" - break ;; - - alpha*) - CFLAGS="$CFLAGS -mieee -funsigned-char -Wall \ - -Wno-pointer-sign" - FFLAGS="$FFLAGS -mieee -Wall" - FCFLAGS="$FCFLAGS -mieee -Wall" - break ;; - - sparc*) - CFLAGS="$CFLAGS -Wall -funsigned-char \ - -Wno-pointer-sign" - FFLAGS="$FFLAGS -Wall" - FCFLAGS="$FCFLAGS -Wall" - break ;; +my_save_cflags="$CFLAGS" +FPCFLAGS="" -esac +CFLAGS=-malign-double +AC_MSG_CHECKING([whether CC supports -malign-double]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes]); FPCFLAGS="$FPCFLAGS -malign-double"], + [AC_MSG_RESULT([no])]) +CFLAGS=-mieee-fp +AC_MSG_CHECKING([whether CC supports -mieee-fp]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes]); FPCFLAGS="$FPCFLAGS -mieee-fp"], + [AC_MSG_RESULT([no])]) +CFLAGS=-mieee +AC_MSG_CHECKING([whether CC supports -mieee]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes]); FPCFLAGS="$FPCFLAGS -mieee"], + [AC_MSG_RESULT([no])]) +CFLAGS=$my_save_cflags + +CFLAGS="$CFLAGS $FPCFLAGS -Wall -funsigned-char -Wno-pointer-sign" +FFLAGS="$FFLAGS $FPCFLAGS -Wall -fno-f2c" +FCFLAGS="$FCFLAGS $FPCFLAGS -Wall -fno-f2c" +CXXFLAGS="$CXXFLAGS $FPCFLAGS -Wall -funsigned-char" -case $host_os in +case $target_os in cygwin*) OS=Cygwin @@ -1067,7 +1128,6 @@ DATE=$(env LC_ALL=C date +'%A %x, %X %Z' MALLOC= case $OS in - Darwin) EXPORT_DYNAMIC=-Wl,-flat_namespace NESTED_FUNCTIONS=-fnested-functions @@ -1190,9 +1250,26 @@ case $OS in C_STANDARD=-std=gnu99 ELF= break ;; +esac +case $OS in + OS2) + WHOLE_LIB1="" + WHOLE_LIB2="" + LIB_PREFIX="" + break ;; + + *) + WHOLE_LIB1="-Wl,-whole-archive" + WHOLE_LIB2="-Wl,-no-whole-archive" + LIB_PREFIX="lib" + break ;; esac +AC_SUBST(WHOLE_LIB1) +AC_SUBST(WHOLE_LIB2) +AC_SUBST(LIB_PREFIX) + AC_SUBST(C_STANDARD) AC_SUBST(EXPORT_DYNAMIC) AC_SUBST(NESTED_FUNCTIONS) @@ -1237,15 +1314,17 @@ AC_SUBST(FFLAGS) AC_SUBST(FCFLAGS) AC_SUBST(LDFLAGS) -AC_CONFIG_SUBDIRS(tools/$NCURSES) -AC_CONFIG_SUBDIRS(tools/$READLINE) -AC_CONFIG_SUBDIRS(tools/$GSL) -AC_CONFIG_SUBDIRS(tools/$GPP) -AC_CONFIG_SUBDIRS(tools/$FILE) -AC_CONFIG_SUBDIRS(tools/$ICONV) -AC_CONFIG_SUBDIRS(tools/$SQLITE) -AC_CONFIG_SUBDIRS(tools/$UNITS) -AC_CONFIG_SUBDIRS(tools/$SIGSEGV) +if test $RECURSIVE = yes; then + AC_CONFIG_SUBDIRS(tools/$NCURSES) + AC_CONFIG_SUBDIRS(tools/$READLINE) + AC_CONFIG_SUBDIRS(tools/$GSL) + AC_CONFIG_SUBDIRS(tools/$GPP) + AC_CONFIG_SUBDIRS(tools/$FILE) + AC_CONFIG_SUBDIRS(tools/$ICONV) + AC_CONFIG_SUBDIRS(tools/$SQLITE) + AC_CONFIG_SUBDIRS(tools/$UNITS) + AC_CONFIG_SUBDIRS(tools/$SIGSEGV) +fi AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(COPYING)