# How to detect GD in source code.

- Thread: https://externals.io/message/14445
- Original archive: https://news-web.php.net/php.internals/14445
- Started by D.Walsh on 2005-01-28T07:43:25+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #14445 — D.Walsh — 2005-01-28T07:43:25+00:00

URL: https://externals.io/message/14445#14445

I've been writing a module, it is dependent on some GD functions, how 
can I detect that GD has been installed PHP native?

I'm not talking about php code to see if the functions are available.

Is there a macro or something that will detect if GD is installed 
native?

If not,do you have code that detects if GD or a GD function is 
installed native?

Anything I can add to aclocal.m4 and/or configure.ac would be greatly 
appreciated.

-- Dale

---

## #14451 — Sara Golemon — 2005-01-28T23:51:46+00:00

URL: https://externals.io/message/14445#14451 · In reply to: #14445

> I've been writing a module, it is dependent on some GD functions, how
> can I detect that GD has been installed PHP native?
>
Taking a page out of Zend/zend_builtin_functions and the source code for the
 `extension_loaded()` userspace function:

    int gd_is_loaded = zend_hash_exists(&module_registry, "gd",
sizeof("gd"));

> Anything I can add to aclocal.m4 and/or configure.ac would be greatly
> appreciated.
>
You could adapt the stuff in ext/gd/config.m4 to look for and link libgd
yourself...

-Sara
