autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number of processors


From: Philipp Gortan
Subject: Re: number of processors
Date: Tue, 03 Sep 2002 09:33:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Philip Willoughby wrote:
| Please could you all try this code on your platforms
| and see what happens, and in the event of it failing to work get back
to me
| with a fix for your platform:

Hi Philip + all,
your software runs nicely on my linux x86 (1 proc), sun 5.8 (4 proc's)
and sun 5.6 (2 proc's).
Anyhow, it doesn't fit nicely into autoconf, so here's my solution:

<code>

AC_MSG_CHECKING([number of processors])
AC_TRY_RUN([

# here comes your program...
# after successful checking for proc' count, save nrprocs to file:

        FILE * fd;
        fd = fopen("./conftest.nrproc", "w");
        if(!fd) {
                exit(EXIT_FAILURE);
        }
        fprintf(fd, "%ld", nprocs);
        fclose(fd);

# let your program end, here comes autoconf again

], [PROC_NR=`cat conftest.nrproc`], [PROC_NR=1])

AC_SUBST([MAKE], ["make -j $PROC_NR"])

AC_MSG_RESULT([$PROC_NR])

</code>

the file, conftest.nrproc get deleted by autoconf automagically when done.

how bout that?
cu, philipp

- --
+------------------------------------------+
|            Philipp Gortan                |
+------------+-----------------------------+
| department | PSE KB B1                   |
+------------+-----------------------------+
|            | Siemens AG                  |
|    address | Gudrunstr. 11               |
|            | A-1100 Vienna               |
+------------+-----------------------------+
|       mail | <address@hidden> |
+------------+-----------------------------+
|      phone | +43/5/1707-45887            |
+------------+-----------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9dGXQ6My5N1RlryQRAkPeAKDqpSmcpKIKkW3lPJ7MNxla1d3qnACgwVqo
zsrsQbFzoIVeAQS6i+geu90=
=z8F/
-----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]