diff --git a/README b/README index 8118e5b3..f73956e7 100644 --- a/README +++ b/README @@ -20,7 +20,10 @@ After untarring the distribution and then doing "cd gptl", construct a macros.make file by editing one of the templates provided (currenty there's macros.make.linux, and macros.make.sicortex) that is closest to the machine you're building the library on. Step-by-step instructions for setting each -configuration option are embedded in that file. Then: +configuration option are embedded in that file. If unsure of some settings, +you can run "./suggestions". This is an autoconf "configure" script which has +been modified to just print suggestions, rather than creating any output +files. After creating macros.make: % make all % make install diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index f1bbd338..00000000 --- a/aclocal.m4 +++ /dev/null @@ -1,141 +0,0 @@ -dnl Sets OMPCFLAGS, OMPDEFS. Sets OMP to YES or NO -AC_DEFUN(UD_SET_OMP_C, -[ - OMPCFLAGS="" - OMPDEFS="" - OLDFLAGS="$CFLAGS" - OMP="NO" - - AC_MSG_CHECKING([C flags for openmp]) - - if test "$OMP" = "NO" ; then - OMPCFLAGS="-qsmp=omp" - CFLAGS="$OLDFLAGS $OMPCFLAGS" - AC_TRY_LINK([#include ],[(void) omp_get_max_threads();],OMP="YES",) - fi - - if test "$OMP" = "NO" ; then - OMPCFLAGS="-mp" - CFLAGS="$OLDFLAGS $OMPCFLAGS" - AC_TRY_LINK([#include ],[(void) omp_get_max_threads();],OMP="YES",) - fi - - if test "$OMP" = "NO" ; then - OMPCFLAGS="-openmp" - CFLAGS="$OLDFLAGS $OMPCFLAGS" - AC_TRY_LINK([#include ],[(void) omp_get_max_threads();],OMP="YES",) - fi - - if test "$OMP" = "NO" ; then - OMPCFLAGS="-fopenmp" - CFLAGS="$OLDFLAGS $OMPCFLAGS" - AC_TRY_LINK([#include ],[(void) omp_get_max_threads();],OMP="YES",) - fi - - if test "$OMP" = "YES" ; then - OMPDEFS=-DTHREADED_OMP - AC_MSG_RESULT([$OMPCFLAGS]) - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Threaded tests may behave incorrectly]) - OMPCFLAGS="" - fi - CFLAGS="$OLDFLAGS" -]) - -dnl Sets OMPFFLAGS. Sets FORTOMP to YES or NO -AC_DEFUN(UD_SET_OMP_F77, -[ - AC_LANG_PUSH(Fortran 77) - OMPFFLAGS="" - OLDFLAGS="$FFLAGS" - FORTOMP="NO" - - AC_MSG_CHECKING([Fortran flags for openmp]) - - OMPFFLAGS="-mp" - FFLAGS="$OLDFLAGS $OMPFFLAGS" - AC_TRY_LINK(,[ call omp_get_max_threads()],FORTOMP="YES",) - - if test "$FORTOMP" = "NO" ; then - OMPFFLAGS="-qsmp=omp" - FFLAGS="$OLDFLAGS $OMPFFLAGS" - AC_TRY_LINK(,[ call omp_get_max_threads()],FORTOMP="YES",) - fi - - if test "$FORTOMP" = "NO" ; then - OMPFFLAGS="-omp" - FFLAGS="$OLDFLAGS $OMPFFLAGS" - AC_TRY_LINK(,[ call omp_get_max_threads()],FORTOMP="YES",) - fi - - if test "$FORTOMP" = "NO" ; then - OMPFFLAGS="-openmp" - FFLAGS="$OLDFLAGS $OMPFFLAGS" - AC_TRY_LINK(,[ call omp_get_max_threads()],FORTOMP="YES",) - fi - - if test "$FORTOMP" = "NO" ; then - OMPFFLAGS="-fopenmp" - FFLAGS="$OLDFLAGS $OMPFFLAGS" - AC_TRY_LINK(,[ call omp_get_max_threads()],FORTOMP="YES",) - fi - - if test "$FORTOMP" = "YES" ; then - AC_MSG_RESULT([$OMPFFLAGS]) - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Threaded tests may behave incorrectly]) - OMPFFLAGS="" - fi - FFLAGS="$OLDFLAGS" - AC_LANG_POP(Fortran 77) -]) - -dnl Sets PTHREADCFLAGS, PTHREADDEFS. Sets PTHREADS to YES or NO -AC_DEFUN(UD_SET_PTHREADS_C, -[ - OLDLDFLAGS="$LDFLAGS" - PTHREADDEFS="" - PTHREADCFLAGS="-lpthread" - LDFLAGS="$OLDLDFLAGS $PTHREADCFLAGS" - PTHREADS="NO" - - AC_MSG_CHECKING([C flags for pthreads]) - AC_TRY_LINK([#include ],[(void) pthread_self();],PTHREADS="YES",) - - if test "$PTHREADS" = "YES" ; then - PTHREADDEFS=-DTHREADED_PTHREADS - AC_MSG_RESULT([$PTHREADCFLAGS]) - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Threaded tests may behave incorrectly]) - PTHREADCFLAGS="" - fi - LDFLAGS="$OLDLDFLAGS" -]) - -dnl Modify FLDFLAGS only, not LDFLAGS in the end - -AC_DEFUN(UD_SET_PTHREADS_F77, -[ - AC_LANG_PUSH(Fortran 77) - OLDLDFLAGS="$LDFLAGS" - PTHREADFFLAGS="-lpthread" - LDFLAGS="$OLDLDFLAGS $PTHREADFFLAGS" - PTHREADS="NO" - - AC_MSG_CHECKING([Fortran flags for pthreads]) - AC_TRY_LINK(,[pthread_self()],PTHREADS="YES";,) - - if test "$PTHREADS" = "YES" ; then - THREADDEFS=-DTHREADED_PTHREADS - AC_MSG_RESULT([$PTHREADFFLAGS]) - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Threaded Fortran tests may behave incorrectly]) - PTHREADFFLAGS="" - fi - AC_LANG_POP(Fortran 77) - LDFLAGS="$OLDLDFLAGS" -]) diff --git a/configure.ac b/configure.ac index 473f8285..871f069a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,19 +1,23 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(private.h) AC_LANG(C) - +echo "This script provides suggestions for settings to apply in macros.make" +echo "You can pass things like FC=gfortran or CC=pathcc to it to override defaults." AC_PROG_MAKE_SET AC_PROG_CC() -#AC_PROG_FC() +echo "Assuming C compiler is $CC" +AC_PROG_FC() +echo "Assuming Fortran compiler is $FC" dnl This barfs when CC is pgcc and F77 pgf90 AC_FC_FUNC(z_zz,z_zz) case $z_zz in - z_zz__) echo FORTRANDOUBLEUNDERSCORE ;; - z_zz_) echo FORTRANUNDERSCORE ;; - Z_ZZ) echo FORTRANCAPS ;; + z_zz__) echo "Fortran name mangling: -DFORTRANDOUBLEUNDERSCORE" ;; + z_zz_) echo "Fortran name mangling: -DFORTRANUNDERSCORE" ;; + Z_ZZ) echo "Fortran name mangling: -DFORTRANCAPS" ;; + *) echo "Fortran name mangling: none" ;; esac dnl For proper handling of const and inline AC_C_INLINE -dnl Checks for library functions. -AC_FUNC_VPRINTF +echo "Inlining: -Dinline=$ac_cv_c_inline" +dnl AC_FUNC_VPRINTF diff --git a/macros.make.linux b/macros.make.linux index 4d83aa23..217f0a5a 100644 --- a/macros.make.linux +++ b/macros.make.linux @@ -26,7 +26,7 @@ endif # For gcc, -Dinline=inline is a no-op. For other C compilers, things like # -Dinline=__inline__ may be required. Autoconf test AC_C_INLINE can find the -# right definition. +# right definition. If unsure, try running "./suggestions CC=" INLINEFLAG = -Dinline=inline # To build the Fortran interface, set FORTRAN=yes and define the entries under diff --git a/macros.make.sicortex b/macros.make.sicortex index 3c731cc7..68fdbae9 100644 --- a/macros.make.sicortex +++ b/macros.make.sicortex @@ -1,5 +1,5 @@ # Where to install GPTL library, include files, and man pages -INSTALLDIR = /home/jrosinski/mips +INSTALLDIR = $(HOME)/mips # C compiler and flags: symbols, high optimization, inlining CC = pathcc @@ -24,16 +24,19 @@ else LDFLAGS += -lpthread endif -# For gcc, -Dinline=inline is a no-op. For other C compilers, things like -Dinline=__inline__ -# may be required. Autoconf test AC_C_INLINE can find the right definition. +# For gcc, -Dinline=inline is a no-op. For other C compilers, things like +# -Dinline=__inline__ may be required. Autoconf test AC_C_INLINE can find the +# right definition. If unsure, try running "./suggestions CC=" INLINEFLAG = -Dinline=inline # To build the Fortran interface, set FORTRAN=yes and define the entries under # ifeq ($(FORTRAN),yes). Otherwise, set FORTRAN=no and skip this section. FORTRAN = yes ifeq ($(FORTRAN),yes) -# Fortran name mangling: possibilities are: leave UNDERSCORING blank (none), -# -DFORTRANDOUBLEUNDERSCORE (e.g. g77), and -DFORTRANUNDERSCORE (e.g. gfortran) +# Fortran name mangling: possibilities are: leave UNDERSCORING blank meaning none +# (e.g. xlf90), -DFORTRANDOUBLEUNDERSCORE (e.g. g77), and -DFORTRANUNDERSCORE +# (e.g. gfortran, pathf95) +# # UNDERSCORING = UNDERSCORING = -DFORTRANUNDERSCORE UNDERSCORING = -DFORTRANDOUBLEUNDERSCORE diff --git a/configure b/suggestions similarity index 94% rename from configure rename to suggestions index c4a9ef33..53bd7d4c 100755 --- a/configure +++ b/suggestions @@ -288,7 +288,7 @@ prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, -silent= +silent=yes site= srcdir= verbose= @@ -1258,7 +1258,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - +echo "This script provides suggestions for settings to apply in macros.make" +echo "You can pass things like FC=gfortran or CC=pathcc to it to override defaults." echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` @@ -2218,7 +2219,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -#AC_PROG_FC() +echo "Assuming C compiler is $CC" ac_ext=${FC_SRCEXT-f} ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' @@ -2311,7 +2312,7 @@ fi # Provide some information about the compiler. -echo "$as_me:2314:" \ +echo "$as_me:2315:" \ "checking for Fortran compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -2454,6 +2455,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "Assuming Fortran compiler is $FC" ac_ext=${FC_SRCEXT-f} ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' @@ -2506,7 +2508,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FCFLAGS FCFLAGS="$FCFLAGS $ac_verb" -(eval echo $as_me:2509: \"$ac_link\") >&5 +(eval echo $as_me:2511: \"$ac_link\") >&5 ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_fc_v_output" >&5 FCFLAGS=$ac_save_FFLAGS @@ -2584,7 +2586,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FCFLAGS FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v" -(eval echo $as_me:2587: \"$ac_link\") >&5 +(eval echo $as_me:2589: \"$ac_link\") >&5 ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_fc_v_output" >&5 FCFLAGS=$ac_save_FFLAGS @@ -3201,9 +3203,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu case $z_zz in - z_zz__) echo FORTRANDOUBLEUNDERSCORE ;; - z_zz_) echo FORTRANUNDERSCORE ;; - Z_ZZ) echo FORTRANCAPS ;; + z_zz__) echo "Fortran name mangling: -DFORTRANDOUBLEUNDERSCORE" ;; + z_zz_) echo "Fortran name mangling: -DFORTRANUNDERSCORE" ;; + Z_ZZ) echo "Fortran name mangling: -DFORTRANCAPS" ;; + *) echo "Fortran name mangling: none" ;; esac echo "$as_me:$LINENO: checking for inline" >&5 @@ -3260,7 +3263,7 @@ done fi echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 -echo "${ECHO_T}$ac_cv_c_inline" >&6 + case $ac_cv_c_inline in inline | yes) ;; @@ -3277,219 +3280,4 @@ _ACEOF ;; esac -for ac_func in vprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub__doprnt) || defined (__stub____doprnt) -choke me -#else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} -#endif - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return f != _doprnt; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func__doprnt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6 -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - +echo "Inlining: -Dinline=$ac_cv_c_inline"