File: configure.ac

package info (click to toggle)
tree-puzzle 5.2-11
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 4,376 kB
  • sloc: ansic: 45,111; sh: 3,366; makefile: 243
file content (171 lines) | stat: -rw-r--r-- 3,918 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
dnl $Id$

dnl Disable caching.
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl

dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(tree-puzzle, 5.2)
AM_CONFIG_HEADER(src/config.h)

dnl Gets build and target system type.

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET


dnl  ---------------------------------------------------------------------
dnl   Test function to test whether mpicc works correctly
dnl  ---------------------------------------------------------------------

AC_DEFUN(AC_TEST_MPICC,[dnl
 if test  "$1" != ""  ; then
 if test  "$MPICCSET" = ""  ; then
cat > conftest.c <<EOF
#include<mpi.h>
int main (int argc, char **argv)
{
MPI_Init(&argc,&argv);
MPI_Finalize();
exit(0);
}
EOF


MPICC=$1
dnl if test  "$MPICC" != "$CC"  ; then
dnl fi

 if test  "$MPICC" != ""  ; then
    AC_MSG_CHECKING(whether $MPICC works as MPI compiler)
    $MPICC conftest.c -o conftest > /dev/null 2>&1
    if test $? = 0 ; then
        AC_MSG_RESULT(yes)
        #MPICC=$MPICC
        MPILIBS=
        MPICCSET=$MPICC
        PPUZZLE=ppuzzle
    else
        AC_MSG_RESULT(no)
        AC_MSG_CHECKING(whether $MPICC needs -lmpi)
        $MPICC conftest.c -o conftest -lmpi > /dev/null 2>&1
        if test $? = 0 ; then
            AC_MSG_RESULT(yes)
            #MPICC=$PCC
            MPILIBS=-lmpi
            MPICCSET=$MPICC
            PPUZZLE=ppuzzle
        else
            AC_MSG_RESULT(no)
            MPICC=
            MPILIBS=
            MPICCSET=
            PPUZZLE=
        fi
    fi
  fi
  rm -f *.conftest*
 fi
 fi ])

if test  "$MPICC" != ""  ; then
  AC_PATH_PROG(MPICC0, $MPICC)
fi
AC_PATH_PROG(MPICC1, mpcc)
AC_PATH_PROG(MPICC2, hcc)
AC_PATH_PROG(MPICC3, mpicc)
AC_PATH_PROG(MPICC4, mpicc_lam)
AC_PATH_PROG(MPICC5, mpicc_mpich)
AC_PATH_PROG(MPICC6, cc)

AC_TEST_MPICC($MPICC0)
AC_TEST_MPICC($MPICC1)
AC_TEST_MPICC($MPICC2)
AC_TEST_MPICC($MPICC3)
AC_TEST_MPICC($MPICC4)
AC_TEST_MPICC($MPICC5)
AC_TEST_MPICC($MPICC6)

ac_cv_prog_MPICC=$MPICC

dnl  ---------------------------------------------------------------------
dnl   Test function to test whether the compiler handles quotes correctly
dnl  ---------------------------------------------------------------------

AC_DEFUN(AC_TEST_CCQUOTES,[dnl
 if test  "$1" != ""  ; then
cat > conftest.c <<EOF
#include<stdio.h>
int main (int argc, char **argv)
{
printf ("%s-%s", PACKAGE, VERSION);
exit(0);
}
EOF

CCQ=$1
 if test  "$CCQ" != ""  ; then
    AC_MSG_CHECKING(whether $CCQ handles quotes correctly)
    $CCQ -DPACKAGE=\"$PACKAGE\" -DVERSION=\"$VERSION\" conftest.c -o conftest > /dev/null 2>&1
    
    if test $? = 0 ; then
        DUMMY=`./conftest`
        if test "$DUMMY" = "$PACKAGE-$VERSION" ; then
            AC_MSG_RESULT(yes)
	else
            AC_MSG_RESULT(no)
	fi
    else
        AC_MSG_RESULT(no)
	
    fi
  fi
  mv conftest.c `basename $CCQ`.conftest.c
  rm -f *.conftest*
 fi ])

AC_TEST_CCQUOTES($MPICC)
AC_TEST_CCQUOTES($CC)

AC_SUBST(MPICC)
AC_SUBST(MPILIBS)
AC_SUBST(MPIDEFS)
AC_SUBST(MPICFLAGS)
AC_SUBST(PPUZZLE)

dnl Checks for libraries.
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, main)
dnl AC_CHECK_LIB(mpi, main)

dnl Use external sprng instead of the local copy of an outdated lib
dnl Replace `main' with a function in -lsprng:
AC_CHECK_LIB(sprng, main)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h)
dnl AC_CHECK_HEADERS([mpi.h])

dnl AC_CHECK_HEADERS([rpc/xdr.h])


dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

dnl Checks for library functions.
dnl AC_CHECK_FUNCS(xdr_u_char)
dnl AC_CHECK_FUNCS(xdr_double)
dnl AC_CHECK_FUNCS(xdrstdio_create)
dnl AC_CHECK_FUNCS(xdr_destroy)
dnl AC_CHECK_FUNCS(xdr_inline)

AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile data/Makefile tests/Makefile])
AC_OUTPUT